Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 11 15:33:12 PDT 2014


On Saturday, October 11, 2014 14:47:55 Martin Nowak via Digitalmars-d wrote:
> https://github.com/D-Programming-Language/dmd/pull/4043#issuecomment-5874835
> 3
>
> There has been a broad support for this on the newsgroup discussion
> because this regularly confuses beginners.
> There are also some arguments against it (particularly by Walter) saying
> that this change will put too much work on D code owners.
>
> Let's continue with the following steps.
> - add RHS/LHS function qualifiers to D's style guide
> - change all code formatting (like dmd's headergen and ddoc to use RHS
> qualifiers)
> - help Brian to get dfix up and running
> (https://github.com/Hackerpilot/dfix/issues/1)
>
> Then we might revisit the topic in 6 month and see whether we have
> better arguments now.

This has been being brought up for years. I wouldn't expect 6 months to change
anything. If we want to delay it until dmd's headergen and ddoc are fixed and
put a note in the changelog on the next release that it's going to be
deprecated rather than deprecating it immediately, we can do that, but I don't
think for a second that the arguments are going to change. Many of us have
been complaining about this for years, and it's primarily been Walter who
hasn't wanted it on the grounds that it's more consistent as it is (which I
strongly dispute). As far as I can tell, Walter is the only real obstacle to
this. Almost no one else ever seems to think that having const function
modifiers on the left is a good idea. And now that someone has finally
implemented the change, I really think that we need to get it merged.

Honestly, I think that delaying making the change just increases how much harm
the problem is causing, because it's around that much longer, confusing that
many more folks. As far as popular opinion goes, it's quite clear that almost
everyone posting here thinks that it should be changed. The only one who seems
to really need to be convinced is Walter, and apparently, no one knows how to
do that.

I can see delaying making the changes until the dmd headergen is fixed being
needed so that the compiler isn't generating code that it then prints a
deprecation message for, and it would be nice if the ddoc generation were
fixed ASAP as well, but if that's the case, I think that that just means that
those should be fixed ASAP so that const function qualifiers on the left can
be deprecated ASAP. I see no need to continue to discuss whether we should do
this beyond someone miraculously coming up with a way to convince Walter.

- Jonathan M Davis



More information about the Digitalmars-d mailing list