On 05.12.2011 20:20, John J Barton wrote:
On Mon, Dec 5, 2011 at 2:48 AM, Tom Van Cutsem<[email protected]> wrote:
Hi,
There have previously been discussions on this list and elsewhere about
whether or not proxies cover the __noSuchMethod__ use case [1,2].
...
[1] https://mail.mozilla.org/pipermail/es-discuss/2011-October/017467.html
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=683218#c8
The references here discuss how proxies can/cannot implement
__noSuchMethod__. Is there a use case for __noSuchMethod__? As in why
would anyone want such a thing?
Dynamic abstractions. A real example Ruby on Rails' database lookup methods.
Say, you have a model with fields, [id, name, email], then in your db
model you have methods:
db.find_by_name, db.find_by_email, etc. Once you add another field to
your db, you automatically have its getter either.
And all these methods are virtual. Though, rails uses
"once-called-virtual-method" approach. Which means the method (for
efficiency) will be created on object/prototype.
Dmitry.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss