error in tuple matching using variables
-
Jared Kuolt
Note that it works if you pass the actual tuple itself:
@@@$ 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]
module Retem .. def simple((~number, val)) .. val .. => ~ok Retem.simple((~number, 1)) => 1 v = (~number, 1)
=> (~number,1) Retem.simple(v) exception error: no function clause matching 'Retem':simple({number,1}) in function erl_eval:do_apply/5 in call from reia_erl:erl_funcall/3 in call from 'Eval':exprs/2 -
Jared Kuolt
Ugh. Stupid formatted. Let's try that again:
$ 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] >> module Retem .. def simple((~number, val)) .. val .. => ~ok >> Retem.simple((~number, 1)) => 1 >> v = (~number, 1) => (~number,1) >> Retem.simple(v) exception error: no function clause matching 'Retem':simple({number,1}) in function erl_eval:do_apply/5 in call from reia_erl:erl_funcall/3 in call from 'Eval':exprs/2 -
Philipp Pirozhkov
Yes, thanks! I've included this piece of code especially to show that it works fine if we are passing the value, not the variable. The second case shows the problem itself. Besides, ticket title speaks for itself.
-
Tony Arcieri
- State changed from new to resolved
This is a duplicate of #10 Tuples are broken when using Eval
-
Tony Arcieri
Note that this problem does not occur in compiled expressions:
>> module Foo .. def bar .. val = (~number, 3) .. baz(val) .. def baz((~number, val)) .. val .. => ~ok >> Foo.bar() => 3It only occurs when the expressions are evaluated because the tuple value bound to the variable is being clobbered.
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.