October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johannes Pfau | On Thursday, 9 October 2014 at 10:29:46 UTC, Johannes Pfau wrote: > Forgot to some overall I'm for this change. I'd just like some > automated way to fix old code ;-) I said that I wouldn't write dfix until Walter was willing to start getting rid of old syntax. Not long after that Walter made this https://github.com/D-Programming-Language/dmd/pull/4021 dfix is under development. You can find it here: https://github.com/Hackerpilot/dfix |
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | V Thu, 09 Oct 2014 10:50:44 +0200 Martin Nowak via Digitalmars-d <digitalmars-d@puremagic.com> napsáno: > 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? Yes (but I am ok with that) > Do you think it makes your code better or worse? Definitely better > Is this just a pointless style change? No > Anything else? Merge this ASAP, please :) |
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:> > Would this affect your code? no > Do you think it makes your code better or worse? no change, my code already looks like that > Is this just a pointless style change? no, left hand side function qualifier is just wrong IMO. > Anything else? Thank you guys |
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | On Thursday, 9 October 2014 at 11:24:08 UTC, Robert burner
Schadek wrote:
> On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote:>
>> Would this affect your code?
> no
>> Do you think it makes your code better or worse?
>
> no change, my code already looks like that
>
>> Is this just a pointless style change?
>
> no, left hand side function qualifier is just wrong IMO.
>
>> Anything else?
>
> Thank you guys
mostly welcome
|
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Schott | On 10/09/2014 01:10 PM, Brian Schott wrote:
> dfix is under development. You can find it here:
> https://github.com/Hackerpilot/dfix
That would make such decisions much easier :).
It doesn't appear to rewrite AST but only tokens at the moment.
How reliable is it?
|
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote: > Would this affect your code? I've written code before in the style: @property pure nothrow const //<- HERE int foo(); So anybody else using this style might be affected. But even then, I agree. D has always been about "if it's ambiguous, dangerous, and can be avoided, don't make it fucking legal". > Do you think it makes your code better or worse? > Is this just a pointless style change? > Anything else? I'm not really sure about the: "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 don't think it buys us anything, except maybe silently changing semantics of code that hibernated through the deprecation process. I mean, sure, it might be a little surprising, but it's not the end of the world. |
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Thursday, 9 October 2014 at 08:50:52 UTC, Martin Nowak wrote: > Would this affect your code? No, I always wrote it on the right. > Do you think it makes your code better or worse? Better. > Is this just a pointless style change? No, removing confusing style is good. |
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | This pull request is a good thing (TM). +1 all the way.
Atila
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
|
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak Attachments:
| Dne 9.10.2014 v 10:50 Martin Nowak via Digitalmars-d napsal(a): > Would this affect your code? yes, but I understand the rationale so I don't mind > Do you think it makes your code better or worse? less ambiguous, so I would say better > Is this just a pointless style change? no -- Martin |
October 09, 2014 Re: Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | 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; Finally. > Would this affect your code? Yes, eventually, but I am willing to make the change and it is trivial compared to some other D2 migration related things :) > Do you think it makes your code better or worse? > Is this just a pointless style change? I believe it is much less error-prone, prefix notation is currently a common cause of mis-interpretation from the reader. |
Copyright © 1999-2021 by the D Language Foundation