December 26, 2017
On 12/26/2017 3:54 AM, codephantom wrote:
> I simply have to 'forget' to annotate with @safe

Not annotating with @safe is mechanically checkable as well.
December 26, 2017
On Tuesday, 26 December 2017 at 22:55:18 UTC, Walter Bright wrote:
>
> I compiled the code snippet with clang++, a modern C++ compiler, with -Wall. It did not detect the obvious error.


https://clang.llvm.org/docs/AddressSanitizer.html

December 27, 2017
On Tuesday, 26 December 2017 at 22:56:40 UTC, Walter Bright wrote:
> On 12/26/2017 3:54 AM, codephantom wrote:
>> I simply have to 'forget' to annotate with @safe
>
> Not annotating with @safe is mechanically checkable as well.

If I were trying to create a marketing campaign for D, as being a safe language, then @safe being default would be the cornerstone of such a campaign.

Then you cannot 'forget' to use it, and there would be no need to check anything.

Then, anything not meant to be '@safe' has to be explicately, intentionally, marked as something else...and you simply cannot 'forget' to do that, otherwise the code just won't compile correctly (I assume).

Since @safe is not default, such a marketing campaign would be pointless.

As such, as better and more realistic marketing campaign would promote D as being primarily a flexible language, with 'safe' features you can make use of, if you need them, some of which are on by default, and some which are not.

December 27, 2017
On Tuesday, 26 December 2017 at 16:50:54 UTC, Dan Partelly wrote:
>
> Ok I'll bite. Can you recommend me some reasonable easy literature. Something you can read in free time when you travel, not study.   Social interactions where always interesting for me.

https://en.wikipedia.org/wiki/Civilization_and_Its_Discontents

December 27, 2017
On Tuesday, 26 December 2017 at 15:53:50 UTC, Russel Winder wrote:
>
> Sadly I cannot see either of these happening. There is already too much to pack in to an undergraduate CS (*) course even if first programming and simple algorithms moves out into pre-university education – as has now happened in the UK. Also far too few universities have good CS/Psych cooperation.
>

This is changing though, particulary as a result of advances in cognitive neuroscience.

i.e. These sciences are bringing about new 'quantifiable' knowledge, which can then be formally integrated into education.

But the design of graduate studies really needs to be radically transformed, as they simply try to pack far too much in...leaving students without any time to reflect on what they're doing, or why they're doing it.

In addition, we live in 'the age of distractions and mulitasking', so students really learn very little these days from doing a degree..(particulary those packed with too much stuff).

I think this is why (at least in Australia), there is a significant trend towards studying degrees part-time - the cognitive load of full-time degrees not longer support the way people want to (or just happen to) live these days.

Until univerties stop trying to be money making machines, and get back to teaching people how to learn about useful things, then not much will change.

Anyway, too see how useful it is, to combine psychology and programming language/library design, here is a great paper:

https://synesthesiam.com/assets/hansen2012_architectures.pdf

btw. One of the things I like most about D, has to do with 'chunking comprehension' - and in comparison to C or C++, D is the winner for sure.

December 26, 2017
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.

December 26, 2017
On 12/26/2017 3:59 PM, codephantom wrote:
> On Tuesday, 26 December 2017 at 22:55:18 UTC, Walter Bright wrote:
>> I compiled the code snippet with clang++, a modern C++ compiler, with -Wall. It did not detect the obvious error.
> https://clang.llvm.org/docs/AddressSanitizer.html


That's not mechanical checking, because it is a runtime check that requires a test case that would actually trip it. Without a careful, manually created test suite, it does not detect anything. AS is not present in the shipped product.

AS is a hackish workaround for the failure of the language to prevent such things.

AS is just a more modern valgrind, which has been around for ages, and has failed to turn C/C++ into memory safe languages.
December 27, 2017
On Wednesday, 27 December 2017 at 07:49:33 UTC, Walter Bright wrote:
>
> AS is a hackish workaround for the failure of the language to prevent such things.
>
> AS is just a more modern valgrind, which has been around for ages, and has failed to turn C/C++ into memory safe languages.

Well, I don't want C to become a memory safe programming language. I want my pointer to be able to point to anywhere, and I mean..anywhere ;-)

As for D, I agree that memory safety is clearly not an afterthought that requires 'hackish workarounds', like C++ needs.

btw. I'd like to see D 3.x introduce a breaking change and make @safe the default, instead of @system. I think that would be huge boost for D going forward.

How practical that is, I would have no idea.

But as an 'end user' of D, I would prefer to have to explicitely mark code as @system, rather than have to explicitely mark code as @safe, and therefore having to find tools that help me check whether I 'forgot' to do that.

December 27, 2017
On Wednesday, 27 December 2017 at 07:44:30 UTC, Walter Bright wrote:

>
> A fair amount of D's design is based on psychology.

Please elaborate. Which parts ? Where the results you got the projected ones, or disappointments ?

December 27, 2017
On 12/27/2017 1:38 AM, Dan Partelly wrote:
> On Wednesday, 27 December 2017 at 07:44:30 UTC, Walter Bright wrote:
>> A fair amount of D's design is based on psychology.
> Please elaborate. Which parts ? Where the results you got the projected ones, or disappointments ?


Builtin unittests and Ddoc, for example. There's a big psychological advantage to having them built in rather than requiring an external tool. The closeness to C syntax is no accident, for another.

I've been in the compiler biz since the early 80s, working with customers, doing tech support. That results in experience in what works for people and what doesn't, even if it is not scientific or better from a CS point of view.