3 ms·
I'm a little confused by the receiver thing. Is the idea that each object has a dictionary mapping function names to code and sending a message to an object mea
by JonChesterfield 3y ago
I'm a little confused by the receiver thing. Is the idea that each object has a dictionary mapping function names to code and sending a message to an object means execute whatever was found in that dictionary?
So the example of { a < 3 } while involves evaluating a block, getting a boolean, then calling the while method on that boolean?
That would seem to have a bad time with things like compare. Neither argument is special, you end up implementing a lot of compare-with methods. I.e. the expression problem. Is that understanding broadly correct?
- smackeyacky 3y agoPretty much although it doesn't end up being quite as bad as it sounds. For example, your code wants to compare a string with some other object, if the other object understands 'string' then the built in method for comparing two strings can work. Otherwise you get a #doesNotUnderstand exception. Making arbitrary comparisons is a bit silly though, so in practice it doesn't happen very often.
- zozbot234 3y ago> Is the idea that each object has a dictionary mapping function names to code and sending a message to an object means execute whatever was found in that dictionary? Isn't that how Python, Ruby, JS etc. work under the hood anyway? And yes it's quite predictably a drag on performance.