Version française
Home     About     Download     Resources     Contact us    
Browse thread
let int = ?([' ' '\t'] '-') digits+
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Robert C Fischer <robert@f...>
Subject: Re: [Caml-list] Re: let int = ?([' ' '\t'] '-') digits+
Syntax polymorphism violates the principle of least surprise.  It is, 
indeed, Teh Eevil.

~~ Robert.

Stefan Monnier wrote:
>> Is this a good idea?
>>     
>
> Don't think so: it doesn't help the case where you want to use negation on
> a variable rather than a constant, so it introduces a fairly
> subtle inconsistency which doesn't seem to be worth the trouble.
>
> I guess in Haskell you could use type class trickery so that
>
>   "f - 3" substracts 3 from f if f is numeric and passes -3 to f if f is
>   a function (I leave the case where f is both a function and a member of
>   the Number class as an exercise to the user).
>
> that would be even more evil,
>
>
>         Stefan
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>