I'm just learning about F# and plan to use it for my next project. One thing I find immediately confusing is the lack of support for tab characters in .fs files. I love how indentation is used to show s开发者_如何学Pythoncope/hierarchy, but using spaces just seems so antiquated. Do I have to press backspace four times just to get back to the parent block? What happens if I accidentally hit backspace only three times but don't notice it and keep typing?
If you're using VS2010, then pressing "tab" will indent four spaces, and subsequently, pressing "backspace" will also "do the right thing" for you. (I expect that some other text editors also have this feature, or at least you can configure them to do so.) If you do happen to get the wrong indent, then you're like to get error/warning squiggles as quick feedback in the VS editor.
If you're using a professional version of Visual Studio 2010, then I recommend using Column Guides from the Pro Power Tools extension. Watch this video
http://msdn.microsoft.com/en-us/fsharp/ff742849.aspx
(specifically, about two-and-a-half minutes, starting at about 2:05) to see how to use Column Guides to make F# indentation easier to discern.
If there's no other option to make this easier, you can turn on visible whitespace in Studio with Control + E, Control + S.
精彩评论