Re: Funs with duplicate names

Anthony Ramine <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
That's damn horrible. The bug probably occurs in v3_core given that recursive funs which don't recursive are compiled to plain old functions.

As an aside, I am more and more of the opinion that compilers should proven correct, not tested.

-- 
Anthony Ramine

> Le 26 sept. 2014 à 11:26, Mikael Pettersson <[email protected]> a écrit :
> 
> Sam Chapin writes:
>> I'm new to the list, apologies if this is known. Discovered while working
>> in OTP 17.1, and it's still present after updating to 17.3.
>> 
>> Create a module containing the following:
>> 
>> f1() -> fun F() -> "f1" end().
>> 
>> f2() -> fun F() -> "f2" end().
>> 
>> Load it and execute f2(). On my system, its return value is "f1".
> 
> I didn't know about this.  Confirmed on my Linux/x86_64 system:
> 
>> cat bug.erl
> -module(bug).
> -compile(export_all).
> f1() -> fun _F() -> "f1" end.
> f2() -> fun _F() -> "f2" end.
>> bin/erl
> Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
> 
> Eshell V6.2  (abort with ^G)
> 1> c(bug).
> {ok,bug}
> 2> (bug:f2())().
> "f1"
> 3> 
> 
> R16 and R15 can't compile the code.
> _______________________________________________
> erlang-bugs mailing list
> [email protected]
> http://erlang.org/mailman/listinfo/erlang-bugs
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.