Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: FFI, pragma and co...: msg#00189

lang.smalltalk.squeak.beginners

Subject: Re: FFI, pragma and co...

cdrick wrote:


Pragmas *may* only be implemented for methods. It seems to be the case
in Visual Works. Do you want an explanation for methods ?

yes if you can :)


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>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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