[
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: | Brian Rogoff <bpr@b...> |
| Subject: | Re: How do I .. |
On Sat, 18 Dec 1999, skaller wrote: > I'm confused: > > Objective Caml version 2.99 (99/12/08) > > # let f (lx:x : int) = x + 1;; > Syntax error Try "#modern true;;" at the top level, or compile with the -modern switch. I hope this modern/classic mode distinction is just a temporary thing. > Here, I have an argument x, a label lx, and a type declaration int. > What's the error? Can't I both label an argument, and also type it? Modern mode handles it. I would have thought classic mode would too, since you're not reordering arguments, but I see that's not the case. Explanation anyone? > The whitespace rule is a bit weird .. but it makes some sense, > when compared with 'a for a type variable: the ' must come > right in front of the a, with no white space, so I guess > I can live with lablx:x as a labelled argument .. :-) > > At first, I got really confused by the difference between > a label, and the name of the argument. Until I realised, > you can't use the name of the argument as a label, because > it would imply all arguments were labelled. In the tutorial, > it would be nice to replace ambiguous examples like: > > let f x:x ... I think that the label is "x:" and the argument name is "x", with the sugar that :x is equivalent to x:x. At least that's how I interpreted the rules. -- Brian