Re: Why simple code using Rebindable doesn't compile ?

2016-05-31 Thread chmike via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 06:40:31 UTC, Era Scarecrow wrote: On Tuesday, 31 May 2016 at 05:31:59 UTC, chmike wrote: My conclusion is that rebindable is not a satisfying solution to have mutable references to immutable objects. I don't understand the rationale of these immutable references. I

Re: Why simple code using Rebindable doesn't compile ?

2016-05-30 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 31 May 2016 at 05:31:59 UTC, chmike wrote: My conclusion is that rebindable is not a satisfying solution to have mutable references to immutable objects. I don't understand the rationale of these immutable references. It is too constraining. I still don't know why you're trying

Re: Why simple code using Rebindable doesn't compile ?

2016-05-30 Thread chmike via Digitalmars-d-learn
On Monday, 30 May 2016 at 21:32:46 UTC, Alex Parrill wrote: On Monday, 30 May 2016 at 10:09:19 UTC, chmike wrote: Why can't info() return a Rebindable!(immutable(InfoImpl)) ? What do you mean? `info` returns an `immutable(InfoImpl)`, not a `Rebindable!(immutable(InfoImpl))`. Rebindable doesn

Re: Why simple code using Rebindable doesn't compile ?

2016-05-30 Thread Alex Parrill via Digitalmars-d-learn
On Monday, 30 May 2016 at 10:09:19 UTC, chmike wrote: This code compile, but array appending doesn't work alias Rebindable!(immutable(InfoImpl)) Info; class InfoImpl { void foo() {} static immutable(InfoImpl) info() { __gshared immutable InfoImpl x = new immutable InfoI

Re: Why simple code using Rebindable doesn't compile ?

2016-05-30 Thread chmike via Digitalmars-d-learn
This code compile, but array appending doesn't work alias Rebindable!(immutable(InfoImpl)) Info; class InfoImpl { void foo() {} static immutable(InfoImpl) info() { __gshared immutable InfoImpl x = new immutable InfoImpl; return x; } } void main() { Info

Re: Why simple code using Rebindable doesn't compile ?

2016-05-30 Thread chmike via Digitalmars-d-learn
Oops, the duplicate alias instruction and main are copy past error. It looks like the code was already too complex for me. ;) Here is the code I tested import std.typecons; Rebindable!(immutable TestImpl) Test; class TestImpl { void foo() {} Test test() { __gshared x = new immuta

Why simple code using Rebindable doesn't compile ?

2016-05-30 Thread chmike via Digitalmars-d-learn
Hello, here is a program stripped down to the minimum code that doesn't compile import std.typecons; Rebindable!(immutable TestImpl) Test; Rebindable!(immutable TestImpl) Test; class TestImpl { void foo() {} Test test() { __gshared x = new immutable TestImpl; return rebindable