top | item 47047666

(no title)

JadeNB | 12 days ago

> Well thats because objc and ruby are cousins. Both are sort of the only two smalltalk based languages out there

I'm sure you can trace connections, at least in ideas, but I think Ruby is way more Perl-based than Smalltalk-based.

discuss

order

JamesSwift|12 days ago

Im talking the fundamental language framework. 'Everything is an object' and method calls are actually message passing are the two reasons that objc and ruby are actually smalltalks.

jonhohle|12 days ago

I’ve tried to explain this before and unless you’re steeped in late binding, encapsulation, and message passing, the details are lost on most people (it seems including modern language designers).

For the GP, in most languages the dot or arrow operator is field access. If that field is a function reference, parenthesis are used to invoke it.

From outside of the object, neither Ruby or Objective-C allow direct access to object fields or functions. The dot operator sends the object a message that be bound to anything, and even rebound at runtime for specific instances. There is no difference between access and property and calling a function - it’s all messages. Smalltalk and Objective-C (before dot operators) don’t even have different syntax for data fields and functions calls. Ruby’s no arg messages are similar.

Most of the time that distinction doesn’t matter. But writing things like wrappers and proxies becomes trivial. A object can forward any message it receives, and if it sees on it wants to intercept, it can do that easily. Most of the time modifying existing programs and frameworks can be as easy as rebinding some logic to something that wasn’t part of the original program.

This comes at the cost of some runtime performance, and possibly some complexity. The elegance outweighs those, imho.