[Issue 10150] Prefix method 'this' qualifiers should be just ignored anytime

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 1 02:28:54 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10150



--- Comment #14 from Dicebot <m.strashun at gmail.com> 2013-07-01 02:28:51 PDT ---
(In reply to comment #11)
> Typ? "Both", then you state two different things.
Both free function and method.

> AFAIK, anything returnable can be qualified with const, so there would be no
> fall through case.

I don't know if const(void) is valid, but at least pure is applicable to return
type only when it is one of function types so it will fall through. I am not
speaking only about const, all attributes should behave consistently.

> What about:
> 
> --------
> struct S
> {
>     const nothrow pure
>     T foo();
> 
>     nothrow pure const
>     T bar();
> }
> --------
> 
> What does (should) foo return? What about bar?

both return const(T) (at the very least, I have no idea what T is). When I am
speaking about postfix qualifier I mean "T bar() const pure nothrow"

> The current rules are obvious: stand alone attribute => Function.
> Simple and obvious.
> There is no reasons for "const" to get special treatment.

No, they are more like "stand alone attribute -> function or no-op, you'd
better be careful!". And breaks similarity with C/C++ principle. And makes your
code needlessly "Lisp-y".

Behaviour has been very confusing all the time but at least it slapped me into
face every time I tried to type stuff in a more natural syntax. Not any more.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list