Removing do-while

Mark "Justin" Waks
1 min readAug 6, 2019

--

Today in Dotty News: Martin has submitted a new PR, which removes support for the “do-while” construct — the “check the condition after the first loop” version of the traditional while loop.

The little language historian in me screams, “heresy!” — do-while is one of those stupid old features that I expect to find in every language with an imperative influence. But realistically, I think it’s probably the right thing to do. It’s rarely used (I’m not sure I’ve ever used it in Scala), it’s taking up syntax, and it’s not pulling its weight.

Moreover, as Martin shows in the discussion of the PR, it is entirely redundant: if you really need it, you can accomplish the same functionality with a somewhat weird-looking while loop.

So I’m broadly in favor of this simplification (let’s all remember: one of the major goals of Dotty is to simplify where possible), but if you have an opinion or want to see the details, head over to the PR.

And the usual caveat: this is just a pull request, not yet merged to Dotty master — there’s a lot of discussion yet to come before this might show up in Scala 3.

--

--

Mark "Justin" Waks
Mark "Justin" Waks

Written by Mark "Justin" Waks

Lifelong programmer and software architect, specializing in online social tools and (nowadays) Scala. Architect of Querki (“leading the small data revolution”).

No responses yet