Why is `scope` planned for deprecation?

via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 13 04:01:32 PST 2014


On Thursday, 13 November 2014 at 11:44:31 UTC, Manu via 
Digitalmars-d wrote:
> I don't follow how you associate that opinion with 
> implementation of
> scope.

I don't like semantics where I have to state that the parameters 
and the function should be "pure". It should be opposite. Say, if 
you have an array on the stack, then I'd like to take a slice of 
it and send it to a function to compute a sum(). But, I don't 
want the type system to prevent me from doing it because the 
author of sum() forgot to add "scope" to the parameter.

What is the difference between a function that is annotated as 
"pure" and a function where all input is "scope"? This is 
backwards!

Function signatures should not say "I am playing nice…", that 
should be the default. They should say "watch out, I'm stealing 
your stuff!".

> By contrast, I have no idea what you're suggesting, or how it's 
> not a
> 'crutch'... but if it's anything to do with C++, I'm dubious, 
> and
> kinda frightened.

C++ is multi-paradigm and backwards compatible focused, and is 
therefore ruled by a mess of conventions and fixes, true.

> After having adapted to D and distancing from C++, trying to go 
> back is like some form of inhuman torture!

C++ is not excellent… Too verbose and grown out of the 
include/macro system (which suits C better than C++). I find C++ 
ok when I use it like C with bells (and leave out the whistles).

> Judged on common ground, there is no competition. It's only 
> 'the devil you know' case that I think can possibly make an
> argument for C++.

I don't know. I only use C++ for things that is suitable for C. 
Like DSP/realtime. Fortunately I don't have to deal with other 
people's C++ code.

Many C++ frameworks look really ugly, but with C++14 I think I 
shall be able to make my own code look acceptable (readable).


More information about the Digitalmars-d mailing list