Browse thread
Re: Syntax for label
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Max Skaller <skaller@m...> |
| Subject: | Re: Semantic of label: The best (only ?) solution to merge both mode |
Christophe Raffalli wrote: > > A small mistake: > > f a means a is the argument corresponding to the first non > optionnal > argument of f WHICH IS NOT GIVEN LATER WITH AN EXPLICIT LABEL ! This is a complication. In ocaml 2.0x, application is left associative: f a b c d .. = ((((f a) b) c) d) but this would not be the case with the above rule. I propose instead the simpler description you gave where a function is applied to _one_ argument to produce a curried function which is then applied to the next: the next argument is 'used up', labelled or not, immediately. Therefore consider: let f l1:p1 l2:p2 .. = f a l1:b means precisely: ((f a) l1:b) and gives an error because 'l1:' is NOT a label of the function (f a), which is like let fa l2:p2 ... = By your interpretation, the function call would be correct and equivalent to f l2:a l1:b or f b a So I think your original unqualified version is actually better :-) -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net