boris-s / y_petri

Domain model of functional Petri nets.
borisstitnicky.com
GNU General Public License v3.0
12 stars 1 forks source link

Can not run advanced sample from the read me #1

Open OlegJakushkin opened 9 years ago

OlegJakushkin commented 9 years ago

Installed a gem. Can not run advanced sample from the read me:

>> require 'y_petri'
include YPetri
A = Place default_marking: 0.5
B = Place default_marking: 0.5
A_pump = Transition s: { A: -1 }, rate: proc { 0.005 }
B_decay = Transition s: { B: -1 }, rate: 0.05
net
require 'y_petri'
C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/net/state/feature/assignment.rb:68: warning: circular argument reference - transition
C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation.rb:210: warning: circular argument reference - marking
C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation.rb:210: warning: circular argument reference - recording
C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation/timed.rb:193: warning: circular argument reference - time
=> true
include YPetri
=> Object
A = Place default_marking: 0.5
=> A
B = Place default_marking: 0.5
=> B
A_pump = Transition s: { A: -1 }, rate: proc { 0.005 }
NameError: uninitialized constant YPetri::Transition::Type_T
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/transition.rb:167:in `initialize'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_support-2.1.18/lib/y_support/name_magic/class_methods.rb:179:in `new'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_support-2.1.18/lib/y_support/name_magic/class_methods.rb:179:in `new'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/agent/petri_net_aspect.rb:76:in `Transition'
    from C:in `Transition'
    from (irb):5
    from C:/Ruby22/bin/irb:11:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
B_decay = Transition s: { B: -1 }, rate: 0.05
NameError: uninitialized constant YPetri::Transition::Type_T
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/transition.rb:167:in `initialize'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_support-2.1.18/lib/y_support/name_magic/class_methods.rb:179:in `new'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_support-2.1.18/lib/y_support/name_magic/class_methods.rb:179:in `new'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/agent/petri_net_aspect.rb:76:in `Transition'
    from C:in `Transition'
    from (irb):6
    from C:/Ruby22/bin/irb:11:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
net
=> #<Net: name: Top, 2 places, 0 transitions>
>> run!
NameError: uninitialized constant YPetri::Simulation::Transitions::Types::Type_tS
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation/transitions/types.rb:62:in `block (2 levels) in tS'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation/transitions/types.rb:62:in `class_exec'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation/transitions/types.rb:62:in `block in tS'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation/transitions/types.rb:61:in `tap'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation/transitions/types.rb:61:in `tS'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/simulation.rb:175:in `initialize'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/net.rb:167:in `new'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/net.rb:167:in `simulation'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/world/simulation_aspect.rb:347:in `new_simulation'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/agent/simulation_aspect.rb:242:in `new_simulation'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/agent/simulation_aspect.rb:251:in `run!'
    from C:in `run!'
    from (irb):8
    from C:/Ruby22/bin/irb:11:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
>> simulation
=> nil
>> simulation.settings
NoMethodError: undefined method `settings' for nil:NilClass
    from (irb):10
    from C:/Ruby22/bin/irb:11:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
>> print_recording
SystemStackError: stack level too deep
    from C:in `rescue in recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
... 7665 levels...
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:in `recording'
    from C:/Ruby22/lib/ruby/gems/2.2.0/gems/y_petri-2.3.12/lib/y_petri/agent/simulation_aspect.rb:258:in `print_recording'
    from C:in `print_recording'
    from (irb):11
    from C:/Ruby22/bin/irb:11:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'>> 
boris-s commented 8 years ago

In the Ruby core team, they made an illogical modification that breaks my code in Ruby 2.2+ My code runs fine on Ruby 2.1.x. Of course, it's me who has to adapt to them. Due to certain reasons I missed the discussion of Ruby core team. I promise I'll fix YPetri to run with Ruby 2.2+ soon.