Hi,

I've already spoken to sbp about this on swhack, but I figure the mailing list 
should get a 
post too. I'm thinking about the use of a Smalltalk-style message passing 
syntax with 
Pluvo. In Smalltalk, 'method calls' look like the following:

   mouse setValue: 42 forKey: "The Answer"

This form of syntax increases readability (each parameter is kept with a piece 
of text 
describing the purpose of the paramater) and, as importantly, reads more like 
English. 
Internally, in Objective-C (which has a similar syntax) the method names are 
stored in the 
form "setValue:forKey:" where the colons indicate where to interleave the 
arguments. An 
important side-effect of this is that a form of psuedo-polymorphism is possible 
by adding 
'prepositions'. For example, an object could have the following methods:

    sendFile: file
    sendFile: file to: location
    sendFile: file to: location withEncoding: enc
    sendFile: file withEncoding: enc

This wouldn't (I don't think) require anything other than standard 'message' 
look-up.

Methods without parameters (for example predicates) are called without a 
trailing colon. 
For example: dog hasTail

>From a certain perspective, this syntax allows programmers to define a 
>restricted subset 
natural language grammar for the messages sent to an object. This may make it a 
lot 
easier to teach people how to use Pluvo, and will definitely make libraries 
easier to learn.

An example object is shown below:

   def Dog
       _name = "Rover"
       _barkSound = ""
       ! create
           _barkSound = "WOOF!"
       ! create: withName: name
           _name = name
       ! bark
           say "$_barkSound"
       ! barkAt: obj
           say "$_name $_barkSound at $obj!"
       ! fetch: obj for: person
           obj setLocation: person

Note the use of "!" to denote that what follows defines a message. This is 
inspired by 
agent-oriented languages which use "!" to denote actions.

Other aspects of Smalltalk may be of use, particularly message inspection and 
trampolining. Message inspection allows the object to catch messages before 
they get to 
their normal implementation, analyse them and perform tasks on them. This 
supports 
aspect-oriented programming. Trampoling allows an object to look at the message 
and 
bounce it to another object. This allows easy support for patterns like 
delegation and 
proxies as well as other common feature of languages such as exception handling 
and 
inheritance.

Anyway, that's a long enough rant. Will probably have more ideas soon.

Regards,
Joe






------------------------ Yahoo! Groups Sponsor --------------------~--> 
See what's inside the new Yahoo! Groups email.
http://us.click.yahoo.com/2pRQfA/bOaOAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/pluvo/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to