lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Nov 27, 2010, at 10:42 AM, Axel Kittenberger wrote:

>> Or to put a more focused point on this discussion but stepping away from syntactic specificities: Should functions (or some functions) be as well supported syntactically as tables? What would be gained by doing so? How much clarity would be lost by doing so? Etc. (Obviously the clarity question fairly rapidly comes back to syntax.)
> 
> {[( The core problem may be ASCII only has 3 types of brackets and a
> <pseudo one> - as if viewing this from a human language perspective
> wouldn't be kinda of funny already - this isn't enough)]}

Nice observation. So, perhaps what we need are pseudo-brackets.

	<[ x, y => { foo = x, baz = y } ]>

Or:

	<< x, y => { foo = x, baz = y } >>

This, however, gets ugly with functions as results:

	<< x => << y => { foo = x, baz = y } >> >>

Even replacing the internal separator only sort of helps:

	<< x | << y | { foo = x, baz = y } >> >>

This is seeming like a good test of whether  a proposed syntax decays into line noise...

1. \x ( \y  ( { foo = x, baz = y } ) ) -- Parentheses feel arbitrary

2. \x \y { foo = x, baz = y } -- Probably makes the ML crowd happy

3. \( x ) \( y ) { foo = x, baz = y } -- As above

4. | x | | y | { foo = x, baz = y } -- Much like 2 but more friendly to longer parameter lists 

5. \[ x => \[ y => { foo = x, baz = y } ] ] -- Not as compact, but to me the rhythm seems better

This discussion, however, probably also increases pressure for a viable ternary expression or other conditional form.

Mark