Added: C# Language Design Notes for Mar 15, 2017 #639
Replies: 18 comments
-
Your link doesn't work :) |
Beta Was this translation helpful? Give feedback.
-
Why the decision against JSON literals? I use JSON quite a lot in C# .... |
Beta Was this translation helpful? Give feedback.
-
We didn't think it would be worth it. The burden of using newtonsoft.json is very low. |
Beta Was this translation helpful? Give feedback.
-
@CyrusNajmabadi Well, you are right, but maybe consider the possibility of 'easily' adding new language literals by somehow providing a lexer- and compiler-interface, even if the LDT does not think it adequate to due to the effort/gain-releationship..... (quite understandably!) |
Beta Was this translation helpful? Give feedback.
-
We've certainly considered it. But we don't think it's appropriate. For one thing, it means making changes in the language now always risks colliding with someone's extension. For another, even if we did supply that, it would just be the tip of the iceberg. Getting things like debugging, refactoring, intellisense, etc. working properly would take a lot of time and effort. |
Beta Was this translation helpful? Give feedback.
-
So you guys are treading back on dotnet/roslyn#117 ? 😆 |
Beta Was this translation helpful? Give feedback.
-
I can't find any JSON literal proposal but I would be concerned about tying it to a specific JSON library anyway. |
Beta Was this translation helpful? Give feedback.
-
Their decision was "No" anyway, so it doesn't matter. |
Beta Was this translation helpful? Give feedback.
-
May I ask what the outcome of the "Deconstruction in lambda parameters" discussion was? |
Beta Was this translation helpful? Give feedback.
-
@CyrusNajmabadi Well, it was nice if C# had something that is between attributes and comments for annotations and yet allow to just copy/paste a block of whatever language and the productivity tool would then take over it and offer the tools to handle it, R# is doing it but it uses comments and attributes and they weren't really designed for it. So I agree with your decision to rule out JSON but at least consider generic approach in the form of annotations/hints to allow vendors to offer the tooling where you can't, this was discussed here in the form of attributes everywhere. I wonder what's your thoughts about it and whether you guys considered it. |
Beta Was this translation helpful? Give feedback.
-
@eyalsk You can use an #if block as well.
What would it mean to be "designed for it"? As mentioned above, these section would not be c#, and so would not be touched by any of the rest of C#'s tooling. It seems we already have that with things #if's. You could even have some sort of #pragma for this sort of thing (suppressing the warnings since you'd be handling these pragmas yourself).
I don't know that this means :) I think the problem here is that the idea is fine and nice and lofty: You just let languages 'plug in' to the experience. The problem is that the nitty gritty details of how that works is super hard. To give you an idea, we have something akin to this in VS with ASP + C#. You can embed C# in ASP in a myriad of different ways. i.e. Just creating this system has been an absolutely staggering amount of work, and is a non-stop bug farm. That's a controlled case where we own every part of this stack, and it's an enormous undertaking. Trying to get the same in a flexible, open-ended manner for anyone to plug in is just not something we can commit to. |
Beta Was this translation helpful? Give feedback.
-
We can't use attributes everywhere whereas with comments we can but they don't standout as attributes in the code, one can easily delete them without realizing a 3rd-party tool actually uses these comments to have enhanced productivity support. Attributes has one more "pitfall" they are part of the output whereas comments aren't so what we're asking here is to have something between attributes and comments.
Nop, this isn't the case at all, I'm not asking to embed one language within another. I'll just copy/paste my example from the other post. Just as an example for how R# language injection might look like with this:
Alternatively:
R# would then recognize the annotation and would offer HTML intellisense the way it does today with attributes and/or comments but annotations would be the best of both world without the "pitfalls". I hope it make sense, if not, just tell me and I'll elaborate further on this. :) |
Beta Was this translation helpful? Give feedback.
-
I don't see why you couldn't just accomplish that with a comment with special syntax you look for. i.e. The reason i ask is that if we were to provide this, we would just be creating it with a new comment type with some special syntax. If that's the case, why not just use what's already here and just pick something reasonable and not have to update anything at all? Best part, your code will be backward compatible with every C# compiler ever. |
Beta Was this translation helpful? Give feedback.
-
@eyalsk Why not string x = Annotations.Html(@"<html></html>"); |
Beta Was this translation helpful? Give feedback.
-
@CyrusNajmabadi Sure I'd take that, I don't mind the syntax as long as the language define this as a special kind of comment and at the syntax tree it would show up as something else other than a comment something like AnnotationCommentTrivia or whatever. @qrli Because this means you have to reference some library which is exactly what you don't want, you don't want annotations to be part of the application you ship but you still want them to standout at the source code level as hints. |
Beta Was this translation helpful? Give feedback.
-
@eyalsk But R# is already doing that, by providing source of lots of custom attribute classes (e.g. [NotNull]) to be included in your project. And you have to use them to enable the advanced analysis features. |
Beta Was this translation helpful? Give feedback.
-
@qrli R# is doing it because that's the best way to do it atm but if there was a "better" way or a way that fits more to the task then over time JetBrains would probably switch over to annotations or whatever it might get called simply because you can put them anywhere and you don't have to reference anything... |
Beta Was this translation helpful? Give feedback.
-
C# Language Design Notes for Mar 15, 2017
Triage of championed features
Please discuss.
Beta Was this translation helpful? Give feedback.
All reactions