Browse thread
let int = ?([' ' '\t'] '-') digits+
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Stefan Monnier <monnier@i...> |
| Subject: | Re: let int = ?([' ' '\t'] '-') digits+ |
> 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