Maybe D is right about GC after all !
Walter Bright
newshound2 at digitalmars.com
Wed Dec 27 20:48:12 UTC 2017
On 12/27/2017 8:38 AM, Laeeth Isharc wrote:
> On Wednesday, 27 December 2017 at 07:44:30 UTC, Walter Bright wrote:
>> On 12/26/2017 4:18 AM, Russel Winder wrote:
>>> All of which brings us full circle: when it comes to programming
>>> languages and software development, it is all about advocacy,
>>> prejudice, and belief, there is very, very little science happening –
>>> and most of the science that is happening is in the psychology of
>>> programming, about which most developers of programming languages know
>>> nothing.
>>
>> If you're hinting that I know nothing about the topic, you're mistaken :-)
>>
>> A fair amount of D's design is based on psychology.
>
> I'd love to hear more about this sometime.
One fun example is our quest to find the right keyword for read only data. A
long list of words were examined, like readonly, invariant, etc. Some had
various baggage connotations, some weren't clear what they meant.
We found ourselves constantly saying things like: "readonly means immutable",
"invariant means immutable", etc. Finally we got hit with a clue-by-four -
everyone understood what "immutable" meant, so why not just use "immutable"?
Pure psychology, and nothing to do with computer science.
---
Another is it is known that people have cognitive problems with negation. It
often just does not register in the mind. This is why version statements in D do
not have negation. It more or less forces one to think of using positive version
identifiers:
version (hasFeature) { ... }
as opposed to:
version (!hasFeature) { ... }
or even worse (yes I've seen it):
version (!doesNotHaveFeature) { ... } // :-(
In order to do negation, one must resort to:
version (hasFeature) { } else { ... }
Having converted a lot of C code to D and dealing with things like:
#if !__OSX__
... call X ...
having to redesign the case to use positive features:
version (hasX)
... call X ...
makes the code a lot more readable. It's worth it.
The psychological cognitive issues around negation are known, but I rarely see
deliberate efforts by programmers to deal with that issue. D kinda forces it,
and I get resistance to it, but it is worthwhile to push it because the results
are worth it.
More information about the Digitalmars-d
mailing list