Tuples are broken when using Eval
Reported by Jared Kuolt | December 9th, 2008 @ 01:16 PM
Tuples aren't always responding to their pseudo-methods, yet they're not always failing, either. When assigning a local var as a tuple and calling a method like .size, it results in an error (unknown_receiver). However, performing the same series of steps in a fun works:
$ bin/ire Reia Interactive Shell (prerelease) Running on Erlang (BEAM) emulator version 5.6.3 [source] [64-bit] [smp:4] [async-threads:0] [kernel-poll:true] >> (1,2,3).size() => 3 >> a = (1,2,3) => (1,2,3) >> a.size() exception throw: {error,unknown_receiver,{1,2,3}} in function reia_dispatch:funcall/3 in call from reia_erl:erl_funcall/3 in call from 'Eval':exprs/2 >> size(a) => 3 >> a = fun do .. (1,2,3).size() .. => # >> a() => 3 >> a = fun do .. b = (1,2,3) .. b.size() .. => # >> a() => 3 >> b = (1,2,3) => (1,2,3) >> b.size() exception throw: {error,unknown_receiver,{1,2,3}} in function reia_dispatch:funcall/3 in call from reia_erl:erl_funcall/3 in call from 'Eval':exprs/2 >> b = [1,2,3] => [1,2,3] >> b.size() => 3
Comments and changes to this ticket
-
Tony Arcieri December 10th, 2008 @ 01:53 PM
- State changed from new to open
This is a bug in Reia's Eval implementation. Fixes for it are non-trivial.
-
Tony Arcieri December 12th, 2008 @ 03:02 PM
- State changed from open to resolved
I've added a small shim around erl_eval which should handle correctly translating the bindings to the appropriate format.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Reia a dynamic scripting language for the Erlang virtual machine (BEAM)
People watching this ticket
Referenced by
- 11 error in tuple matching using variables This is a duplicate of #10 Tuples are broken when using ...
- 2 list comprehensions doesn't understand variables as arguments This is a dupe of #10 since the compiled version works fine.