3 ms·
I don't know if it's very accurate to say "f(o) is like o.f()". I think this depends on the language and the way it deals with methods. For example, Python mak
by enz 9y ago
I don't know if it's very accurate to say "f(o) is like o.f()". I think this depends on the language and the way it deals with methods.
For example, Python makes this explicit: the first argument of a Python method is `self`, which is nothing more than an object. The first argument has nothing special, and its name is `self` only by convention.
So, in Python, yes, maybe we can say "f(o) another syntax for o.f()" and the signature of f is `f(my_obj : MyObject)`, not f().
So, in some way, a Python method has the potential to have "pure" scope just like a regular FP function: You have no special global reference like `this`, you only have what you have passed to the function.
But what about other OOP languages ? Do they have the same semantic?