std.typecons.Rebindable

monarch_dodra monarchdodra at gmail.com
Fri Jan 31 06:27:14 PST 2014


On Friday, 31 January 2014 at 12:43:21 UTC, Frustrated wrote:
> On Friday, 31 January 2014 at 08:40:30 UTC, Jack Applegame 
> wrote:
>> Why doesn't Rebindable allow associative arrays?
>>
>> import std.typecons;
>>
>> Rebindable!(immutable string[]) data1;       // ok
>> Rebindable!(immutable string[string]) data2; // error
>
> an associative array doesn't pass the isArray test
>
> isArray!(string[]) // true
> isArray!(string[string]) // false
>
> Not sure if there is some inherent reason why but I would 
> venture
> to say it is a bug.

What's the point of using Rebindable for a non-[class|interface]
type? They are the only type where it makes sense, since you
can't give different qualifiers to the handler and the object.

I'm surprised it even handles arrays at all. As a matter of fact,
the documentation says:
"However, Rebindable!(T) does not compile if T is a non-class
type."
If arrays worked, I think it was buggy behavior. There's no sense
in having a Rebindable array.


More information about the Digitalmars-d-learn mailing list