On Thu, 17 Jul 2014 14:03:06 -0700, Walter Bright wrote: > On 7/17/2014 1:44 PM, Justin Whear wrote: >> On Thu, 17 Jul 2014 12:28:33 -0700, Andrei Alexandrescu wrote: >> >>> On 7/8/14, 2:31 PM, Brian Schott wrote: >>>> http://wiki.dlang.org/DIP65 >>>> >>>> tldr: There are parser and specification bugs and I want to fix them. >>>> It will break some poorly-written code, but I think I can automate >>>> the upgrade process. >>> >>> I vote we reject this DIP. It has clear appeal but there's also the >>> issue with putting currently correct code on a deprecation path, with >>> no obvious win in quality. >>> >>> I think Walter's fix eliminates the problem during the semantic pass >>> even though there's a grammar ambiguity. It's a judgment call, and by >>> definition someone has to make it. >>> >>> >>> Andrei >> >> My understanding (and this is supported by hard numbers from Brian's >> survey of Phobos), is that Walter's proposal will perpetuate a bad >> design choice that is rarely if ever used (never in Phobos) in favor of >> deprecating a better syntax that is used (in Phobos and elsewhere). >> >> That is to say, we have hard numbers to prove that Walter's fix will >> deprecate currently working code while leaving us with the >> less-desirable syntax, while Brian's proposal will transition us to the >> more desirable syntax without breaking code written in the currently >> used idiom. >> >> And, as Brian pointed out[1], the current idiom of `catch (Throwable)` >> _is described_ in the spec, albeit not in the formal grammar. Ergo, >> Walter's fix also deprecates currently-working, correct syntax. Given >> that both are correct, but one is nearly completely unused and error >> prone, I vote yes on this DIP. >> >> [1] http://forum.dlang.org/thread/[email protected]? >> page=2#post-zsvbxhtbwevsrrflxzyr:40forum.dlang.org >> >> > Did you see my response? > > I suggested recognizing in the parser: > > ( Identifier ) > > as a special case, in addition to using Parser::isDeclaration(). > Gradually we can turn that special case into a warning, then > deprecation.
Yes, this confuses me. You are suggesting that we add special casing to the compiler to recognize syntax that _currently works_ so that we can then gradually deprecate it. More confusing to me is why you are choosing to deprecate the correct, often-used syntax and retain the correct, rarely-used syntax. I'm trying to see the motivation for your proposal when it will likely break more code (if the warning, deprecation path is followed) than Brian's and result in a less-desirable catch-all syntax. The reason I decided to weigh in on this thread in the first place is it seemed that you and Brian were talking past each other, and I'm wondering if that is still happening. So to lay it out, my understanding is that DIP65 proposes: 1) Fixing the grammar to accurately the _current_ state of the parser and spec, i.e. `catch (Throwable)`. This syntax is used in Phobos. Brian should update the DIP under "Rationale" such that bullet 1 goes from: "Exceptions are not required to have names by the compiler (The language specification requires names)" to read "Exceptions are not required to have names by the compiler or spec, but the grammar does require it." 2) Warning, then deprecating the LastCatch syntax. This syntax is not used in Phobos. All LastCatches can be simply and mechanically replaced with `catch (Throwable)`. Now obviously Phobos is not necessarily representative of all user code, but I think that going from less-specific to more specific (e.g. do you want to catch all Exceptions? Or all Throwables?) is better for the language. Given that it's a completely mechanical change, if something is going to be deprecated it should be the less used, less preferable syntax.
