Syntactical extensions vs. pragmas everywhere

Andreas Raab andreas.raab at gmx.de
Sat Aug 19 20:39:44 UTC 2006


stéphane ducasse wrote:
>>> I think that point 1) alone illustrates quite clearly why syntactical
>>> extensions like the FFI should be treated as what they are: Syntactical
>>> extensions. If text cannot be interpreted correctly by the compiler
>>> (because for example there is support code missing which makes the text
>>> intelligible) it should not be accepted. Everything else is a recipe for
>>> confusion and disaster. This not only holds for the FFI but for *any*
>>> kind of non-optional, code-generating (or -affecting) syntactical 
>>> extension.
> 
> But why? seriously I do not understand why overloading  of <...> is a 
> problems. Why the compiler cannot query <primitive: > and do something
 > specific with it and query <ffi: module:> and do something else and not
 > query <myOwnPragmas:...>
> 
> I would really like to know.

Sigh. That's what my first point was all about. Once more: Assuming an 
extension like the FFI (or Sql) how would -without the FFI or Sql 
support loaded- the compiler even know that <cdecl: 'void puts(char*)'> 
has *meaning*? I.e., that it is not a pragma but that it needs to be 
interpreted by some support code that isn't even present?

You, yourself were running into this problem. You didn't have the FFI 
loaded. You tried to put in an FFI spec. (Fortunately) It didn't work 
and raised your attention and let you to ask what is happening. Now 
consider the situation that we would have used pragma syntax and that 
the compiler would have silently accepted that "pragma". It wouldn't 
have *looked* right but not *worked* right. But if you would've asked 
even I would have no way of telling why "puts() doesn't work on your 
machine".

Cheers,
   - Andreas



More information about the Squeak-dev mailing list