digitalmars.D.learn - std.typecons.Rebindable
- Jack Applegame (4/4) Jan 31 2014 Why doesn't Rebindable allow associative arrays?
- Frustrated (6/10) Jan 31 2014 an associative array doesn't pass the isArray test
- monarch_dodra (10/24) Jan 31 2014 What's the point of using Rebindable for a non-[class|interface]
- Jack Applegame (7/18) Feb 02 2014 Hmm. I need to pass an unique associative array to several
Why doesn't Rebindable allow associative arrays? import std.typecons; Rebindable!(immutable string[]) data1; // ok Rebindable!(immutable string[string]) data2; // error
Jan 31 2014
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; // erroran 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.
Jan 31 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: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.Why doesn't Rebindable allow associative arrays? import std.typecons; Rebindable!(immutable string[]) data1; // ok Rebindable!(immutable string[string]) data2; // erroran 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.
Jan 31 2014
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.Hmm. I need to pass an unique associative array to several threads. If this array has immutable elements, but isn't immutable itself, then what happen if one of threads adds or removes element from array? Associative arrays is some kind of hash-table. Adding alements in one thread can cause undefined behaviour in other thread. Am I wrong?
Feb 02 2014