inout and function/delegate parameters

Steven Schveighoffer schveiguy at yahoo.com
Wed Mar 7 15:09:47 PST 2012


On Wed, 07 Mar 2012 18:01:10 -0500, Stewart Gordon <smjg_1998 at yahoo.com>  
wrote:

> On 07/03/2012 22:48, Steven Schveighoffer wrote:
>> On Wed, 07 Mar 2012 17:37:53 -0500, Stewart Gordon  
>> <smjg_1998 at yahoo.com> wrote:
> <snip>
>>> cast() is an abomination. I'm not sure OTTOMH whether it's a bug that  
>>> it works.
>>
>> Sorry, it's just easier than typing cast(int*).
>
> Which is another abomination.  The means of casting away constancy  
> should be explicit.

I agree, but it doesn't make it illegal.  It was just a means to show what  
I meant.

>
> <snip>
>>>> But from an API point of view, I look at at inout as guaranteeing  
>>>> anything the parameter
>>>> points at won't change while inside the function *using that  
>>>> parameter*. Even though it's
>>>> legal, it's disingenuous (at least as long as we define inout that  
>>>> way).
>>>
>>> That's what const is for.
>>
>> And inout. Sorry, it was meant that way, even if you don't agree.
>
> Maybe _you_ meant it that way, but did anyone else?

I actually designed it...

http://d.puremagic.com/issues/show_bug.cgi?id=1961

http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP2

-Steve


More information about the Digitalmars-d mailing list