Background - I’m tinkering with code reuse patterns, I started with some OO stuff but found limitations and advice that the team saw functional-esque programming a more likely supported paradigm. Ruby seems OK for such although I must admit - I’m neither a Ruby programmer nor a seasoned functional programmer. Needless to say I’m crossing the line of supported syntax here and there …
The issue I’m having is that I have been using
Procs and I call ‘parameters’ on the
Procs (to do some parameters currying). i.e.
myproc = Proc.new do | a:, b:, c: | do_stuff end f_that_raises = Proc.new do | method | myproc.parameters end f_that_raises(my_proc)
This works fine when its in one buffer. As soon as I try to call this code in another buffer the
Symbols and I get the following error
Error: [buffer 8, line 165] - NoMethodError Thread death! undefined method `parameters' for :myproc:Symbol
The same obviously happens if I use
define (I’m kinda presumeing define is a shorthand/synonym for Proc anyway … ?).
Is there a correct way to do this? Or a workaround?
Or …can someone illuminate this area - perhaps there’s even documentation about how variables/symbols work across buffers etc that I haven’t come across yet.