Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] labels and optional arguments in 3.06
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] labels and optional arguments in 3.06

>Indeed, that would leave no ambiguity. So it might be ok to allow
>mixing labelled optional arguments in an otherwise unlabelled
>application, if there is no ambiguity on labels. But is it really
>worth a strange definition, when the workaround is just to add
>parentheses?

I appreciate your point here about compiler complexity, but I'd say the 
answer is yes.  The parentheses just add to the syntactic mess, they don't 
help with it and make things clearer (which is the original point of 
labels).  It's preferable to just not use the labels than to bizarrely 
parenthesize functions, I think.  Imagine reading some code and looking at 
a function call with parentheses like that, knowing that currying makes it 
so there's no need for them if there were no labels.  You'd have to stop 
and think about what was going on.  So, I'd say that's a readability 
lose.  It'd be better to just punt the labels and optional arguments 
altogether, because at least then the code is "normal".  But, that's a lose 
too, since optional arguments are very useful.  Plus, the ambiguity 
wouldn't come up very often, so overall it's an intuitive win as well.

How hard would it be to implement this rule?

Chris

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners