When writing a private method that has no need to access other members of the same class, how do you choose between private member and let binding?
- I tend to use private members because it’s easier to change accessibility if required, but are there other aspects to keep in mind when making the choice?
- Are let bindings compiled as private members (making this only a style choice)?
The relevant portion of the spec is section 8.6.2. It states:
Also:
I prefer
letbindings to private members because they’re more “functional,” i.e., they emphasize “what” over “how.” The compiler takes care of the optimal compiled form.