Hi Max,On Thu, Apr 30, 2020 at 11:51 PM Max Leske <maxleske@gmail.com> wrote:Hi Sean,
You need an outer context. See Context>>cleanCopy, which Fuel uses to serialize blocks.
One does *not* need an outer context.�� An outer context of nil should be fine, provided that the block never attempts an up-arrow return.| blockMethod |blockMethod := [:a :b| a < b] method.(FullBlockClosure receiver: nil outerContext: nil method: blockMethod copiedValues: nil) value: 1 value: 2So one needs to use FullBlockClosure class>>receiver:outerContext:method:copiedValues: and one can supply nil for the outerContext provided that the block does not do an up-arrow return.��Cheers,
MaxOn 1 May 2020, at 3:23, Sean P. DeNigris wrote:
What am I not understanding about FullBlockClosure?
I have a clean block that I'd like to turn into a FullBlockClosure so that I
can serialize it without dragging (unneeded methods) into my object graph.
However, documentation and in-image example usages seem severely limited.
Here was one experiment that ended with a primitive failure. It seems like a
receiver is needed and it can't be a dummy value (see commented "receiver:
1"). But what would the receiver be in the absence of an outer context?!
aBlockClosure := [ :a :b | 1 + a + b ].
fbc := (FullBlockClosure
outerContext: nil
startpc: aBlockClosure startpc
numArgs: aBlockClosure argumentCount
copiedValues: Array new) "receiver: 1; yourself".
fbc value: 2 value: 3. "PrimitiveFailed: primitive #value:value: in
FullBlockClosure failed"
-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html--_,,,^..^,,,_best,��Eliot