The following code (which has been copied from here) fails in
maglev 1.1RC1 (ruby 1.8.7) (2012-12-06 rev 1.1RC1-29699)[Darwin x86_64]
class Array
def pair_sums
self.enum_for(:each_slice, 2).map do |a, b|
a + b
end
end
end
as to be expected you can enter it in rib but if you call the method as in
[3,2,1,4,6,5,7,8].pair_sums
it will fail miserably, as it sooms unable to pass the additional arg to :each_slice. Ruby-Stacktrace is
irb(main):008:0> [3,2,1,4,6,5,7,8].pair_sums
ArgumentError: too few arguments
from (irb):4:in `pair_sums'
from (irb):9:in `__compileEval'
from (irb):11:in `__compileEval'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/src/kernel/bootstrap/Kernel.rb:402:in `eval'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:159:in `eval_input'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:162:in `eval_input'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:280:in `signal_status'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:281:in `signal_status'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:156:in `eval_input'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:155:in `eval_input'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:71:in `start'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:70:in `start'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/lib/ruby/1.8/irb.rb:73:in `start'
from /Users/patru/.rbenv/versions/maglev-1.1.0-dev/bin/irb:30
I tried to generate a Stacktrace as you recommend, but I think I failed, see for yourselves:
topaz> set gemstone maglev
topaz> login
[Info]: LNK client/gem GCI levels = 851/851
[Info]: libssl-3.1.0.2-64.dylib: loaded
[Info]: User ID: DataCurator
[Info]: Repository: maglev
[Info]: Session ID: 5
[Info]: GCI Client Host: <Linked>
[Info]: Page server PID: -1
[Info]: Login Time: 08/15/13 14:27:56.008 CEST
[Info]: libicudata-3.1.0.2-64.dylib: loaded
[Info]: libicuuc-3.1.0.2-64.dylib: loaded
[Info]: libicui18n-3.1.0.2-64.dylib: loaded
[08/15/13 14:27:56.012 CEST]
gci login: currSession 1 rpc gem processId -1 OOB keep-alive interval -1
successful login
topaz 1> run
|ctx|
SessionTemps current at:#Maglev_ruby_debugFlag put: true .
System currentSegment: nil .
ctx := RubyContext load: #( ) .
"note you cannot debug Ruby MNU here"
" Exception installDebugBlock: [:ex|
(ex isKindOf:NameError) ifTrue:[ nil pause ].
]. "
ctx runFileNamed: '/tmp/ruby.35tK' withRubyArgs: { }
withScriptArgs: { } .
GsFile stdout close . "ensure final LF on stdout"
^ nil
%
error , a ArgumentError occurred (error 2718), too few arguments,
during /tmp/ruby.35tK
ERROR 2718 , a ArgumentError occurred (error 2718), too few arguments (ArgumentError)
topaz 1> exitifnoerror
End of initialization files
topaz 1>
[Info]: Logging out at 08/15/13 14:27:56 CEST
It works without a problem in system-ruby (1.8.7) on my mac or also in 1.9.3.
I can work around it by always passing a block directly, but of course you miss quite some features of Enumerable this way.
The following code (which has been copied from here) fails in
as to be expected you can enter it in rib but if you call the method as in
it will fail miserably, as it sooms unable to pass the additional arg to :each_slice. Ruby-Stacktrace is
I tried to generate a Stacktrace as you recommend, but I think I failed, see for yourselves:
It works without a problem in system-ruby (1.8.7) on my mac or also in 1.9.3.
I can work around it by always passing a block directly, but of course you miss quite some features of Enumerable this way.