Is there a way to implement in javascript the functionality of python's __getattribute__() (or __getattr__())? That is, a method which is called whenever an object is called with method name or property name which cannot be resolved?
For example, a mechanism to implement any of the following:
# Python's method syntax
o.Name(args) # o.__getattr__('Name') is called and returns
# a function which is called with args
# Alternative method syntax
o.Name(args) # o.__getattr__('Name', args) is called and returns a value
# Properties syntax
o.Name = v # o.__getattr__('Name', v) is called
v = o.Name # o.__getattr__('Name') is called and returns a value
I'm most interested in the method syntax, but the property syntax would be a nice bonus. Thanks!