Open apblack opened 8 years ago
no.
DoesNotUnderstand It's a very significant base-level change to the language that makes it an awful lot more powerful (and once you go there, almost impossible to type). We shouldn't put that into the base language: if we need it --- and for some things, perhaps we do --- then it should go in as an explicitly reflexive facility. Yes that makes it harder to use reflexive method definitions: that's the point.
Self sends DoesNotUnderstand (called "undefinedSelection:...") to the receiver, like Smalltalk and intentionally for the same reasons, but if that send also is undefined then it notifies the process (rather than looping I guess).
I agree that this is a reflexive facility. Can you make a concrete suggestion as to how it should appear? Is the import of your comment that the receiver should request
mirror.reflect(self).onNoSuchMethodDo { methodName, arguments -> ... }
rather than defining
method noSuchMethod (methodName, arguments) { ... }
Or are you saying something else?
In Smalltalk, when a non-existant method is requested, the target object hets a chance to handle the condition, before the default system error handler. In Self, I think that the process making the request gets the first chance to handle the error, followed by the target object.
In Grace,
NoSuchMethod
is raised in the requester; the target object gets no say. This makes it hard to create stuff like RPC proxies, or the magic wrappeddom
objects that expose HTML5 Canvas methods in JavaScript.Should we allow objects to implement
if they wish, and execute such a method (if it exists) before raising the
NoSuchMethod
exception?