[Proposal] Single line using namespace #3590
Replies: 15 comments
-
A similar proposal: #1696. |
Beta Was this translation helpful? Give feedback.
-
Looks similar, but nobody proposed to use just a single-line comma-separated list |
Beta Was this translation helpful? Give feedback.
-
It's very easy to visually parse a vertical list, even one that doesn't fit on the screen. A horizontal one--especially comma separated--not so much. It would also very likely require horizontal scrolling to see the entire list especially if there's more than just a couple which by your own admission is the reason you want the feature. If there's one thing I absolutely hate when I'm reading code it's anything that requires me to scroll to the right (and inevitably back to the left). While it's not difficult to split a list on commas, consider that tooling needs to constantly do this while you type. The compiler is already recognizing the semicolon to indicate the end of the statement--it would now need a new mode that has to constantly search for and then split on commas. It may not seem like much but it could potentially cause performance concerns on the tooling side. If you don't like the amount of space it takes up, you're free to wrap it in a |
Beta Was this translation helpful? Give feedback.
-
Yes, I agree with you about horizontal scrolling. |
Beta Was this translation helpful? Give feedback.
-
Sounds like you need a better editor then. I'm not aware of a modern editor that doesn't support collapsing either natively or via a plugin/extension. That include notepad++ and VS Code. I'm not a personal fan of regions but it's a solution to the problem that doesn't involve updating the language. Unless you're using regular notepad or a terminal based editor it should be readily available and is one reason I assume this proposal is likely to be rejected. |
Beta Was this translation helpful? Give feedback.
-
Regarding using in terminal editors - yes, I use them. Just since started using .Net Core on embedded Linux. And I am aware about vertical scrolling the same as about horizontal scrolling. And when I use Python I am happy that I can sometimes write
instead of
even if it goes against Python Style Guide. |
Beta Was this translation helpful? Give feedback.
-
I mean if you're goal is just to put it on one line you can just do this? using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows; Just pretend that |
Beta Was this translation helpful? Give feedback.
-
is not the same as
So no, thanks. |
Beta Was this translation helpful? Give feedback.
-
I don't think that's the goal of the language. You originally wanted a one-liner solution, now you want a more terse format. I don't think theres much value add in saving 6 characters to add some new syntax that people are rarely going to use. I rarely manually modify my usings. I let visual studio/code add them as I need them and then I use cleanup tools to sort and remove the unnecessary using statements. Yes, there have been cases where the language team has added new syntax to save characters, but they need to be in an area where the verbosity was painful and not having it seemed unwieldy. But rarely was it for a saving of 6 characters in an area of code that most people gloss right over. |
Beta Was this translation helpful? Give feedback.
-
We do care about brevity, but for the 'meat' of code. i.e the stuff you're editing non-stop 98% of your day. So, things like statements/expressions, and the stuff within class/method bodies. I actually don't know the last time i ever manually touched a |
Beta Was this translation helpful? Give feedback.
-
is that real? how? because if you just create a new project then the "vs" automatically add a list of using for your main file, and the GitHub is full of "using", but however. 'vb.net
Imports System, System.IO, System.Collections but I don't know why they ain't to do that, I think they don't like the vb |
Beta Was this translation helpful? Give feedback.
-
Right. But i never touch that list myself. I do things like "add using" when i reference a new type. Or i say "cleanup code" and VS removes the usings i'm not using anymore. I don't need to ever edit that code myself. -- Finally, please keep your conduct professional here. |
Beta Was this translation helpful? Give feedback.
-
I did.
this feature is important to me but i don't fight for that, the reason is you at last telling its not valueable. |
Beta Was this translation helpful? Give feedback.
-
Posting pictures like that is not professional and does nothing to aid discourse here. Please don't do that. |
Beta Was this translation helpful? Give feedback.
-
I think you need to recognize how csharplang works. When people create proposals, it will be discussed. Views will be shared, and community, team and LDM members will provide their own inputs on how to assess the proposals. Those inputs may absolutely not align with yours. That doesn't make the input non-valuable. It means you get to see the opinions and views of others to get a better sense of the space here and how people think about it. In this case, i'm sharing my perspective (both as a team and LDM member) of why i don't think this is an important space to focus on. |
Beta Was this translation helpful? Give feedback.
-
Hi.
What about add ability to write namespace using in single line separated by comma?
Now:
Proposed:
The reason to for this is to decrease the header size of the file. Sometimes file begins with a lot of lines of "using ...".
Beta Was this translation helpful? Give feedback.
All reactions