For whom is (was: D2? Re: Destructors, const structs, and opEquals)

spir denis.spir at gmail.com
Sat Dec 11 00:42:37 PST 2010


On Fri, 10 Dec 2010 21:25:49 -0500
Michel Fortin <michel.fortin at michelf.com> wrote:

> On 2010-12-10 17:12:16 -0500, Don <nospam at nospam.com> said:
> 
> > Steven Schveighoffer wrote:
> >> To summarize for those looking for the C++ behavior, the equivalent would be:
> >> 
> >> void foo(auto ref const Widget)
> > 
> > That use of 'auto' is an abomination.
> 
> One problem I'm starting to realize is that we now have so many 
> available qualifiers for function parameters than it's really easy to 
> get lost.
> 
> In D1 it was simple: "in" for regular arguments (the default), 
> "inout"/"ref" for passing arguments by refrence, and "out" for output 
> arguments. They all had clear semantics and not too much overlap.
> 
> In D2, we've lost this simplicity. Add "const/immutable/shared", add 
> "scope", change "in" as an alias for "const scope", give "inout" a 
> totally new meaning, keep "ref" and "out" the same except that now 
> "ref" can be prefixed with "auto" to give it a double meaning...  
> choosing the right modifiers for function parameters is getting extra 
> complicated.
> 
> Have we lost track of one of D's principles, that doing the right thing 
> should be the easiest way to do things? To me it looks like we're 
> adding more and more ways to pass arguments because the defaults are 
> failing us. Perhaps it's time to revisit how arguments are passed by 
> default.
> 
> As for "auto ref", if we're to keep it I think it'd be much better if 
> it was a keyword of its own, such as "autoref". Having modifiers is one 
> thing, but having modifiers that apply to modifiers is getting a little 
> hard to parse in my head. This is not unprecedented, in English when 
> one qualifier apply to another and it becomes hard to read we group 
> them by adding a hyphen between the two.

I totally agree. This extends to all sorts of D qualifiers:
abstract alias const extern final immutable in inout lazy nothrow out override private protected public pure ref scope shared static.

I'm afraid D2 in on the track of becoming a language for the elite. What do you think?
(I'm certain it is possible to make most languages simpler and as powerful, if we use clever designer brains with this target in mind. The issue I see with all those features is: what do they mean? Note What is absent from D docs is the purpose and meaning of most elements of the language. Probably obvious for their designers, but who else is supposed to use them?)


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list