Re: local const functions - bug ?

2016-07-12 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 10 July 2016 at 07:20:29 UTC, Meta wrote: On Friday, 8 July 2016 at 09:01:10 UTC, Marc Schütz wrote: `foo()` is effectively a delegate, therefore `const` applies to the context. AFAIK const on a function can only ever refer to the `this` pointer, but there is no `this` pointer.

Re: local const functions - bug ?

2016-07-10 Thread Basile B. via Digitalmars-d-learn
On Sunday, 10 July 2016 at 07:20:29 UTC, Meta wrote: On Friday, 8 July 2016 at 09:01:10 UTC, Marc Schütz wrote: `foo()` is effectively a delegate, therefore `const` applies to the context. AFAIK const on a function can only ever refer to the `this` pointer, but there is no `this` pointer.

Re: local const functions - bug ?

2016-07-10 Thread Meta via Digitalmars-d-learn
On Friday, 8 July 2016 at 09:01:10 UTC, Marc Schütz wrote: `foo()` is effectively a delegate, therefore `const` applies to the context. AFAIK const on a function can only ever refer to the `this` pointer, but there is no `this` pointer.

Re: local const functions - bug ?

2016-07-08 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 7 July 2016 at 15:02:29 UTC, Jonathan M Davis wrote: On Thursday, July 07, 2016 10:33:39 Basile B. via Digitalmars-d-learn wrote: this compiles without error: struct Foo { int i; void bar() { void foo() const { i = 1; }

Re: local const functions - bug ?

2016-07-07 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 07, 2016 10:33:39 Basile B. via Digitalmars-d-learn wrote: > this compiles without error: > > > struct Foo > { > int i; > void bar() > { > void foo() const > { > i = 1; > } > foo; > } > } > > In this case

Re: local const functions - bug ?

2016-07-07 Thread Basile B. via Digitalmars-d-learn
On Thursday, 7 July 2016 at 12:24:08 UTC, Edwin van Leeuwen wrote: On Thursday, 7 July 2016 at 10:33:39 UTC, Basile B. wrote: this compiles without error: struct Foo { int i; void bar() { void foo() const { i = 1; } foo; } } In this

Re: local const functions - bug ?

2016-07-07 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Thursday, 7 July 2016 at 10:33:39 UTC, Basile B. wrote: this compiles without error: struct Foo { int i; void bar() { void foo() const { i = 1; } foo; } } In this case "const" seems to be a noop. Do you think it's a bug ?

Re: local const functions - bug ?

2016-07-07 Thread ag0aep6g via Digitalmars-d-learn
On 07/07/2016 12:33 PM, Basile B. wrote: Do you think it's a bug ? Yes.

local const functions - bug ?

2016-07-07 Thread Basile B. via Digitalmars-d-learn
this compiles without error: struct Foo { int i; void bar() { void foo() const { i = 1; } foo; } } In this case "const" seems to be a noop. Do you think it's a bug ? Shouldn't "const" be applied, despite of foo() inaccessibility ?