[squeak-dev] pragmas usage

Lukas Renggli renggli at gmail.com
Sun Mar 16 09:36:58 UTC 2008


> I am looking for some good examples of using pragmas to learn how to use
>  them well. Found some good ones in Ramon's code, but few others in the 3.9
>  image. Looking for some more. Any pointers appreciated.

<primitive:> and <primitive:module:> are (a bit special) examples and
they come with every image. If the Compiler/Parser encounters such
pragmas in the source code it dispatches the pragma to the Parser
class to create a primitive method.

In short the strategy is like this:

- You query for some Pragma using the class-side protocol of the Pragma class.

- You iterate over these objects and dispatch them to some
handler/interpreter object.

    aCollectionOfPragma do: [ :each | each message sendTo: handler ]

HTH,
Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch



More information about the Squeak-dev mailing list