Allow trailing semicolons at the end of property declarations #8195
Replies: 4 comments 27 replies
-
The build doesn't crash here. An error is given stating you have a superfluous token. We'd need to update the grammar here to allow this, and that would need a compelling argument as to why to allow this. |
Beta Was this translation helpful? Give feedback.
-
yes. the grammar defines teh syntactic rules of the language. And having our compiler not deviate from those rules is something we consider very important. This ensures consistency among users about how to read/write C#, and it means we don't introduce deviations into our compiler that then potentially interfere with future language changes.
Deleting hte extra semicolon seems pretty simple and cheap to do. What is causing the extra semicolons in the first place? What other extraneous tokens do you have when prototyping?
It's illegal syntax. Like with all extra tokens or missing tokens, we can guess what you might have meant, but we really have no idea. And since we don't know, we fail (like every other mainstream compiler out there). |
Beta Was this translation helpful? Give feedback.
-
It's not to 'save space'. It is simply that we have grammar rules. And if one wants those grammar rules to encompass more token sequences, then the grammar needs to be updated accordingly. The spec also needs to then say what the impact of that extra token is (even to say that it is ignored). the reason we don't normally do this is simply that it adds excess to the language, compiler, and all higher tooling that in practice doesn't make things substantively better for users. We generally only want this sort of syntactic flexibility if there is a big win for users. For example, there are compelling cases to be made about allowing trailing commas in lists, due to users have something like: x1,
x2,
x3,
x4, And wanting to be able to reorder those easily by just moving lines around. If the last comma is not allowed, this becomes more annoying. This is at least something we can identify as something a large set of users do and find value in, and so we allow this sort of extra, technically not necessary token. However, there an infinite number of extraneous tokens people could place anywhere. adding support for everything is not viable. So we add hte support where there is a compelling case for it, and there is a clear indication a lot of people would be helped out. That is not the case here afaict. |
Beta Was this translation helpful? Give feedback.
-
I'm locking this at this point. Both in discord and here there appears to be no attempt to provide any sort of justification for this feature. Furthermore, the op doesn't seem interested in understanding the design process or the critiques levied against this. This conversation seems to have run its course and no efforts are being made to substantively engage here. More time has been spent arguing there and here than the ecosystem would ever will back in time spent on this proposal. @irvnriir I recommend for future proposals that you be more willing to accept that a feature needs to be more valuable to us than just helping you so you can avoid a single char mistake. Think broadly about the millions of other users out there and whether or not this will meaningfully affect them. If so, be prepared to argue and demonstrate why that is. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Can CS1597 be removed? Why saving space of 1 per hundreds of chars in expense of simplicity and even consistency, is enforced?
Is there any functional reason for it?
When writing alot, or prototyping, i get builds failing because of this. And as far i see, it has no functional purpose.
Even if it isn't needed for the lang, it could be added as a warning, but why in a world its a compilation error so can't even be disabled user-side?
Beta Was this translation helpful? Give feedback.
All reactions