Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Calling a function with a self-defined type as argument
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi VANICAT <vanicat@l...>
Subject: Re: [Caml-list] Calling a function with a self-defined type as argument
Oliver Bandel <oliver@first.in-berlin.de> writes:

> On 22 Aug 2002, Dimitri Ara wrote:
>
>> Thus f x (y) means f x y and
>>      `x Line ("")' means `x Line ""'.
>
> OK.
> But why has the Line()-argument not a higher pruiority than the
> function-call?
> The Line()-argument is only complete, if it get's it's
> args. And the type-declaration says in detail, how to
> handle the Line().

Well, imagine that the compiler do what you want, and imagine that you
have to read a code coding from someone using strange name.

then when you read a code like :

x Azerty ""

you won't know if it is 
x (Azerty "")
or 
(x Azerty) ""
without reading the declaration of Azerty.

Thanks to the way the language (and compiler) actually work, I can say
that it is the first solution, even if I don't know what is this
Azerty constructor.

-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
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