Why I'm Excited about D
via Digitalmars-d
digitalmars-d at puremagic.com
Thu Apr 9 09:44:02 PDT 2015
On Thursday, 9 April 2015 at 16:12:17 UTC, Araq wrote:
> side-effect in C++/Java/C#/C. The real issue here is that
> 'node' or 'getNode' is simply poorly named suggesting it has no
> side-effects. 'nextNode' for instance doesn't have this problem.
"next" is a common name for next-pointers. You need to pick a
verb that cannot be mistaken for an adjective. E.g.
"moveToNextNode".
Anyway, being explicit is important for maintainability. Some
language designers are very much against even overloading for
this reason. There's a convenience-maintenance trade off between
weakly typed implicit languages and statically/strictly/strongly
typed explicit code (suitable for large vocabulary, large source
base, long running).
Here's the semiotics I tend to go by:
- Dot-notation indicates an accessor/interface provided by the
object, e.g. penetrating an encapsulation.
- A parametric accessor ("()" is empty) indicates work being done
using reference semantics.
- Free form functions indicates value-semantics with results
derived from values/objects.
Consistent mapping from syntax to semantics makes for more
readable and, more importantly, more easily maintainable code.
More information about the Digitalmars-d
mailing list