Thanks for pointing me to that page. Unfortunately, providing the -noindent
flag isn’t a nice option the way we have historically started off using the Scala script environment. These days the preferred tool for Scala scripts seems to be Ammonite. I will have to play with that some, though there is a certain simplicity is the command for both the REPL and running scripts being scala
. We have changed things some so that we move to sbt
projects about halfway through CS1. Once we get there, we can set up whatever flags we want, but it really is the first part of the class where we want them to also learn to work on the command line and with a basic editor like vim
that I’m most worried about.
I can talk to our system admins, but I don’t think I can get that changed. Other tools, like make
require tabs and we need one configuration to work for everything. So I expect that vim
is going to use tabs. However, cut and paste code uses spaces. So this effectively precludes using vim
nicely for Scala for any curriculum that also includes tools like make
that need tabs.
I’m pretty sure you can setup vim to have different indentation settings per language.
Google plus StackOverflow tells me that you are indeed correct. Now I get to talk to the admins about getting everyone a Scala specific setup. That should be quite feasible. I guess the first thing to do though is test it some on my own machine while I’m playing with Dotty and converting stuff over.
(In case anyone might mention that I could use the rewrite tools, I agree that I could, but when the code is for a textbook you don’t want to. I feel that I need to make the changes by hand so that I know what they were so I can pay close attention to associated changes that might be needed in the text.)
Although the recent question was about the specific tool vim, it could be generalized to “will you be able to edit any Scala code/file with any text editor without having to convert spaces into tabs or vice versa in order to have it compile”.
On a subjective note, having to set up a tool in a specific way to make it work with a new programming language I was learning would disencourage me pretty quickly, especially if said tool was something as plain as a text editor. (This is not an argument against the “quiet syntax” per se, I like that, but I also like that things “just work”.)
Which editors make tabs vs spaces easier to see? (I’m sympathizing with students and their teachers.)
Geoff Knauth (mobile)
Many editors have an option to show whitespace, either natively or as a plugin. I know for a fact sublime and vscode do, I suspect many others as well.
I was about to say that leaving these on all the time makes the display noisy, then I popped up VS Code and decided to look into it. It turns out that I already had it set to display whitespace, but in the default color settings, it is dim enough that not only is it not noisy, I hadn’t even noticed it was there. This is also partly because I tend to use a rather small font on my 4K monitor. There is a nice menu option for turning it on and off as well.
This has been a productive discussion for me. Thank you all for your input. While I’m not converted to liking meaningful whitespace, I do think this has convinced me that I can get our tools to work with it well enough that it won’t cause too many headaches for our students.
Probably kicking in an open door, but in doubt, when using vim, set the vi list
option and you will actually see the tab chars displayed as ^I
(: set list
)
Yeah, Google showed me that and then set nolist
because the way vi shows whitespace gets annoying.