On 13 November 2014 22:01, via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > 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!
D has attribute inference, that's like, a thing now. Theoretically, the compiler may be able to determine that a reference does not escape, and infer the 'scope' attribute, in many cases. This would be consistent with other attributes. > Function signatures should not say "I am playing niceā¦", that should be the > default. They should say "watch out, I'm stealing your stuff!". But that's already a concrete pattern throughout D. To do something otherwise would be an unexpected deviation from the norm. For the record, I agree with you, but that boat sailed a very long time ago. We must now stick to the pattern that's in place. > Many C++ frameworks look really ugly, but with C++14 I think I shall be able > to make my own code look acceptable (readable). I don't see anything in C++11/14/17 that looks like they'll salvage the language from the sea of barely decipherable template mess and endless boilerplate. It seems they're getting deeper into that madness, not less. I spent the last 2 days doing some string processing in C++... possibly the least fun I've ever had programming. Somehow I used to find it tolerable!