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.

When there's no "this" pointer DMD emitts a message. If to your eyes there is no "this" pointer then there should be a message for this case.

This is also how I see the whole thing. Initially I had the intuition that "const" in this case is pointless (but >>only<< because the local proc. cannot be called from elsewhere than the parent function).

The problem with "noop attributes" is that they tend to confuse new comers. There is other cases in D, notably when one declares a static function in the global scope. Such "noop attributes" should be detected by the compiler. What if some day you, at Dlang, decide to give a semantic to those cases while users code already use them ?

(please don't answer "Dfix", this is just as a matter of principle that i talk about this).

Reply via email to