On 29-mar-10, at 16:57, so wrote:
The example you give cannot be solved easily and efficiently (find
the type to use in a function) without some kind of inference based
on the return type, annotations, or Hindley Milner style type
inference.
annotation don't scale, using inference based on the return type is
very difficult and not doable in general, few languages do it
(aldor for example did it), Hindley Milner is incompatible with C.
Please note that (possibly due to my C background) I like to put
some type annotations, in my (limited) experience that pays off
also with ML style languages, otherwise when you have ambiguity
small errors can change the called functions and give surprising
results.
Fawzi
Finally i am able to explain it with 2 words, Hindley Milner :)
I want credit too! i also found it independently!
ehm actually Hindley Milner is not enough for what you requested, it
can find types of functions, but integers are still separated from
floats.
It can't cope well with incompatible overloads or conversions (they
have type a->b)...
what you want is really return type based inference something that is
hard, as said as far as I know only aldor did that
Thanks for the explanation, i don't really like non-system, non-
generic languages, non-D like languages.
Especially when a language has dumb reasons for not providing an
utility. (Java operator overloading case)
D is the best choice for me by miles and i can learn to live with
casts as i did in C++.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/