[Glass] Compiler interface ...

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Wed Nov 12 09:45:13 PST 2014


On Wed, Nov 12, 2014 at 4:27 AM, itlists at schrievkrom.de via Glass <
glass at lists.gemtalksystems.com> wrote:

> 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.
>

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
> arguments are references).
>

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.


> A hint, where I could look at ?
>
>
> Marten
> --
> Marten Feldtmann
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20141112/94ee3b90/attachment.html>


More information about the Glass mailing list