caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: [Caml-list] Why are type functions postfix?
@ 2002-08-13  0:49 Arturo Borquez
  0 siblings, 0 replies; 6+ messages in thread
From: Arturo Borquez @ 2002-08-13  0:49 UTC (permalink / raw)
  To: Tim Freeman; +Cc: caml-list

tim@fungible.com (Tim Freeman) wrote:

>
>In OCAML and other ML dialects I've used, you say:
>
>   let x: int ref = ref 3
>
>Is there any reason that type functions like the first "ref" are
>postfix, unlike function application like the second "ref" that is
>prefix?
>
In the revised syntax (Camlp4) that is:

value x : ref int = ref 3; (* ref prefixed on both sides *)

Regards
Arturo Borquez
 


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

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


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

* Re: [Caml-list] Why are type functions postfix?
  2002-08-23 12:38   ` Sven LUTHER
@ 2002-08-23 13:58     ` Xavier Leroy
  0 siblings, 0 replies; 6+ messages in thread
From: Xavier Leroy @ 2002-08-23 13:58 UTC (permalink / raw)
  To: Sven LUTHER; +Cc: Tim Freeman, caml-list

> Is it not because in the type notation, int ref is similar to int list,
> while in the function application, ref 3 is similar to a constructor
> application like Some 3 for example ?

Yes, of course.  But the original question was: all function or data
constructor applications (in expressions) are prefix, while type
constructor applications (in type expressions) are postfix; why?
Answer: ask Robin Milner :-)

- Xavier Leroy
-------------------
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


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

* Re: [Caml-list] Why are type functions postfix?
  2002-08-23  9:24 ` Xavier Leroy
@ 2002-08-23 12:38   ` Sven LUTHER
  2002-08-23 13:58     ` Xavier Leroy
  0 siblings, 1 reply; 6+ messages in thread
From: Sven LUTHER @ 2002-08-23 12:38 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: Tim Freeman, caml-list

On Fri, Aug 23, 2002 at 11:24:04AM +0200, Xavier Leroy wrote:
> > In OCAML and other ML dialects I've used, you say:
> > 
> >    let x: int ref = ref 3
> > 
> > Is there any reason that type functions like the first "ref" are
> > postfix, unlike function application like the second "ref" that is
> > prefix?
> 
> I think it's mostly historical: the original LCF ML used the postfix
> syntax, and this syntax was kept in SML as well as in Caml.

Is it not because in the type notation, int ref is similar to int list,
while in the function application, ref 3 is similar to a constructor
application like Some 3 for example ?

Or are you saying that even this kind of notations come from the
original LCF ML ?

Friendly,

Sven Luther
-------------------
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


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

* Re: [Caml-list] Why are type functions postfix?
  2002-08-12 19:02 Tim Freeman
  2002-08-12 19:57 ` Vitaly Lugovsky
@ 2002-08-23  9:24 ` Xavier Leroy
  2002-08-23 12:38   ` Sven LUTHER
  1 sibling, 1 reply; 6+ messages in thread
From: Xavier Leroy @ 2002-08-23  9:24 UTC (permalink / raw)
  To: Tim Freeman; +Cc: caml-list

> In OCAML and other ML dialects I've used, you say:
> 
>    let x: int ref = ref 3
> 
> Is there any reason that type functions like the first "ref" are
> postfix, unlike function application like the second "ref" that is
> prefix?

I think it's mostly historical: the original LCF ML used the postfix
syntax, and this syntax was kept in SML as well as in Caml.

When teaching this, I use to crack a joke that this syntax reflects
the british and american roots of the designers of ML: English lets
you say "an integer reference" instead of "a reference to an integer",
while, say, French would only allow the latter word ordering ("une
référence entière" or "une référence vers un entier").

But this folk explanation doesn't really hold: while also designed by
brits and americans, Haskell uses the prefix syntax for type
operators...

- Xavier Leroy
-------------------
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


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

* Re: [Caml-list] Why are type functions postfix?
  2002-08-12 19:02 Tim Freeman
@ 2002-08-12 19:57 ` Vitaly Lugovsky
  2002-08-23  9:24 ` Xavier Leroy
  1 sibling, 0 replies; 6+ messages in thread
From: Vitaly Lugovsky @ 2002-08-12 19:57 UTC (permalink / raw)
  To: Tim Freeman; +Cc: caml-list

On Mon, 12 Aug 2002, Tim Freeman wrote:

> 
> In OCAML and other ML dialects I've used, you say:
> 
>    let x: int ref = ref 3
> 
> Is there any reason that type functions like the first "ref" are
> postfix, unlike function application like the second "ref" that is
> prefix?
> 
> If it's just history and there's no good reason, that's fine by me.
> I'm just curious.

 It's not a function at all - it's just a constraint.


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


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

* [Caml-list] Why are type functions postfix?
@ 2002-08-12 19:02 Tim Freeman
  2002-08-12 19:57 ` Vitaly Lugovsky
  2002-08-23  9:24 ` Xavier Leroy
  0 siblings, 2 replies; 6+ messages in thread
From: Tim Freeman @ 2002-08-12 19:02 UTC (permalink / raw)
  To: caml-list


In OCAML and other ML dialects I've used, you say:

   let x: int ref = ref 3

Is there any reason that type functions like the first "ref" are
postfix, unlike function application like the second "ref" that is
prefix?

If it's just history and there's no good reason, that's fine by me.
I'm just curious.
 
-- 
Tim Freeman       
tim@fungible.com
GPG public key fingerprint ECDF 46F8 3B80 BB9E 575D  7180 76DF FE00 34B1 5C78 
-------------------
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


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

end of thread, other threads:[~2002-08-23 13:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-13  0:49 [Caml-list] Why are type functions postfix? Arturo Borquez
  -- strict thread matches above, loose matches on Subject: below --
2002-08-12 19:02 Tim Freeman
2002-08-12 19:57 ` Vitaly Lugovsky
2002-08-23  9:24 ` Xavier Leroy
2002-08-23 12:38   ` Sven LUTHER
2002-08-23 13:58     ` Xavier Leroy

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