A syntax option (function types versus arrays)
Joshua Bloch
jjb at google.com
Thu Mar 11 23:11:09 PST 2010
Stefan,
Thanks, this is really useful!
In my view, *all *of the Currying examples are rather ugly. Perhaps it
isn't the syntax that's at fault, then. Perhaps the Currying itself is to
blame, and ordinary Java programmers won't be writing this kind of code. If
this is so, then I suppose we should be more concerned with the syntax of
simpler examples. I think the currently proposed syntax (!) is pretty good
for simple examples.
Josh
On Thu, Mar 11, 2010 at 1:59 PM, Stefan Schulz <schulz at the-loom.de> wrote:
> On 11.03.2010 19:01, Joshua Bloch wrote:
> > My two cents:
> >
> > #< #< R() throws E>( #< R( A ) throws E>, A )> curry =
> > new #< #<R() throws E>( #< R( A ) throws E> l, A a )>( l.( a ) );
> >
> > (..)
> >
> > I do think it makes sense to explore new syntax proposals, but I'm not
> sure
> > I like this one better than the one that's currently on the table.
>
> Adding another two cents. The use of hash plus angle brackets plus round
> parens gives quite some noise. I imagine adding some parameterized types
> in such a definition ...
>
> I scanned the list and noted down the syntax proposals we have so far
> (order of appearance on the list) using a simplyfied notation (ignoring
> optional definitions). I also added a curry-example to each of them,
> which I hopefully got right.
>
> Cheers,
> Stefan
>
>
> 1) Straw-man, latest
> # ResultType ( TypeList ) ( throws ExceptionList )
> Curry-example:
> ##R()(throws E) (#R(A)(throws E), A) curry = ...
>
> 2) Peter Levart, 26 Jan 2010
> # ( TypeList : ResultType throws ExceptionList )
> Curry-example:
> #( #(A: R throws E), A: #(: R throws E) ) curry = ...
>
> 3) John Rose, 26 Jan 2010 ff
> ( TypeList ) throws PipedExceptionList -> ResultType
> Curry-example:
> ((A) throws E -> R, A) -> () throws E -> R curry = ...
>
> 4) Neal Gafter, 27 Jan 2010
> # ( TypeList -> ResultType throws ExceptionList )
> Curry-example:
> #(#(A -> R throws E), A) -> #( -> R throws E)) curry = ...
>
> 5) Stefan Schulz, 31 Jan 2010
> [ ResultType ( TypeList ) throws ExceptionList ]
> Curry-example:
> [[R() throws E]([R(A) throws E], A) curry = ...
>
> 6) Remi Forax, 09 Feb 2010
> TypeList throws ExceptionList -> ResultType
> (plus additional parens rules)
> Curry-Example:
> (A throws E -> R), A -> (throws E -> R) curry = ...
>
> 7) Peter Levart, 9 Feb 2010
> ReturnType # ( TypeList ) throws ExceptionList
> Curry-Example:
> R #() throws E #(R #(A) throws E, A) curry = ...
>
> 8) Stefan Schulz, 16 Feb 2010
> (: TypeList -> ResultType throws ExceptionList )
> Curry-Example:
> (: (: A -> R throws E ), A -> (: -> R throws E) ) curry = ...
>
> 9) Neal Gafter, 26 Feb 2010
> ( TypeList throws ExceptionList ) -> ResultType
> Curry-Example:
> ( (A throws E) -> R, A ) -> (throws E) -> R curry = ...
>
> 10) BGGA
> { TypeList => ResultType throws ExceptionList }
> Curry-example:
> { {A => R throws E}, A => { => R throws E} } curry = ...
>
> 11) FCM
> # ( ResultType ( TypeList ) throws ExceptionList )
> Curry-example:
> #( #(R() throws E) ( #(R(A) throws E), A ) ) curry = ...
>
> 12) FCM Alternate
> # ( TypeList return ResultType throws ExceptionList )
> Curry-example:
> #( #(A return R throws E), A return #(return R throws E)) curry = ...
>
> 13) Howard Lovatt, 11 Mar 2010
> # < ResultType ( TypeList ) throws ExceptionList >
> Curry-example:
> #< #< R() throws E >( #< R( A ) throws E >, A ) > curry = ...
>
> 14) Gernot Neppert, 11 Mar 2010
> lambda < ReturnType , TypeList , throws ExceptionList >
> Curry-example:
> lambda<lambda<R, throws E>, lambda<R, A, throws E>, A> curry = ...
>
>
>
More information about the lambda-dev
mailing list