heh.. you see my pain! right now i have to deal with C++
and seeing all these
const Type & foo const..
and cannot parse it..
:)
I think that C++ tries to avoid this confusion by not using "method" for the members of a method, so for example it does not define variables inside a method as "method variables" but rather "local variables" so AFAIK C++ has "constant method" as a method that is not allowed to change but it does not have or at least I have not seen "method constant' as a variable inside a method that does not change but rather refers to it as "method's local constant variable" while "constant" alone is implying "global constant variable".
In case C++ did define as you said the confusion would extend even more to what you mention because "method constant" would imply a method local constant variable and not a return type.
As Python zen's states "its better to be explicit than implicit" . Sure long names take more time to type(unless you use auto completion) but they avoid such confusions and the need to take a look at the documentation.
On Fri, Jan 27, 2017 at 7:12 AM, Dimitris Chloupis <[hidden email]> wrote:
heh.. you see my pain! right now i have to deal with C++
and seeing all these
const Type & foo const..
and cannot parse it..
:)
I think that C++ tries to avoid this confusion by not using "method" for the members of a method, so for example it does not define variables inside a method as "method variables" but rather "local variables" so AFAIK C++ has "constant method" as a method that is not allowed to change but it does not have or at least I have not seen "method constant' as a variable inside a method that does not change but rather refers to it as "method's local constant variable" while "constant" alone is implying "global constant variable".
In case C++ did define as you said the confusion would extend even more to what you mention because "method constant" would imply a method local constant variable and not a return type.
As Python zen's states "its better to be explicit than implicit" . Sure long names take more time to type(unless you use auto completion) but they avoid such confusions and the need to take a look at the documentation.
Hmm. Our language doesn't have method variables, either - class variables, instance variables, and temp variables (among others).
Maybe this should be called 'asTempConstant' ? (although a 'temporary constant' sound really, really weird...)