[nem-en] unused untyped local functions
Michal Moskal
michal.moskal at gmail.com
Fri Feb 23 11:57:19 CET 2007
On 2/23/07, Dmitry Ivankov <divanorama at gmail.com> wrote:
> When typing should fail on unused functions, and why?
>
> These functions are just reported as unused
> def f(x) {x}
> def f(x) {x + 1}
>
> And if these are unused we get "error, typing fails"
> def f(x) { x.member} //on accessing member
> def f(x) {x + x} //on operator
>
> The most interesting is (x + 1) vs (x + x), because they are almost the same
The (more or less) full explanation is given in
http://nemerle.org/Type_inference
The sort answer is that because 1 is an int, the compiler assumes x to
be also an int, but it cannot know if x in x+x is an int or say a
string.
--
Michał
More information about the devel-en
mailing list