[squeak-dev] The Inbox: Compiler-mt.436.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri Jun 12 15:30:16 UTC 2020


Hi Subbu.

> Why should the parser treat primitive keywords differently from other
> keywords? Why not let primitives also be handled like any other pragma
> and have the handler return a flag to let the parser treat the pragma as
> a primitive/nonprimitive?


>From this point in #primitive, you can emit whatever you like while parsing the pragma that started with <primitive...>. If you parse <primitive: 42> as <primitive: 'prim42' module: 'primitivePlugin'>, then the callback will go to #primitive:module:. :-)

> It will allow us to switch primitive tables at run time without recompiling the VM.


That's unrelated. You can point to another primitive just by recompiling methods. No need to recompile the VM. ;-)

Best,
Marcel
Am 12.06.2020 13:23:05 schrieb K K Subbu <kksubbu.ml at gmail.com>:
On 12/06/20 7:44 am, commits at source.squeak.org wrote:
> + ----- Method: Parser>>primitive (in category 'primitives') -----
> + primitive
> + "Pragmas that encode primitive calls are parsed as normal keyword pragmas. This hook exists so that packages do not break primitive-pragma parsing by accident. Instead, this method needs to be replaced intentionally.
> +
> + Note that primitive pragmas are special because they will be called back from the parser into the parser. See #pragmaPrimitives.
> +
> + Examples:
> +
> +
> + "
> +
> +
Marcel,

Why should the parser treat primitive keywords differently from other
keywords? Why not let primitives also be handled like any other pragma
and have the handler return a flag to let the parser treat the pragma as
a primitive/nonprimitive?

It just occurred to me (strawman alert!) that the parser could parse

as


It will allow us to switch primitive tables at run time without
recompiling the VM.

Regards .. Subbu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200612/d78fbfb9/attachment.html>


More information about the Squeak-dev mailing list