Questions regarding Dotty's position in the ecosystem

This is an excellent point. Even with braces and with editor indentation lines, I often have a hard time figuring out what matches to what. Jump to Matching Brace and Rainbow Brackets help a lot with this. Without brackets it would get much harder.

2 Likes

I will throw in my $0.02 here and say that I really dislike significant whitespace. If the language moved to that being the only style that was accepted I would actually be inclined to consider other languages for my teaching. That’s how strongly I feel about it. On the other hand, I see supporting both as something of a nightmare and it goes against some of the moves in Dotty to make the language more opinionated. Even with that, I think that supporting both would be superior to only having the option of significant whitespace.

3 Likes

Particularly editor support for moving code around via copy-paste.

4 Likes

Someone just can say: do not use many nested levels. It can be no matter for him that it is more usefull in some cases.
Scala doesn’t need to be a language for everything, so it is not problem to sacrifice the small for the common good. There have been so much holy wars in such themes, so I don’t want to argue.
It is just scares

How would automatic formatters work with significant indentation? It seems to me that scalafmt would be completely lost and thus split lines at very unfortunate places.

I tried some random Python formatter found in Google and it destroys simple code instead of improving it or at least not destroying.

Scalafmt has the awesome property that it adjusts to max column number. Does any Python formatter have that property?

3 Likes

Screaming in horror is a common initial reaction to Python’s indentation sensitivity (it was mine for sure).

But, after learning the language and using it for a bit I can assure you that it is Not A Big Deal ™, and in fact it can help with readability by reducing visual clutter.

(4 space standard helps a lot I’d say, because it’s very easy to visually identify code blocks ).

As for “jump-to-matching-braces”, there’s no reason editors can’t do the same with indentation.

What really screws up my vi is nested comments and commented braces.

Some weekend soon I’m going to try the vim + LSP setup because I want to fix this before I die of old age.

I feel that there is no reason in the current century for mid-edit state (such as I start a string literal but haven’t closed it yet) to break my colorized syntax support in any editor.

In particular, it’s not evil to say that we’re not as interested in the syntactic any more, which is so 1970s. I want my editing environment to operate with typed entities, even if an edit takes ten seconds to complete because I’m doing something wrong at the type level. Maybe such a tool requires Google tracking my edits.

Oh, maybe I make a selection and Google tells me in an ad what to download and import.

I have to use Eclipse for my day job, in which mid-edit breakages are frequent, especially in Java lambdas, and laughable (because it’s important to laugh on the job as well as toil). My point is that these are not solved problems for me, some guy coding, although they are clearly solvable with current tech.

So to return to the initial question, dotty’s job is still to solve the big issues. I expect dotty to fix my pain points and not tinker with syntax. (Though tinkering is also useful and an ancient and honored profession.) I also expect dotty to introduce many issues. May we live in a interesting future.

Let’s recall that the half-life of our professional knowledge is falling over time. I expect someday to wake up in the morning and ask myself, What do I have to learn this morning to solve the problem that will present itself after lunch? That’s kind of true today, except that it refers to my personal ignorance and not institutional knowledge.

I want to roll out of bed and say, “OK Google, cancel alarm. What has Odersky committed that makes my test cases fail?”

4 Likes

Python is a good candidate for significant whitespace, because

(1) there is a clear distinction between control structures and other (“regular”) statements and

(2) “regular” statements are most often short enough to comfortably fit into a single line

In Scala, on the other hand, expressions that span multiple lines are very common, and there is no clear distinction any more what constitutes a control structure (“The for loop is really a for comprehension!”)
.

For example, how would you write this without braces, but significant whitespace:

def foldIt(either: Either[String, Long]): String = {
either.fold({
println(“Oh, dear!”)
message => “Oops! " + message
}, {
print(“Yay!”)
i => s"We got $i”
})
}

2 Likes