Scala 3 support

Hello!

I started some work for supporting Scala 3 in test runner: Scala 3 support by grzegorz-bielski · Pull Request #55 · exercism/scala-test-runner · GitHub

It’s fully working with the provided test cases, but I suspect we also need to port the actual exercises.
If you don’t mind I can do it next.

Cheers

3 Likes

There’s an open draft PR in progress for updating the exercises to Scala 3. It might be worth checking if its something you could help to with.

That’s lovely! Thanks a lot.

It is indeed worth checking. However, should it not be useful, feel free to open another PR, as that PR has been stale for a very long time.

2 Likes

I think I’ll start with a new PR, it’d be easier that way.

I have one question though; test generators like BobTestGenerator are referencing files like src/main/resources/bob.json. I suspect this is the same file as in: problem-specifications/exercises/bob/canonical-data.json at main · exercism/problem-specifications · GitHub

I couldn’t find how those files are fetched and generators are run, is it done only manually before submitting each PR with a new exercises, or is there some CI job that executes that I am missing?

That sounds plausible, as the canonical-data.json file is the source to generate tests from.

I also couldn’t find anything about how the track handles it, so you’re free to handle this as you’d like. One approach is to directly download the file, another is to use configlet. If you run:

configlet info -v d

It’ll output the cache directory it uses:

Using cached 'problem-specifications' dir: /Users/erik/Library/Caches/exercism/configlet/problem-specifications
1 Like

Thanks @ErikSchierboom !

The progress of porting exercises to Scala 3 can be tracked here: Scala 3 support by grzegorz-bielski · Pull Request #836 · exercism/scala · GitHub

1 Like

Hello again @ErikSchierboom !

PR for test runner and exercises are done, is there anything else needed to merge them?

1 Like

I have little time this week, but I’ll get back to you!

1 Like

Both PRs have been merged!

1 Like

Hey, so what’s the status of Scala 3 support? In the intro video to the Scala track, it says Scala 3 is not supported in exercism. Is that correct? As someone new to Scala, am I going to be learning the wrong syntax if I go through the exercism Scala track, or does it not really matter?

Scala 3.4.2 is currently used.

github.com/exercism/scala/ - PR

github.com/exercism/scala-test-runner/ - PR

2 Likes

An update for anyone who finds this thread with the same question as above (does the track teach Scala 2 syntax?).

  • The track and the test runner both use Scala 3.9.0, the current LTS (exercism/scala#888).
  • The example solutions, tests, stubs and the “Dig deeper” approaches are written in Scala 3 syntax: indentation instead of braces, if … then, given and extension, enum. That work is tracked in exercism/scala#914 and is nearly done.
  • The test suites are now generated from the problem-specifications canonical data with bin/generate-tests (exercism/scala#843), which also answers the earlier question about how the old generators got their data: they were removed in #836. 85 of 102 practice exercises are generated so far.
  • A few exercises whose canonical data doesn’t fit the track’s API are discussed in Syncing exercises whose canonical data doesn’t fit the track’s API.

So the syntax you learn on the track is Scala 3. If the intro video still says Scala 3 isn’t supported, it predates all this.

1 Like