[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 ponce changed: What|Removed |Added Component|phobos |visuald --- Comment #12 from ponce --- Changelog wasn't updated in the end it seems: https://github.com/dlang/dmd/pull/15030 --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 ponce changed: What|Removed |Added Component|dmd |phobos --- Comment #11 from ponce --- > If a library writer uses the newest fanciest features, Well in this case there is no warning that one might use a newer feature, it certainly happens without my awareness. --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #10 from ponce --- It's surprising to me because it seems nothing hints at this rule changing (not even in spec). The new rules are cool and all, and it's easy to see named arguments will hugely improve readability. It's just that if you're not aware of them changing because following D from even a tiny distance, you can miss the changes completely. Are there other changes like this? How can I get up to speed? Under the release changelog, I'm struggling to find a point where this has changed ("if you write code in the new way, then it's breaking old compilers") can be seen. --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #9 from Basile-z --- sorry about my previous comments, they were more about the general semantics of "default arguments" but you're right, D specs are the reference here. --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #8 from RazvanN --- (In reply to ponce from comment #6) > By spec: > https://dlang.org/spec/function.html#function-default-args > > > > Default parameters are resolved and semantically checked in the context of > > the function declaration. > > and later > > > If the default value for a parameter is given, all following parameters > > must also have default values. > > > Pretty much a bug then? The spec needs to be updated. --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 RazvanN changed: What|Removed |Added CC||razvan.nitu1...@gmail.com --- Comment #7 from RazvanN --- Yes, this is an intended change as per the named arguments dip: https://github.com/dlang/DIPs/blob/15537f9b36afa48f1c1cd57468e8c77f8f2499dd/DIPs/DIP1030.md . I don't see how this change breaks any existing code. Old code works as it used to work under the newer compiler versions, whereas new code may be written to take advantage of named parameters. The situation that was invoked: "In practice, what we've had is that code that is produced by people after that change, break build of those that use earlier compilers." is true for any other compiler addition. If a library writer uses the newest fanciest features, then it is expected that the users of the said library need to use newer versions of the compiler. > It's a breaking change that I feel we could warn about, since it seems named > arguments aren't already there? How would a warning help here since the code is not going to compile anyway? I don't really see anything actionable for this bug report. --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #6 from ponce --- By spec: https://dlang.org/spec/function.html#function-default-args > Default parameters are resolved and semantically checked in the context of > the function declaration. and later > If the default value for a parameter is given, all following parameters must > also have default values. Pretty much a bug then? --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #5 from ponce --- It used to be illegal to have default values for arguments not at the end, making this legal is unexpected (and creates issues like this). --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #4 from ponce --- Oh this is a voluntary change? In practice, what we've had is that code that is produced by people after that change, break build of those that use earlier compilers. It's a breaking change that I feel we could warn about, since it seems named arguments aren't already there? --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #3 from Basile-z --- hence that would not be a bug after all ? --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 Basile-z changed: What|Removed |Added CC||b2.t...@gmx.com --- Comment #2 from Basile-z --- That does not compile if called without the second arg however lookup_decoding(1); I suppose this bug is related to named arg handling ? --
[Issue 24241] Uncaught Default argument error
https://issues.dlang.org/show_bug.cgi?id=24241 --- Comment #1 from ponce --- Created attachment 1900 --> https://issues.dlang.org/attachment.cgi?id=1900=edit Repro screenshot --