New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional Python-like formatting option in compiler #9512
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9512?orig=1 |
@SethTisue said: |
John Reed (JohnReedlol) said: |
@soc said (edited on Oct 10, 2015 8:35:49 PM UTC): From the docs: bq. Notably, the fact that Scalite only special-cases lines which do not end in a { means that old-fashioned curly-brace Scala continues to function perfectly fine, and can be mixed together with Scalite code in the same source files and still compile without issue. |
@SethTisue said: does Scalite have users? I'm not sure how much demand there is for something like this. Haskell is an example of a language that supports both an indentation-based and curly-braces-based syntax. the former is defined in terms of the latter, but everyone uses the former, so the curly-braces syntax is more akin to an implementation detail. in Scala-land, the chances of getting the entire community, or even a significant portion of it, to switch to an indentation-based syntax seems slight, so it seems fine to me to let Scalite continue to exist as a third-party project, and then we can wait and see how much support and momentum builds behind it. (so far, not very much.) |
@SethTisue said: |
@soc said: |
John Reed (JohnReedlol) said: So basically this implementation of Python/Haskell whitespace formatting is not ready for use with the IDE that has the best Scala support, which is why I will never use it. That being said, the no-braces look of Python/Haskell is generally considered to be better than that of curly braces and paren heavy languages. I don't think that having the option to either leave in or omit the curly braces would be a big inconvenience to coders. Sure there might be a transition period in which there are some .scala files with curly braces around classes/methods and some without it, but that does not undermine the fact that the white space formatted code is more legible. My hunch is that the main reason that white space formatted code is so much less common than curly braces is just because curly braces are easier to implement and have legacy in C. But I will start a debate over to whitespace format or not to whitespace on some other website and hopefully enough people will like the idea that someone will implement it officially (with a release announcement and support from/on major IDE's and what not). Thank you. |
@SethTisue said: |
Martin Mauch (martin.mauch) said:
I don't think that taking the number of Scalite users as an indicator for desirability of this is a fair assessment, because as I mentioned currently your choice is "ordinary Scala syntax + IDE and many tools" vs. "Scalite syntax - IDE and many tools". So IMO, it would be great to track how many users share the same opinion/desire (given tooling support were given for the indentation syntax) somewhere. |
@SethTisue said: |
Now that Dotty gave scala/scala3#2491 a shot and closed, I vote to close this issue. |
As a novice programmer, I noticed that from a distance, Python code is easier to read than Scala code, even when they contain similar content. I would like to have the option to compile Scala code with Python formatting using a compile option that specifies the number of white spaces to use for indentation.
Example: "scalac -nobrace 2 Main.scala"
^ For compiling scala code with no curly braces and 2 space indent ^
If it were possible to implement such a feature in the compiler I would appreciate the improvement in legibility.
The text was updated successfully, but these errors were encountered: