Type Qualifiers and Wild Cards

Steven Schveighoffer schveiguy at yahoo.com
Wed Nov 9 05:14:28 PST 2011


On Tue, 08 Nov 2011 08:08:19 -0500, deadalnix <deadalnix at gmail.com> wrote:

> Le 08/11/2011 02:08, Walter Bright a écrit :
>> http://drdobbs.com/blogs/cpp/231902461
>>
>> Anyone want to do the reddit honors?
>
> Great article. The only point I would raise is the choice of inout as a  
> keyword for this.
>
> This make no sens whatsoever. Here is why :
> - inout did exist in D1 and is different.
> - in and out qualifier already exists and have nothing to do with inout.
> - in and out are used for contracts and have nothing to do with inout.
> - the inout term has nothing to do with const/immutable/mutable. This is  
> in a totally different lexical field.

The argument given to use inout is that it was a dead keyword (it's  
totally superseded by ref).

At the time of proposal, an argument against such a feature was that  
people didn't want to add any more keywords.  Reusing inout keyword was a  
way to cut the legs off that argument, although I would have preferred not  
to use inout.

It is kind of related, as in, the qualifier you pass in becomes the  
qualifier passed out.

>
> Another keyword should be choosen. vconst, as suggested here :  
> http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP2 is way more  
> appropriate.
>
> On external details, but still important, I face the need of inout few  
> days ago and did knew about it. The documentation on const/immutable (  
> http://www.d-programming-language.org/const3.html ) doesn't mention it.  
> The page on fucntion mention it, but it would be nice to have at least a  
> link on the const/immutable page.

That documentation is not exactly documentation.  It's an article on  
const.  I agree it needs to be updated.

-Steve


More information about the Digitalmars-d mailing list