Closed pbosetti closed 10 years ago
I don't reproduce it.
my_build_config.rb (MRUBY_CONFIG=my_build_config.rb)
conf.gem :github => 'mattn/mruby-require', :branch => 'master'
conf.gem :github => 'mattn/mruby-pjson', :branch => 'master'
$ bin/mirb
mirb - Embeddable Interactive Ruby Shell
> PJSON
(mirb):1: uninitialized constant PJSON (NameError)
> require 'mruby-pjson'
=> true
> PJSON
=> PJSON
> PJSON.parse('{}')
=> {}
>
That's correct. It works with other mrbgems. But if you create a file
class Test
# whatever here
end
then
$ bin/mirb
> require './test.rb'
=> true
> Test
(mirb):1: uninitialized constant Test (NameError)
>
I am building the latest mruby master with your mruby-require master on OS X 10.9 with clang, but it also applies on Windows/VS2010. Still had not time enough for testing on Debian, though.
I forgot to say: if the test.rb
is like that
class Test
# whatever here
end
puts "Hello there!"
you get the nice greetings on stdout. So it must be something related to scoping.
Ah, rb file. Ok, I'll look into it later
@pbosetti Maybe fixed.
Til now it seems to work here too. Thanks, @mattn and @matz -P.
This must have something to do with changes in
mrb_load_irep_cxt()
, but I can't help in spotting the solution...