caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* (no subject)
@ 2002-10-16 14:07 climb
  2002-10-17  0:58 ` [Caml-list] Re: how to start Alessandro Baretta
  0 siblings, 1 reply; 2+ messages in thread
From: climb @ 2002-10-16 14:07 UTC (permalink / raw)
  To: caml-list

Dear caml-list
 
 i am a new commer of Caml language. and start with online mannul
 i am confused at this sentence in Chapter 1
# type idref={ mutable id : 'a. 'a -> 'a};;
what does "." mean?

why i can not write 
# type intidref= { mutable id : int. int->int};;

 

thanks
                         climb
                         onlyclimb@163.com
                         2002-10-16

 




-------------------
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] 2+ messages in thread

* [Caml-list] Re: how to start
  2002-10-16 14:07 climb
@ 2002-10-17  0:58 ` Alessandro Baretta
  0 siblings, 0 replies; 2+ messages in thread
From: Alessandro Baretta @ 2002-10-17  0:58 UTC (permalink / raw)
  To: climb; +Cc: caml-list



climb wrote:
> Dear caml-list
>  
>  i am a new commer of Caml language.

Welcome on board!

> and start with online mannul
>  i am confused at this sentence in Chapter 1
> # type idref={ mutable id : 'a. 'a -> 'a};;
> what does "." mean?

'a. 'a -> 'a

This is read as: "For every type 'a, a function from 'a to
'a". In this context 'a is a type variable. The type
variable preceding the "." are "universally quantified":
this is where the "For every type ..." comes into the game.

This basically states that the type of id is polymorphic: 'a
-> 'a  is a type schema as opposed to a specific type. Many
different types fit this schema:
int -> int
string -> string
(int -> int) -> (int -> int), and so on.

The type schema 'a. 'a -> 'a is entirely equivalent to the
axiom schema of propositional calculus A => A: "If A then
A." A stands for *any* proposition, not for any one specific
proposition.


> why i can not write 
> # type intidref= { mutable id : int. int->int};;

This does not make sense because "int" is a type value and
not a type variable.


Alex

-------------------
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] 2+ messages in thread

end of thread, other threads:[~2002-10-17  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-16 14:07 climb
2002-10-17  0:58 ` [Caml-list] Re: how to start Alessandro Baretta

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