Linked by Thom Holwerda on Sun 4th Sep 2005 17:00 UTC, submitted by <a href=
OpenStep, GNUstep Objective Modula-2 (or ObjM2) is an extension to Modula-2 which follows the Objective-C object model and retains the bracketed Smalltalk message passing syntax introduced in Objective-C. Like Objective-C, Objective Modula-2 is a reflective, object oriented programming language with both static and dynamic typing. It is intended as a safer alternative to Objective-C for Cocoa and GNUstep software development.
Thread beginning with comment 27385
To read all comments associated with this story, please click here.
Message me this
by japail on Sun 4th Sep 2005 20:56 UTC
japail
Member since:
2005-06-30

Smalltalk doesn't have "bracketed message passing syntax." The brackets in Smalltalk are used for constructing blocks, which are similar to closures. Objective-C doesn't really share much with Smalltalk in terms of syntax.

How to send a parameterless message:

someObject msg.


How to send a message with one parameter:

someObject msg: argument.


How to send a message with multiple parameters:

someObject msg: argument msg2: argument2.


How to send two parameterless messages to the same object ("cascading"):

someObject msg; msg2.


Send msg to someObject and then send msg2 to the resulting object:

someObject msg msg2.


Compare whether x is larger than y, and if it is then send msg to someObject:

(x > y) ifTrue: [ someObject msg ].

Notice that [ someObject msg ] is an object (a block) passed as a parameter in the message ifTrue sent to the boolean returned by the binary message >.


1 to: 10 do: [ :n | someObject msg: n ].

Count from 1 to 10, sending each number as a parameter to msg being sent to someObject. Notice how the block has been created to expect a parameter when it's invoked.

If you're familiar with Objective-C, you'll notice how different this is from how you program with Objective-C. Smalltalk is a fairly elegant, simple language.

Reply Score: 1

RE: Message me this
by japail on Sun 4th Sep 2005 21:05 in reply to "Message me this"
japail Member since:
2005-06-30

My point is mostly that Objective-C just has named (labeled, keyword, ...) parameters, and not really Smalltalk-style messaging syntax. The selectors in both use semicolons, and from there things stray.

Reply Parent Score: 1

RE[2]: Message me this
by japail on Sun 4th Sep 2005 21:07 in reply to "RE: Message me this"
japail Member since:
2005-06-30

That should read "colons." Edit functionality would do wonders for my brash impatience and flagrant ineptitude.

Reply Parent Score: 1

RE[2]: Message me this
by on Mon 5th Sep 2005 20:53 in reply to "Message me this"
Member since:

In response to japail on 2005-09-04 20:56:19 UTC saying ...
'Smalltalk doesn't have "bracketed message passing syntax."'

Well, that's precisely why the Objective-C variant is called bracketed Smalltalk message-passing syntax.

It means Smalltalk message-passing syntax, enclosed in brackets.

Reply Parent Score: 0

RE[3]: Message me this
by japail on Sat 10th Sep 2005 01:06 in reply to "RE[2]: Message me this"
japail Member since:
2005-06-30

Which it isn't, as I've pointed out through numerous examples.

Reply Parent Score: 1