Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Tuples are broken when using Eval

#10

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

Reported by Jared Kuolt · December 9th, 2008 @ 01:16 PM

State: resolved
Milestone: none
Assigned to: Tony Arcieri Tony Arcieri

Activity

  1. Tony Arcieri
    Tony Arcieri
    • State changed from new to open

    This is a bug in Reia's Eval implementation. Fixes for it are non-trivial.

    December 10th, 2008 @ 01:53 PM

  2. Tony Arcieri
    Tony Arcieri
    • 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.

    December 12th, 2008 @ 03:02 PM

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.