Have "." be syntactic sugar for "this." #848
Replies: 10 comments
-
@victorcassel What some of us do is prefix fields with an underscore, I don't know whether shortening I said it before but I think people confuse readable with terser code. |
Beta Was this translation helpful? Give feedback.
-
Why not just omit |
Beta Was this translation helpful? Give feedback.
-
This might block other proposed syntax that starts things with |
Beta Was this translation helpful? Give feedback.
-
Probably First discuss and analyse the phenomenon from the user perspective, later from the language implementer perspective. |
Beta Was this translation helpful? Give feedback.
-
But there are also people who prefer to have Making code shorter != making code more readable. If it were, you might as well remove half the letters from your function names. |
Beta Was this translation helpful? Give feedback.
-
@Joe4evr There's real science behind readability, whether talking about code or regular prose. At the risk of over generalising, additional words take longer to read - as do misspelled ones. |
Beta Was this translation helpful? Give feedback.
-
@theunrepentantgeek What you say seems be a good argument against |
Beta Was this translation helpful? Give feedback.
-
Generally, I'm in favour of removing In my experience, the rarity of |
Beta Was this translation helpful? Give feedback.
-
Beside readability, You do need "this" keywords to filter the intellisense list while typing, especially when you have many imported namespaces, the "." suggestion is not readable, and will bother you if you are typing and missing a semicolon in the previous line. |
Beta Was this translation helpful? Give feedback.
-
You need this. to invoke an extension method on the current instance, so if you remove it, you need to use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It is not rare to see
this.
in source code, although it is not needed.Maybe there is a reason! It brings some readability/understandability when you immediately see that a call to the current object is going on...
So I suggest
.
to be an allowed short form ofthis.
(I know you can write .5 instead of 0.5 which could be a problem)
Beta Was this translation helpful? Give feedback.
All reactions