Issue #14148 has been updated by shevegen (Robert A. Heiler).


Actually, I think there may also be a bug ... I can not yet pinpoint
what causes it and I have to soon go to get some sleep, but switching
between ruby version triggers a NameError:


ruby 2.5.0dev (2017-11-30 trunk 60945) [x86_64-linux]

    atomic_composition.rb:48:in `atomic_composition': uninitialized constant Bioroebe::Constants::FILE_AMINOACIDS_MOLECULAR_FORMULA (NameError)

The line in question is:

    dataset_molecular_formula_for_the_aminoacids = YAML.load_file(
      ::Bioroebe::Constants::FILE_AMINOACIDS_MOLECULAR_FORMULA
    )

(I am just loading a yaml file... the above is a bit verbose but
it definitely works on ruby 2.4.x)

It works when I remove the '::Bioroebe::' part, but running it
with ruby 2.5.x, I run into another error lateron


Traceback (most recent call last):
        4: from atomic_composition.rb:111:in `<main>'
        3: from atomic_composition.rb:70:in `atomic_composition'
        2: from atomic_composition.rb:70:in `with_index'
        1: from atomic_composition.rb:70:in `map'
atomic_composition.rb:82:in `block in atomic_composition': undefined method `remove_this_molecule_from' for ChemistryParadise:Module (NoMethodError)

With the line being:

  ::ChemistryParadise.remove_this_molecule_from('OH', formula_for_this_amino_acid)

So I assume it is the leading '::'.

I am not 100% positive, perhaps it is a feature rather than a bug, but I am absolutely
sure that something between 2.4.2 and 2.5.0 changed there, leading to code that does
not yet work (for me) on 2.5.0.

----------------------------------------
Bug #14148: Longstanding behavior regarding correspondence of toplevel with Object is surprising
https://bugs.ruby-lang.org/issues/14148#change-68158

* Author: RickHull (Rick Hull)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
~~~ ruby
module Kernel
  X = 1
end

puts String::X

X = 2

puts String::X
~~~

~~~
$ ruby test.rb
1
Traceback (most recent call last):
test.rb:9:in `<main>': uninitialized constant String::X (NameError)
Did you mean?  X

$ ruby --version
ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>