Module: Conscience
- Defined in:
- lib/y_support/conscience.rb
Overview
FIXME: Now, here, in order for the token game to work properly with guarding system, several things have to be done. Firstly, Place#set_marking( marking, blame ) will have to be implemented, and in Place#add, blame argument will have to be added Now with that blame, the transition will have to explain what it is trying to do. So actually it should be a block
It’s gonna be a mixin, Conscience, or something like that, and it will imbue the receiving class with the ability to try something.
Transition.try “to fire!” do
if assignment_action? then
note has: "assignment action"
note "Δt", is: Δt
note "domain marking" is: domain_marking
act = note "Action" do Array action( Δt ) end
codomain.each_with_index do |place, i|
try "set the marking of place #{place} to the #{i}-th element of the action vector (#{act[i]})" do
place.marking = act[i]
end
end
else
etc. etc. etc.
end
Should produce error messages like this: When trying to fire! the transition #self, having assignment action, with Δt being #Δt, action has been computed to #action(Δt), when trying to set the marking of plac #place to the #i-th element of the action vector (#i), GuardError was encountered, with the message: …“
Yes, this is a managed code miniframework that I need here.
Defined Under Namespace
Classes: Try
Instance Method Summary collapse
-
#try(object = self, to_do_something, &block) ⇒ Object
Try method taxes two textual arguments and one block.
Instance Method Details
#try(object = self, to_do_something, &block) ⇒ Object
Try method taxes two textual arguments and one block. The first (optional) textual argument describes what is the receiver of #try. The second argument describes in plain speech what activity is #try attempting. The block that follows then contains the code, which performs that activity. In the block, #note method is available, that builds up the context for the error message, if any.
129 130 131 |
# File 'lib/y_support/conscience.rb', line 129 def try object=self, to_do_something, &block Try.new( object: object, text: to_do_something, &block ).call end |