[squeak-dev] Re: Pragma support in Squeak/Pharo/Cuis

Igor Stasenko siguctua at gmail.com
Fri Jan 28 19:38:37 UTC 2011


On 28 January 2011 15:21, Andreas Raab <andreas.raab at gmx.de> wrote:
> On 1/28/2011 2:07 PM, Igor Stasenko wrote:
>>
>> On 28 January 2011 13:59, Juan Vuletich<juan at jvuletich.org>  wrote:
>>>
>>> You mean "method annotations" right? ('Pragma' has a completely different
>>> meaning in the language / compilers that use them, and is a very bad name
>>> for this).
>>>
>> Is this sarcasm? yeah?
>> This naming used for years, and now it became not simple bad, but
>> _very_ bad name :)
>
> Hardly. Juan is absolutely right that a pragma is a _very_ bad name,
> something very specific, namely an instruction to the compiler to do
> something.

Anything which included in source code is "an instruction to the
compiler to do something", otherwise there is no reason and no sense
of putting it there.
The difference lies in the who and what exactly "something" it should do.
Since pragmas and annotations having same context and same syntax ,
except that they differ
in "do something" part, there is not much difference in reality,
especially if you take into account a reflective nature
of smalltalk system, where tools can observe the various properties of
objects (such as compiled methods) and
decide what to do based of their behavior/state/whatever.

So, even if <something> doesn't looks like a pragma (an instruction)
for you or your compiler,
it could mean a lot for other tools. Does that makes it to be less
'pragmatic' just because its not instruction to compiler but to
some other  tool? I don't think so.
The <wikiStyleHelp: 'My Book'>  is a help system pragma and don't try
to convince me otherwise.

> Therefore, all pragmas are annotations but not all annotations
> are pragmas. For example <primitive: 123> is a pragma (it instructs the
> compiler to generate a primitive) but <hello: 'world'> is not.
>
and, if at some moment in future it will change compiler to react on <hello:>,
then it magically turn to be the pragma? So, why i can't call it like
that right now?
Because of bad name? :)

>>> Cuis doesn't currently support method annotations.
>>>
>>
>> huh... how then you specifying a primitive(s) in method? and FFI?
>> or in same way you can say.. yeah this is not pragma , its a primitive..
>> but it doesn't makes any difference.
>
> It does. Juan is exactly right, Cuis supports pragmas (<primitive:> or FFI
> calls) but not annotations.
>
>> You may call it  'a method's meta-data' or any other way you like it,
>> i _dont_ care!
>> As long as the idea behind is will remain same.
>
> But the idea _isn't_ the same. The idea of pragmas is to instruct the
> compiler to do something specific. The idea of method annotations is to
> provide additional information in methods that isn't executable.
>

No. The idea behind it the same. Instruct some tool to do something
once it detects the pragma.
Take Cog VMMaker for instance.
Its generator using <api> pragmas for determining if method represents
a public function, which should be
publicly declared. And you probably know that there are many other
pragmas used in code generation.
Your problem is that you narrowing the 'pragma' functionality to one
tool - compiler. While i see that it is used by many many different
tools.
So, why calling it pragma when applied to compiler, but annotation
when applied to other tools? Don't makes much sense as to me.

In contrast, Annotations (or tags) are not instructing any tools to
behave differently. Pragmas do. And therefore annotations - (minus)
pragmas
are worthless, because then the only purpose of annotations would be
to be found by human who will wonder "why this method having this
<foo> thing??..
This concept doesn't sounds like pragmatic and don't having any
practical purpose, unless you write some tool which makes use of your
'annotations',
but then these annotations are immediately turned into pragmas,
because they turned to be some kind of instruction for you tool to do
something.

So, annotations is worthless thing for computing, because it makes
difference only to people, not to behavior of our tools because tools
use pragmas. :)


> In other words: Pragmas are "understood" by the compiler, method annotations
> are not.
>
> Cheers,
>  - Andreas
>


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list