dmd 1.054 and 2.038 release
Steven Schveighoffer
schveiguy at yahoo.com
Fri Jan 1 09:01:36 PST 2010
On Fri, 01 Jan 2010 11:16:00 -0500, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
>
> Well I'm sorry to tell that inout is useless as currently implemented.
> One important motivating use case was:
>
> inout(char)[] blah(inout(char)[] input) {
> return input;
> }
>
> void main()
> {
> blah("xyz");
> blah("xyz".dup);
> }
>
> That doesn't work at all.
Yeah, I think walter said the inout currently must apply to the entire
parameter/return value. That is a severe limitation I think, but the fact
that it parses makes me think it's a simple fix. It's almost like the
type system is working right, but the trigger to convert inout back and
forth isn't firing.
> The second motivating case also doesn't work:
>
> class A {
> A _next;
> inout A next() inout { return _next; }
> }
>
> void main()
> {
> auto a = new A;
> const b = a;
> auto c = a.next();
> auto d = b.next();
> }
I found that inout member functions don't work at all. It's almost as if
the compiler ignores the inout designation when doing the inout const
match.
>
> There are few, if any, cases where the current inout does help. The good
> news is that most of the implementation effort has been done so probably
> making things work will not be very difficult.
Yeah, I just was disappointed that it was listed as implemented. Half
implemented is ok, as long as it will be fixed.
-Steve
More information about the Digitalmars-d-announce
mailing list