In an attempt to
understand the system a bit better, I found this:
Interval>>at:put:
at: anInteger put:
anObject
"Provide an error notification that storing into an Interval is not allowed. " self error:
(#errStoreInterval << #dialogs >> 'you can not store into an
interval')
I would have
expected to see:
self
shouldNotImplement
just like I see in
the 'add:' method.
This led me to the
Pragma documentation, which totally hurt my brain. Is there an idiot-proof
explanation of pragmas somewhere? Are these specific to VW
only?
Daniel
Klein
|
Yes, they are specific to VisualWorks, although I can't see how you went
from this method to pragmas specifically. If you are referring to << >> these are actual message sends used to create UserMessages. Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 http://tinyurl.com/r7uw4 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. > -----Original Message----- > From: Daniel Klein [mailto:[hidden email]] > Sent: Wednesday, July 11, 2007 12:11 PM > To: [hidden email] > Subject: Pragmas > > In an attempt to understand the system a bit better, I found this: > > Interval>>at:put: > at: anInteger put: anObject > "Provide an error notification that storing into an Interval is not > allowed. " > > self error: (#errStoreInterval << #dialogs >> 'you can not store into > interval') > > > I would have expected to see: > > self shouldNotImplement > > just like I see in the 'add:' method. > > This led me to the Pragma documentation, which totally hurt my brain. > there an idiot-proof explanation of pragmas somewhere? Are these specific > to VW only? > > Daniel Klein |
In reply to this post by Daniel Klein-4
On Jul 11, 2007, at 12:11, Daniel Klein wrote:
As someone else has pointed out, the << token is a message. You can browse implementors of either << or >>. Both are binary messages. This is probably what you were interested in chasing down.
Pragma is a somewhat "loose" description of the method artifacts that show up in expressions like <primitive: 472>. See http://en.wikipedia.org/wiki/Compiler_directive. "Pragmas" are nothing more than a syntax for adding meta data to a method (thus, I usually refer to them as method tags). They were exclusive to VW for a while, but I understand there is a Squeak version now as well. The syntax is that 0 or more can show up after the method signature, but before any temporaries are declared or normal code statements begin. They are denoted by enclosing <>'s. There syntax is the same as Smalltalk message syntax. You can have a unary method tag, or keyword ones. Keyword ones may have Smalltalk literals as arguments. No other arguments, other than those that can be declared literally at compile time (e.g. numbers, strings, literal arrays, bytearrays, characters, symbols, binding references), are allowed. Only in the case of the "primitive" tag, does the Compiler actually use the method tag as a compiler pre-directive, emitting the proper bytecodes to invoke a primitive, thus qualifying it in the normal sense as a "pragma." And the primitive tag predates the actual implementation of the generic pragma. Aside from that, what method tags are handy for is attaching additional meta data to a method, which the system uses at later points in time to render services. They can be used to identify a subset of an object's methods as part of an arbitrary service. They can be used to filter selection. An object is sent instanceMethodsChanged/classMethodsChanged when a method with a tag is added or removed from the system. So the object can be set up to react in interesting ways to addition or removal of these methods. For example, some objects note when methods which are tagged as providing menu information are added or removed, and update their menus accordingly. -- Travis Griggs Objologist "You A students, you'll be back soon teaching here with me. You B students, you'll actually go on to be real engineers. You C students, you'll go into management and tell the A and B students what to do." - My Fluid Dynamics Professor whom I have yet to disprove |
Free forum by Nabble | Edit this page |