This used to compile (probably dmd 2.060):
struct Foo {
immutable int y;
void bar(TF)(TF f) pure {
f(1);
}
void spam() pure {
bar((int x) => y);
}
}
void main() {}
But now it gives:
test.d(4): Error: pure function 'test.Foo.bar!(immutable(int)
delegate(int
On Thu, Jul 11, 2013 at 05:25:09PM +0200, bearophile wrote:
> This used to compile (probably dmd 2.060):
>
>
> struct Foo {
> immutable int y;
> void bar(TF)(TF f) pure {
> f(1);
> }
> void spam() pure {
> bar((int x) => y);
> }
> }
> void main() {}
>
>
> But
On Thursday, 11 July 2013 at 16:14:13 UTC, H. S. Teoh wrote:
On Thu, Jul 11, 2013 at 05:25:09PM +0200, bearophile wrote:
Hmm. This seems to be a tricky corner case. The delegate itself
is impure, as it accesses y which is outside of its definition
and isn't part of its arguments; however, in th
On Thu, Jul 11, 2013 at 06:31:13PM +0200, Meta wrote:
> On Thursday, 11 July 2013 at 16:14:13 UTC, H. S. Teoh wrote:
> >On Thu, Jul 11, 2013 at 05:25:09PM +0200, bearophile wrote:
> >Hmm. This seems to be a tricky corner case. The delegate itself is
> >impure, as it accesses y which is outside of i
On Thursday, 11 July 2013 at 15:25:10 UTC, bearophile wrote:
This used to compile (probably dmd 2.060):
struct Foo {
immutable int y;
void bar(TF)(TF f) pure {
f(1);
}
void spam() pure {
bar((int x) => y);
}
}
void main() {}
But now it gives:
test.d(4): Er
Maxim Fomin:
My guess is that before 2.063 immutable int y was implicitly
static, but now it is per instance data which requires context
pointer which is deduced to be impure - that why compilation
fails (try placing static attribute). In other words, before
2.063 this was a function and now
Maxim Fomin:
My guess is that before 2.063 immutable int y was implicitly
static,
Yet, in the code I used to initialize y in the normal constructor
of Foo. If now I tag y as static, that's not possible any more
(Error: can only initialize static const member scale inside
static constructor)
On Thursday, 11 July 2013 at 17:59:22 UTC, bearophile wrote:
Maxim Fomin:
My guess is that before 2.063 immutable int y was implicitly
static, but now it is per instance data which requires context
pointer which is deduced to be impure - that why compilation
fails (try placing static attribut
On Thursday, 11 July 2013 at 18:03:14 UTC, bearophile wrote:
Maxim Fomin:
My guess is that before 2.063 immutable int y was implicitly
static,
Yet, in the code I used to initialize y in the normal
constructor of Foo. If now I tag y as static, that's not
possible any more (Error: can only in
On Thursday, 11 July 2013 at 16:53:30 UTC, H. S. Teoh wrote:
On Thu, Jul 11, 2013 at 06:31:13PM +0200, Meta wrote:
On Thursday, 11 July 2013 at 16:14:13 UTC, H. S. Teoh wrote:
>On Thu, Jul 11, 2013 at 05:25:09PM +0200, bearophile wrote:
>Hmm. This seems to be a tricky corner case. The delegate
On Thursday, 11 July 2013 at 18:28:19 UTC, Maxim Fomin wrote:
The reason it worked in normal constructor prior the change was
probably the same bug.
This docs covers the issue -
http://dlang.org/changelog.html#staticfields
Daym. Who thought it was a good idea to make immutable static by
defau
11 matches
Mail list logo