Fear and loathing of the "perlification" of Smalltalk
nicolas cellier
ncellier at ifrance.com
Wed Sep 5 20:58:27 UTC 2007
Jason Johnson a écrit :
> To be honest I think pragmas are starting to be overrated. I don't
> even know where to look to see what happens when a pragma is seen. I
> suppose it is theoretically as powerful in this particular case as
> macros, but for me the macros feel much more consistent.
>
> I would see pragmas as useful for the kind of things that Lisp does
> with declare, i.e. telling the compiler the type of the argument so it
> can specialize the method, tell the compiler to generate for fast
> code, not safety, and so on. In other words, a kind of annotation,
> since that's what it looks like to me.
>
Yes, pragmas are mostly used like annotations: they give "properties" to
the methods...
It's a step toward what Alan said of methods becoming richer objects
with reacher properties.
It does it the declarative way, rather than through an IDE, which is IMO
more explicit than syntax highlighting conventions, at the expense of
verbosity (an IDE could hide it).
It could of course be used to introduce some reflexivity on thisCompiler
which is compiling thisCode, making it closer to what other languages
call a pragma. This could be experimented to play with alternate
syntaxes like Andreas suggested, playing at a higher level with gramar
rules.
I like the idea of the language being more contextual. Mathematical
language concision come from such feature. Put in another context, a
mathematical expression meaning can change.
Another simple example, Tim, a #<private> could for example generate
code checking thisContext sender hierarchy at runtime and generate an
exception when due. A polymorphic inlining optimizer could of course
know when to strip such un-necessary checks, hence the advantage of the
pragma versus a simple self checkPrivateSend...
Sure this pragma/annotation feature has not expressed all its power by now.
More information about the Squeak-dev
mailing list
|