problem in porting from smalltalk

Lukas Renggli renggli at gmail.com
Thu Feb 23 21:42:30 UTC 2006


> I'm not convinced.  Pragmas are at best a kludge.
>
> I liked the early gcc response to #pragma.  The spec stated that a
> compiler could do whatever it wanted when it saw a #pragma, so gcc tried
> to run a variety of games and threw a segmentation fault if it failed to
> find any of them.

The pragmas in 3.9 are not there to tweak the code generator. After
parsing they are put into the compiled method, so that the system can
query tagged methods. It has absolutely nothing to do with the
#pragma, except that is shared its name.

The Smalltalk pragmas are a key element to write extensible software.
Right now a lot of extension problems can only be solved trough the
use of strange naming conventions, such as that test-methods in SUnit
have to start with #test, or that meta-descriptions in Magritte have
to start with #description, etc. Moreover there is no clean way to
tell the system that a specific method is used as an event-handler, or
that a method explicitly fails an SLint rule, or that it returns a
string of a specific mime-type, etc. Pragmas are a slick solution to a
permanent problem that cannot be easily solved otherwise.

Lukas


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



More information about the Squeak-dev mailing list