I would like to do the following:
[ :a :b :c | a + b + c ] How can I compile a string like "[ :a :b :c | a + b + c ]" in Gemstone as a compiled method and store it in the database. I would like to make sure, that the block closure is closed (only block arguments are references). A hint, where I could look at ? Marten -- Marten Feldtmann _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
On Wed, Nov 12, 2014 at 9:27 AM, [hidden email] via Glass <[hidden email]> wrote: I would like to do the following: '[ :a :b :c | a + b + c ]' evaluate That would give you a ExecBlock (closure), but not a CompiledMethod. But I don't understand why would you want a CompiledMethod rather than a closure... I would like to make sure, that the block closure is closed (only block I have been wondering this as well. For Fuel development, in Pharo, we added #isClean, which checked exactly what you said. I am not fully sure in GemStone. I found #isSimple but I am not sure. A hint, where I could look at ? I would check in ExecBlock hierarchy.
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
In reply to this post by GLASS mailing list
On Wed, Nov 12, 2014 at 4:27 AM, [hidden email] via Glass <[hidden email]> wrote: I would like to do the following: The following will produce a compiled method (GsNMethod instance): '[:a :b :c | a + b + c]' _compileInContext: nil symbolList: SymbolList new oldLitVars: nil environmentId: 0 and the following will produce an ExecBlock: ('[:a :b :c | a + b + c]' _compileInContext: nil symbolList: nil oldLitVars: nil environmentId: 0) _executeInContext: nil If you look at the args to _compileInContext:... you will see that no context, global varas or external variables are declared, so you'll get a compile error if there are any out of block scope references. I would like to make sure, that the block closure is closed (only block As Mariano mentions, #isSimple can be sent to a BlockClosure
and if it returns true, then the block has no external references and
is closed.
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
On Wed, Nov 12, 2014 at 9:45 AM, Dale Henrichs <[hidden email]> wrote:
nil can be used as an arg to symboList: so th eabove should have been: '[:a :b :c | a + b + c]' _compileInContext: nil symbolList: nil oldLitVars: nil environmentId: 0 Dale _______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
I forgot to mention that in GemStone it is a convention that methods beginning with a $_ are private methods and we reserve the right to change the interface and/or remove private methods at will ... in this particular area we are not likely to remove the functionality in future releases but we may tweak the argument list from time to time ... DaleOn Wed, Nov 12, 2014 at 9:47 AM, Dale Henrichs <[hidden email]> wrote:
_______________________________________________ Glass mailing list [hidden email] http://lists.gemtalksystems.com/mailman/listinfo/glass |
Free forum by Nabble | Edit this page |