Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Tabs in identifiers
I propose we allow tabs in identifiers. This can be used to make identifiers that are directly copied from Excel files. (Copying from multiple cells produce tabs.)
The existing way of approaching this problem in F# is having to replace tabs with spaces.
Pros and Cons
The advantages of making this adjustment to F# are
The disadvantage of making this adjustment to F# is a more complicated checker for tabs in the compiler.
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
Many editors convert tabs to spaces, and even if your editor doesn't, your colleagues could end up with errors because they get converted.
Conversely, if you really must copy and paste from Excell (I don't see why that should be a requirement, the same argument could be used for any other program out there), if you do convert tabs to spaces, you would already have fixed it.
But honestly, consecutive blanks, and tabs specifically, are notoriously hard to read (you cannot distinguish a single space from a tab that indents one), unless you have visible spaces switched on. I'd argue you're better off with the current stricter rule.
Btw, nothing stops you from writing a relatively simple add in that hooks on the paste action, which is perhaps a better way to tackle issues related to importing stuff from external applications.
Tabs are contextual, meaning that it changes shape according to its position.
Assume tab stop=8:
I'm not sure what 'invalid unicode characters' you're referring to, example?
In your example you did not use invalid Unicode characters. The editor replaced the invalid Unicode character with the Replacement Character, see https://en.m.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character, which is valid (if you doubt this, check your saved file with a hex editor and check the UTF-8 encodings).
As for why they are special, I tried to summarize that in my first comment. We can disagree on the usefulness but the tab vs spaces discussion was decided in the early days of F# in favor of spaces and I doubt they would make an exception. Even more so because it would create code that looks different in different editors.
Just (auto) replace them with spaces and you should be fine. This post, while for C#, shows some ideas how to use EditorConfig extensions, perhaps you can have it apply to F# just as well: https://www.hanselman.com/blog/TabsVsSpacesAPeacefulResolutionWithEditorConfigInVisualStudioPlusNETExtensions.aspx