def foo(arg1, arg2, arg3, arg4 = SOME_CONST) ... puts "arg4 is true" if arg4 puts "!arg4 is false" unless !arg4 # <---INTERMITTENTLY this line will not print when the line above and below prints! puts "!!arg4 is true" if !!arg4 ... end
ensureblock to the method in question (which adds a catch block, which turns off JIT) problem goes away.
blockas pure text, is it possible?
The idea is that every time i run the code it will reproduce sounds through the
web audio api:
# code that generates music # defining the the synth, effects with_instrument(synth: :piano, volume: 3) do # the cycle is the one in charged of defining the notes # being played cycle do # notes as numbers play 30, 40 end end
This is a custom DSL, so under the hood i use
instance_eval to evaluate the block in
with_instrument. Every time i execute the code for the instrument it will generate a bunch of
web audio api objects called
audio nodes that are really heavy for the browser, and can not be to destroyed completely after created, so i want to avoid creating them again if the code didn't changed.
Also, i think using
instance_eval might be causing me performance issues (i'm using eval for the all compiling all the code, and then
eval is used again in
My idea is to just store the code as text inside the
instrument object used by
with_instrument, and then somehow execute the code inside
instance_evalonly if the code is different.
Was looking at
BasicObject and seems that it retrieves the code inside the block as text as well, so i think i can create my own version of
Anyway if someone is interested in helping me, or has a better idea let me know :), this stuff is pretty difficult he