[squeak-dev] Pragmas (Re: The Inbox: Morphic-phite.429.mcz)

Andreas Raab andreas.raab at gmx.de
Mon Apr 26 19:05:41 UTC 2010


On 4/26/2010 11:48 AM, Eliot Miranda wrote:
> OK, so Pragma is bad; its historical from "primitive pragma".  But
> Annotation doesn't capture the potentially executable flavour of
> pragmas.  How about MethodMetaMessage?  (mmm, yum :) )  We could talk
> about meta-messages for short. "Add a meta-message that does ..." etc...

But "primitive pragma" is every bit as wrong. A pragma is something that 
gives the compiler information about the code without being code itself. 
Primitives are't pragmas, primitives are *code* (if you don't believe 
me, just remove all of them and see how that goes).

By definition, a "pragma" is an interface between the code and the 
compiler, something where the code conveys meta-information to the 
compiler. For example, this is a pragma (assuming the compiler 
understands it):

foo
	<inline: true>

bar
	<tailcut: true>

The first one might instruct the compiler to generate the code for this 
method inline, the second one to eliminate tail recursion.

None of these, however, are pragmas:

foo
	"Not a pragma since it's not for the compiler"
	<preference: 'Foo Preference'
	  ...
	>

apiGetWindowFocus
	"Not a pragma since it's code"
	<apicall: ulong 'GetWindowFocus' (void)>

etc. I should also add that before the introduction of the so-called 
"pragmas" there was only *code* used in the <> syntax (primitives and 
FFI calls) and the change to allow non-code entities is something that, 
although useful, still worries me because of the conceptual issues 
associated with mixing code and non-code entities. We wouldn't even have 
that discussion if <> just meant "code".

Cheers,
   - Andreas



More information about the Squeak-dev mailing list