3 ms·
I wasn't clear, but I meant that mostly as a comment to: > This is always what I thought OOP should be, but could never put my finger on. I'm not sure what Si
by e12e 11y ago
I wasn't clear, but I meant that mostly as a comment to:
> This is always what I thought OOP should be, but could never put my finger on.
I'm not sure what Simula did, but at least in Smalltalk this is how OOP have worked :-)
> So, pretty much whether everything is being applied right to left vs being applied left to right?
I'm not sure that's the best takeaway; consider:
$ gst
GNU Smalltalk ready
st> 2 * 3; * 3; * 3
6
st> 2 * 3 * 3 * 3
54
Now, if the object on the far left was some kind of
accumulator/container, the
effect of sending something like three "add the number 3" would be
similar to chaining. But even if you mulitply the number 2 by 3, three
separate time, 2 * 3 still equals 6.
In fact, in order to get chaining with keyword messages, you apparently
need to define it, or especially adapt eg: containers to return ^self.
But as should be obvious, I'm not very familiar with Smalltalk. Some
more on the subject: http://blog.3plus4.org/2007/08/30/message-chains/ http://blog.3plus4.org/2007/08/30/message-chains/