|
|
Choosing A Webhost: |
Re: FFI, pragma and co...: msg#00189lang.smalltalk.squeak.beginners
cdrick wrote:
Pragmas are annotations for your methods. This annotations allows the developer to categorize its methods. For exemple, Lukas uses naming conventions to retrieve "description" methods (in fact, you can now use pragmas but forget that otherwise my explanation is useless :-)). The selector has to start with #description to be a description selector: Symbol>>isDescriptionSelector "Answer wheter the receiver is a method selector following the naming conventions of a description selector." ^ self ~= #description and: [ self beginsWith: #description ] This is a solution. But sometime, you would like to start a method with 'description' and this should not be a description method (or you do it by mistake). Pragmas can be used to solve this problem. You then will annotate your method to tell the system that this methods are description methods. You do it like this: MyObject class>>firstName <description> ^ MAStringDescription auto: 'firstName' label: 'First name' Then, when you want to collect all the description methods in a class, you will use the methods in the protocol 'finding' of the Pragma class (class side). Pragma allNamed: #description in: yourObject class This returns a collection of Pragmas (compiled methods, selector and class) in which the pragma #description has been used in the class of yourObject. You can use pragmas with arguments too like in: <selector: #something inClass: 'a class name'> only literals are allowed as arguments. With this, you can find all methods using the pragma #selector:inClass: and you can do whatever you want with the argument values. Writing this, I noticed that Pragmas means a lot of things for me (I used the word a lot in the mail and for different purposes). I may have to read again a documentation about this but I think the idea is here. Is it clear ? beacause I use getters and setters for my iv :) And pragmas won't help you in my opinion, I don't see any relation :-) Why don't you want getters and setters ? Hope this is your last question of the day, I already answered 4 of them and I'm tired now :-D See you soon
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Building the equivalent of wget in Squeak, andy . burnett |
|---|---|
| Next by Date: | Re: Building the equivalent of wget in Squeak, Damien Cassou |
| Previous by Thread: | Re: FFI, pragma and co..., cdrick |
| Next by Thread: | Re: FFI, pragma and co..., cdrick |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |