[gathering-options] Arrow symbol
Ola Bini
ola.bini at gmail.com
Thu Jun 23 19:20:46 PDT 2011
Stephen
I don't know if this is a valid thing to say based on your rules, but
the pipe symbol is going to be quite hard to use for the first { }
syntax, since it is ambiguous with the binary or operator. That
ambiguity should be possible to resolve from a semantic perspective,
since a lambda taking one argument will always be assigned to a SAM with
one argument type, but I assume that such semantic resolution will
happen way after parsing time.
Cheers
On 2011-06-23 14.55, Stephen Colebourne wrote:
> Summary after 1 day of "gathering options":
>
> (I've added more examples, using what I believe to be reasonable
> variants of two syntax families, please don't argue too much based on
> the rest of the syntax I used, just focus on the "arrow")
> ----------------------------------------
> Standard single line examples:
> Use ->
> {x -> x + 1}
> (x) -> {x + 1}
>
> Use =>
> {x => x + 1}
> (x) => {x + 1}
>
> Use :
> {x : x + 1}
> (x) : {x + 1}
>
> Use |
> {x | x + 1}
> (x) | {x + 1}
>
> ----------------------------------------
> Alternate single line examples:
> Use ->
> { -> 42}
> {x -> {y -> x + y}}
>
> () -> {42}
> x -> {y -> {x + y}}
> x -> y -> x + y
>
> Use =>
> { => 42}
> {x => {y => x + y}}
>
> () => {42}
> x => {y => {x + y}}
> x => y => x + y
>
> Use :
> { : 42}
> {x : {y : x + y}}
>
> () : {42}
> x : {y : {x + y}}
> x : y : x + y
>
> Use |
> { | 42}
> {x | {y | x + y}}
>
> () | {42}
> x | {y | {x + y}}
> x | y | x + y
>
> ----------------------------------------
> Multi-line examples:
> Use ->
> {x, y ->
> if (x > y) {
> return x;
> }
> return y;
> }
>
> Use =>
> {x, y =>
> if (x > y) {
> return x;
> }
> return y;
> }
>
> Use :
> {x, y :
> if (x > y) {
> return x;
> }
> return y;
> }
>
> Use |
> {x, y |
> if (x > y) {
> return x;
> }
> return y;
> }
>
> ----------------------------------------
> - This thread is for GATHERING OPTIONS, not voting or discussing.
> - You should only suggest an option if you personally prefer it to the
> -> or => symbol
> - You MUST include the two (original) examples converted to use your
> preferred symbol
> - Suggesting a symbol does not imply that you want any syntax with an
> arrow (ie. you can prefer strawman family, but suggest an arrow
> symbol)
> - Don't reply just to say "I don't want an arrow symbol"
> - Don't reply to propose a syntax that is completely different to one
> of the four syntax families
>
> This is the *final call* for arrow proposals.
>
> Stephen
>
>
--
Ola Bini (http://olabini.com)
Ioke - JRuby - ThoughtWorks
"Yields falsehood when quined" yields falsehood when quined.
More information about the lambda-dev
mailing list