Jump to page: 1 214  
Page
Thread overview
Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function
Oct 09, 2014
Martin Nowak
Oct 09, 2014
Brian Schott
Oct 09, 2014
ketmar
Oct 09, 2014
ketmar
Oct 13, 2014
Lionello Lunesu
Oct 09, 2014
deadalnix
Oct 09, 2014
Paolo Invernizzi
Oct 09, 2014
bearophile
Oct 09, 2014
Johannes Pfau
Oct 09, 2014
Johannes Pfau
Oct 09, 2014
Brian Schott
Oct 09, 2014
Martin Nowak
Oct 09, 2014
Brian Schott
Oct 09, 2014
Joakim
Oct 10, 2014
Walter Bright
Oct 09, 2014
Daniel Kozak
Oct 09, 2014
Sag Academy
Oct 09, 2014
monarch_dodra
Oct 10, 2014
deadalnix
Oct 09, 2014
Atila Neves
Oct 09, 2014
Martin Drašar
Oct 09, 2014
Dicebot
Oct 09, 2014
Kenji Hara
Oct 09, 2014
Sean Kelly
Oct 09, 2014
Brad Anderson
Oct 09, 2014
Jonathan M Davis
Oct 09, 2014
Gary Willoughby
Oct 10, 2014
Walter Bright
Oct 10, 2014
deadalnix
Oct 10, 2014
ketmar
Oct 10, 2014
market
Oct 10, 2014
eles
Oct 10, 2014
ketmar
Oct 10, 2014
market
Oct 10, 2014
ketmar
Oct 10, 2014
market
Oct 10, 2014
Brad Roberts
Oct 10, 2014
market
Oct 10, 2014
bearophile
Oct 10, 2014
ketmar
Oct 10, 2014
bachmeier
Oct 10, 2014
Don
Oct 10, 2014
eles
Oct 10, 2014
Jonathan M Davis
Oct 10, 2014
Martin Nowak
Oct 10, 2014
eles
Oct 10, 2014
Walter Bright
Oct 10, 2014
Iain Buclaw
Oct 10, 2014
Walter Bright
Oct 10, 2014
ketmar
Oct 10, 2014
Iain Buclaw
Oct 10, 2014
Jacob Carlborg
Oct 10, 2014
ketmar
Oct 10, 2014
Brad Anderson
Oct 10, 2014
Walter Bright
Oct 10, 2014
Brad Anderson
Oct 12, 2014
Walter Bright
Oct 12, 2014
Sean Kelly
Oct 12, 2014
Walter Bright
Oct 10, 2014
Jonathan M Davis
Oct 10, 2014
Martin Nowak
Oct 10, 2014
Yota
Oct 10, 2014
Walter Bright
Oct 11, 2014
Walter Bright
Oct 12, 2014
Marc Schütz
Oct 12, 2014
Walter Bright
Oct 12, 2014
eles
Oct 13, 2014
eles
Oct 13, 2014
Dicebot
Oct 13, 2014
deadalnix
Oct 11, 2014
Dicebot
Oct 11, 2014
monarch_dodra
Oct 11, 2014
Dicebot
Oct 11, 2014
monarch_dodra
Oct 11, 2014
Dicebot
Oct 12, 2014
Timon Gehr
Oct 11, 2014
Paolo Invernizzi
Oct 11, 2014
bachmeier
Oct 11, 2014
Dicebot
Oct 11, 2014
Brad Roberts
Oct 13, 2014
John Colvin
Oct 14, 2014
Daniel Murphy
Oct 14, 2014
John Colvin
Oct 10, 2014
Marco Leise
Oct 10, 2014
ketmar
Oct 10, 2014
Wyatt
Oct 10, 2014
Iain Buclaw
Oct 10, 2014
Daniel Murphy
Oct 10, 2014
ketmar
Oct 10, 2014
ketmar
Oct 10, 2014
ketmar
Oct 11, 2014
Martin Nowak
Oct 11, 2014
ketmar
Oct 11, 2014
ketmar gtfo
Oct 11, 2014
ketmar gtfo gtfo
Oct 11, 2014
Dicebot
Oct 11, 2014
Jonathan M Davis
Oct 11, 2014
bearophile
Oct 11, 2014
ketmar
Oct 12, 2014
Martin Nowak
Oct 12, 2014
Jonathan M Davis
Oct 12, 2014
Martin Nowak
Oct 13, 2014
deadalnix
Oct 13, 2014
deadalnix
Oct 13, 2014
Jonathan M Davis
Oct 14, 2014
Daniel Murphy
Oct 15, 2014
Regan Heath
Oct 15, 2014
Regan Heath
Oct 18, 2014
HaraldZealot
Oct 19, 2014
eles
Oct 20, 2014
Regan Heath
October 09, 2014
Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs.
It's about deprecating function qualifiers on the left hand side of a function.

So instead of
    const int foo();
you'd should write
    int foo() const;

Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();`

Would this affect your code?
Do you think it makes your code better or worse?
Is this just a pointless style change?
Anything else?

https://github.com/D-Programming-Language/dmd/pull/4043
October 09, 2014
On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:
> Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand side of a function.
>
> So instead of
>     const int foo();
> you'd should write
>     int foo() const;
>
> Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();`
>
> Would this affect your code?

No. D-Scanner's style checker yells at you when you try to do this, so I've fixed all my personal code already. These checks run as part of the CI process at EMSI and the results are uploaded to our local SonarQube server. We shouldn't have any uses of the to-be-removed syntax hiding in our code.

> Do you think it makes your code better or worse?

Better. Explaining why "const int foo" is "const(int)" and "const int foo();" is "int" is not something I enjoy doing.

> Is this just a pointless style change?

No.

> Anything else?

This will be moderately difficult to imlement in dfix.
October 09, 2014
On Thu, 09 Oct 2014 10:50:44 +0200
Martin Nowak via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

> Kenji just proposed a slightly controversial pull request so I want
> to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand side of a
> function.
> 
> So instead of
>      const int foo();
> you'd should write
>      int foo() const;
> 
> Then at some future point we could apply the left hand side
> qualifiers to the return type, e.g. `const int foo();` == `const(int)
> foo();`
> 
> Would this affect your code?
> Do you think it makes your code better or worse?
> Is this just a pointless style change?
> Anything else?
> 
> https://github.com/D-Programming-Language/dmd/pull/4043
i'm all for this. prefix function attributes are *VERY* confusing. i think this patch should be accepted as soon as possible. i'm already enjoying it. ;-)


October 09, 2014
On Thu, 9 Oct 2014 12:04:36 +0300
ketmar via Digitalmars-d <digitalmars-d@puremagic.com> wrote:

i mean there were occasional discussions in NG about irritating
"'const int bar();' is not 'const(int) bar();'" and i've seen nobody
defending prefix attributes. it was either "i don't care" or "it's
annoying".


October 09, 2014
On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:
> Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand side of a function.
I'm all for it

> Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();`
I know it's not happening anytime soon, but I'm against this second idea. This will be an extra annoyance when "porting" old D code to a new version. Just removing the currently ambiguous attribute on the left should be plenty. No need to try to mimic C in this regard.
October 09, 2014
On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:
> Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand side of a function.
>
> So instead of
>     const int foo();
> you'd should write
>     int foo() const;
>
> Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();`
>
> Would this affect your code?
> Do you think it makes your code better or worse?
> Is this just a pointless style change?
> Anything else?
>
> https://github.com/D-Programming-Language/dmd/pull/4043

Yes, yes, yes YES ! YYYEEEEEESSSSSS !
October 09, 2014
On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:
> Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand side of a function.
>
> So instead of
>     const int foo();
> you'd should write
>     int foo() const;
>
> Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();`
>
> Would this affect your code?
> Do you think it makes your code better or worse?
> Is this just a pointless style change?
> Anything else?
>
> https://github.com/D-Programming-Language/dmd/pull/4043

I'm for going ahead with that.
---
/Paolo
October 09, 2014
Martin Nowak:

> Kenji just proposed a slightly controversial pull request so I want to reach out for more people to discuss it's tradeoffs.
> It's about deprecating function qualifiers on the left hand side of a function.
>
> So instead of
>     const int foo();
> you'd should write
>     int foo() const;

+1 from me.


> Then at some future point we could apply the left hand side qualifiers to the return type, e.g. `const int foo();` == `const(int) foo();`

In this case I think it's better to focus on the most important thing first.

Bye,
bearophile
October 09, 2014
Am Thu, 09 Oct 2014 10:50:44 +0200
schrieb Martin Nowak <code@dawg.eu>:


> Would this affect your code?
Most old code, yes. I used to write all attributes on the left hand side, but switched to right hand side some time ago.

> Do you think it makes your code better or worse?
Probably better, although I tried to be careful with the left hand side attributes so it shouldn't change to much.

> Is this just a pointless style change?
> Anything else?
Code will probably look nicer, but I'm not sure if it's consistent.
with const(int) it's obvious that the return value is const. With
const int abcd() @safe
this might be less obvious.

Also fixing old code manually would be very tedious.

October 09, 2014
Am Thu, 9 Oct 2014 12:27:11 +0200
schrieb Johannes Pfau <nospam@example.com>:

> Am Thu, 09 Oct 2014 10:50:44 +0200
> schrieb Martin Nowak <code@dawg.eu>:
> 
> 
> > Would this affect your code?
> Most old code, yes. I used to write all attributes on the left hand side, but switched to right hand side some time ago.
> 
> > Do you think it makes your code better or worse?
> Probably better, although I tried to be careful with the left hand side attributes so it shouldn't change to much.
> 
> > Is this just a pointless style change?
> > Anything else?
> Code will probably look nicer, but I'm not sure if it's consistent.
> with const(int) it's obvious that the return value is const. With
> const int abcd() @safe
> this might be less obvious.
> 
> Also fixing old code manually would be very tedious.
> 

Forgot to some overall I'm for this change. I'd just like some automated way to fix old code ;-)
« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11