3 ms·
A member function must have at least one parameter. Here it's "parameter0": parameter0.membfun() It doesn't really matter whether the parameter name is separa
by rhn_mk1 4y ago
A member function must have at least one parameter. Here it's "parameter0":
parameter0.membfun()
It doesn't really matter whether the parameter name is separated from the function name by a dot, or a bracket. In a different syntax, it might have been written as "membfun(parameter0)" without any practical difference.
This means that Foo::length() can be pure no problem, because Foo is its parameter, and, as such, in its scope.
- jb1991 4y agoI see your point, but you are still passing the entire state of the entire object to your function if you want to follow that line of thought. This is also discussed in the article, and it’s not really what functional programming is about. What other state is in there that the function has access to? Maybe on a case-by-case basis you can say that particular object only has one piece of data, but in the general case this is definitely not what purity and functional programming is about.