caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* How do I ..
@ 1999-12-18  7:02 skaller
  1999-12-18 17:59 ` Brian Rogoff
  1999-12-18 18:09 ` David Brown
  0 siblings, 2 replies; 7+ messages in thread
From: skaller @ 1999-12-18  7:02 UTC (permalink / raw)
  To: caml-list

I'm confused:

       Objective Caml version 2.99 (99/12/08)

# let f (lx:x : int) = x + 1;;
Syntax error


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?

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 ... 

where I can't tell which x is which, with

	let f xlabl:xparam ..

where the names clearly suggest what is what.

--
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850




^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: How do I ..
@ 1999-12-18 17:41 Juergen Pfitzenmaier
  0 siblings, 0 replies; 7+ messages in thread
From: Juergen Pfitzenmaier @ 1999-12-18 17:41 UTC (permalink / raw)
  To: caml-list


John Skaller was asking about:
> # let f (lx:x : int) = x + 1;;
> Syntax error

maybe   let f lx: (x : int) = x + 1;;
is what you want.

pfitzen




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-12-21 21:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-18  7:02 How do I skaller
1999-12-18 17:59 ` Brian Rogoff
1999-12-20 11:06   ` Jacques Garrigue
1999-12-20 20:16     ` Brian Rogoff
1999-12-21 17:39       ` Jacques Garrigue
1999-12-18 18:09 ` David Brown
1999-12-18 17:41 Juergen Pfitzenmaier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).