Replies: 17 comments
-
@333fred I think you're doing a great job with the meeting notes! Keep up the good work! 🎉 🍻 |
Beta Was this translation helpful? Give feedback.
-
As long as we ignore the triaged issue I forgot to add to the list (now pushed and triaged correctly). |
Beta Was this translation helpful? Give feedback.
-
I don't understand why trailing space in format specifier proposal was rejected. Look at this code:
Why is definition of |
Beta Was this translation helpful? Give feedback.
-
As mentioned in the notes the tricky thing is that while whitespace is trivial in the expression itself, it's not trivial as a part of the format specifier. The presence or absence of trailing whitespace almost certainly will cause the format specifier to be interpreted differently. It's not obvious that the compiler should trim that trailing whitespace. |
Beta Was this translation helpful? Give feedback.
-
the format specifier in
The ambiguity is that with the whitespace it is unclear if it should execute as
or
|
Beta Was this translation helpful? Give feedback.
-
Blanks within and/or before are considered part of the format specifier .. using System;
using static System.Console;
public class C {
public static void Main() {
var a = new DateTime();
WriteLine ($"1: '{{ a:yyyy-MMM-dd}}' => '{ a:yyyy-MMM-dd}'");
WriteLine ($"2: '{{ a:yyyy MMM dd}}' => '{ a:yyyy MMM dd}'"); // blanks between date parts
WriteLine ($"3: '{{ a: yyyy MMM dd}}' => '{ a: yyyy MMM dd}'"); // + blank before date
}
} .. prints ..
.. so it would be quite surprising, if a trailing blank would not be part of the format specifier. That means, if trailing blanks would be allowed in a future C#, those blanks should be considered part of the format specifier, and not as white space between format specifier and the closing brace Expressions in parenthesis bool b = true;
WriteLine ($"4: '{{(b ? 'T' : 'F')}}' => '{(b ? 'T' : 'F')}'");
WriteLine ($"5: '{{ (b ? 'T' : 'F') }}' => '{ (b ? 'T' : 'F') }'"); .. which prints ..
Unfortunately, that does not work for your original problem .. WriteLine ($"6: '{{ (a:yyyy-MMM-dd) }}' ?=> '{ (a:yyyy-MMM-dd) }'"); .. does not compile ..
|
Beta Was this translation helpful? Give feedback.
-
Yup. this was the exact issue. Indeed, when this came to the LDM the person presenting it said that if the user wrote i.e. you had So we had no design that we felt made sense, so we outright rejected this. |
Beta Was this translation helpful? Give feedback.
-
Note: this is because of a stylistic choice on your part, combined with usign a part of the language that is not whitespace sensitive and a part of it that is whitespace sensitive. C'est la vie. |
Beta Was this translation helpful? Give feedback.
-
I see records is listed as merged. Did you guys finish the design work on it? It seemed like the last time it was discussed there were quite a few open issues remaining (including what the keyword would be called!) I'm also particularly interested in what you're going to do with |
Beta Was this translation helpful? Give feedback.
-
We've been keeping the speclet up to date: https://github.com/dotnet/csharplang/blob/master/proposals/records.md |
Beta Was this translation helpful? Give feedback.
-
Hmm, disappointed to see the Will there be another preview before shipping? |
Beta Was this translation helpful? Give feedback.
-
I don't see any feedback that changes our evaluation of the scenario. in other words, the concerns people raised were all things that were raised while we were discussing the options. We considered the pros/cons here, and ended up feeling that hte cons were minor and that we preferred the design that we ended up with. |
Beta Was this translation helpful? Give feedback.
-
I understand design decisions about format specifier and the reasons why it's not possible to preserve trailing spaces. Thank you for letting me know. Just FYI this is not annoying just me but a whole company I am working in because trailing spaces in string interpolations are in our code style best practices. It makes sense to create error for ALL trailing spaces in string interpolation or for NONE of them. The current situation when it's disabled only in very specific case when we use format specifier is weird. The fact that Please consider at least not offering IDE_0071 if applying this fix would result in removing trailing space from string interpolation. I currently don't have option to have |
Beta Was this translation helpful? Give feedback.
-
Or set it to:
(It doesn't appear in the docs it seems, see dotnet/roslyn#42695) |
Beta Was this translation helpful? Give feedback.
-
This is exactly what I don't like about current .editorconfig situation. It's undocumented and it's pain to actually set what is needed (Suppress and Configure issues doesn't work for me quite often and doesn't modify .editorconfig at all). Wouldn't it be better to just be able to type "IDE_0071 = true:none" to .editorconfig instead of some fancy name which no one remembers. When I know exact code of issue I need to suppress I need to look for this fancy modifier just to be able to suppress it which is a pain. Those codes are well documented and I don't see why .editorconfig team felt need to create another identifiers which aren't documented anywhere and also are too long to remember. Anyway thankts a lot for letting me know about this although it's not in docs or at least I wasn't able to find it. |
Beta Was this translation helpful? Give feedback.
-
Sounds like there's work to do there, then.
I didn't know until about 40 minutes ago, when I asked VS and it told me what to use, see my screenshot above.
You can write this:
See this prominent note here, which links here (and dotnet/roslyn#35690). |
Beta Was this translation helpful? Give feedback.
-
https://github.com/dotnet/csharplang/blob/master/meetings/2020/LDM-2020-07-13.md
Agenda:
Beta Was this translation helpful? Give feedback.
All reactions