Skip to content
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

Scala 3 support #836

Merged
merged 10 commits into from
Aug 14, 2024
Merged

Conversation

grzegorz-bielski
Copy link
Contributor

@grzegorz-bielski grzegorz-bielski commented Jul 18, 2024

TODO:

Forum thread: https://forum.exercism.org/t/scala-3-support/12117

Supersedes: #734

Copy link

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Jul 18, 2024
Copy link

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@grzegorz-bielski
Copy link
Contributor Author

grzegorz-bielski commented Jul 21, 2024

I tried to port test generators to Scala 3, but looks like it's not going to be that easy.

I was able to update the libraries to the newest versions, but their up-to-date version simply doesn't work with the unsafe hack that was used in the test generators where JsValue from play-json was casted to Map[String, Any] .
In order to make test generators working again they have to be refactored at the ground level and each individual test generator should be ported, one by one.
It's not that hard, but requires a significant time commitment for which I'm not ready a the moment.
I already made a new POC setup based on the old one and ported one test generator for the word-count exercise.

My current development plan:

  • for now I'll focus on porting only the exercises folder, just to make it compile with Scala 3. Even if something was auto-generated before, I won't touchits test-gen code. This way we can move forward, and people could start using Scala 3 in the exercism. (WIP)
  • I'll remove the old test-gen setup and create a new one, where we can port test-generators one by one. (already done in this MR)
    From what I can see at: Bump Scala to version 2.13 and scalatest to version 3.2.10 #712 they were already not working 2 years ago, and recent new exercises are not even having test-gens.

@ErikSchierboom Does that sound good to you?

@ErikSchierboom
Copy link
Member

Looks good!

@grzegorz-bielski grzegorz-bielski marked this pull request as ready for review July 23, 2024 20:44
@grzegorz-bielski
Copy link
Contributor Author

grzegorz-bielski commented Jul 23, 2024

@ErikSchierboom I fixed compiler errors in all exercises, please take a moment to review when you have a chance. 🙇

There are still some warnings, but all tests are passing locally and I believe we can fix them later one by one when porting exercises to a more idiomatic Scala 3 and adding new test-gens.

I also noticed that current tests (bin/test) are really slow. This is because we are starting a new sbt session for each exercise. We should consider refactoring it later. Perhaps something similar to this, but for modern sbt. I removed it, since similarly to the test gens, it was already a dead code for some time now, but the idea though is sound.

As stated before, the new test-gens setup is a POC. I have tested it manually, but I haven't yet used it for the one ported exercise. Ideally, in the future, it should be also somehow integrated with the config.json and perhaps even CI, so it won't get stale again.
I hope to come back to it later.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Could you also update the documentation? In particular docs/INSTALLATION.md, but there might be other places that need to be updated too.

@grzegorz-bielski
Copy link
Contributor Author

grzegorz-bielski commented Jul 24, 2024

@ErikSchierboom I updated the docs.

On the site there is also Key Features of Scala. I think it needs some updates too. The Lazy computation point is not really correct. We can take some inspiration from the official scala lang page: https://www.scala-lang.org/.
Not sure where it can be changed, and what icons are available though.

docs/ABOUT.md Outdated

* Features
* JVM Interoperability - Scala runs on the JVM, so Java and Scala stacks can be mixed for seamless integration.
* JS and Native interoperability - Thanks to the [Scala.js](https://www.scala-js.org/) and [Scala Native](https://github.com/scala-native/scala-native)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* JS and Native interoperability - Thanks to the [Scala.js](https://www.scala-js.org/) and [Scala Native](https://github.com/scala-native/scala-native)
* JS and Native interoperability - Scala can run in the browser and on native devides, thanks to [Scala.js](https://www.scala-js.org/) and [Scala Native](https://github.com/scala-native/scala-native)

docs/ABOUT.md Outdated
Comment on lines 3 to 5
A programming language that scales with you: from small scripts to large multiplatform applications.

Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM, JavaScript and Native runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A programming language that scales with you: from small scripts to large multiplatform applications.
Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM, JavaScript and Native runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.
Scala is a a programming language that scales with you: from small scripts to large multiplatform applications.
Scala combines object-oriented and functional programming in one concise, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM, JavaScript and Native runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.

@ErikSchierboom ErikSchierboom merged commit 65e0bec into exercism:main Aug 14, 2024
2 checks passed
@ErikSchierboom
Copy link
Member

Here we go! 🥳

@ErikSchierboom ErikSchierboom added the x:rep/massive Massive amount of reputation label Aug 14, 2024
@mrybak834
Copy link

Thank you for this <3

@ErikSchierboom ErikSchierboom mentioned this pull request Aug 15, 2024
@ErikSchierboom
Copy link
Member

I also noticed that current tests (bin/test) are really slow. This is because we are starting a new sbt session for each exercise. We should consider refactoring it later. Perhaps something similar to this, but for modern sbt. I removed it, since similarly to the test gens, it was already a dead code for some time now, but the idea though is sound.

Improving this would be great!

@asarkar
Copy link

asarkar commented Aug 19, 2024

Hi, thanks for upgrading the Scala track. I started working on the exercises, and see that some of the tests are marked as pending. These tests are skipped locally, but occasionally fail when submitted, so, clearly the test runner doesn't care about the pending marker. Can you please advise how to run these tests locally so as not to have this discrepancy?

@ErikSchierboom
Copy link
Member

@asarkar That's documented here: https://exercism.org/docs/tracks/scala/tests

@asarkar
Copy link

asarkar commented Aug 20, 2024

I've opened a discussion.
http://forum.exercism.org/t/running-pending-scala-tests/12613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:rep/massive Massive amount of reputation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants