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

Massively simplify getting started with Scala #3169

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joan38
Copy link

@joan38 joan38 commented Mar 3, 2025

After multiple people telling me how complicated it is using Scala I was bummed to see how complicated are the instructions to install Scala.
Not only they are complicated but also they are wrong as they suggest to install Java for Scala CLI, which is not a requirement at all.
Today I passed by an Apple store and asked my wife to record me to show how easy it is to get started with Scala: https://www.youtube.com/shorts/9Un9_rTP0yc

So I really think our "Getting Started" should be dead simple. I know we are proud to show coursier and all the thing we can do with it. But most people don't care, they just want to play with Scala right now and if it's more than one command we already lost half of them to some other language.

Let me know what you think on the english version. I can do other languages after.

@joan38 joan38 force-pushed the install branch 5 times, most recently from b900ce8 to 350a68a Compare March 3, 2025 04:24
@bishabosha
Copy link
Member

nice video!

@sjrd
Copy link
Member

sjrd commented Mar 3, 2025

The problem with installing only scala-cli is that users won't actually be able to use "Scala" in general. They will get confused as soon as they clone and want to run a project built with sbt or Mill (which is virtually all projects).

Also, as I mentioned at VirtusLab/scala-cli#3532, I disagree that committing runners into the repos is good practice. It doesn't work cross-platform: a repo that is created/managed on a Linux platform will not be usable on a Windows platform, and conversely. This actively harms approachability of Scala projects, IMO. This was (still is?) is serious issue with Mill projects, for example. It recommended people commit their mill launcher into the repo, but that made those repos completely unusable on Windows.

@joan38
Copy link
Author

joan38 commented Mar 3, 2025

Thanks for your comment @sjrd
I can see how my view was skewed towards Linux and Mac platforms. Maybe for projects it would be a good habit to also install the bat file.

About installing build tools like SBT (I don't think coursier installs mill), I don't think it's worth complicating scala-lang.org's Getting Started for that. It's the responsibility of the readme of each project to explain how to build their project.
In my opinion the Getting Started page should only worry about Scala and not build tools.

Maybe we could have 2 tabs, install Scala CLI (default tab) and the Scala CLI launcher script in the second tab?
Coursier and build tools would be out of the picture. WDYT?

@Ichoran
Copy link

Ichoran commented Mar 3, 2025

I think it's a good idea to show just how easy it can be for cases where you want "easy". There's no reason to complicate things for people who just want to try it out. However, it does need to be clearly spelled out that scala-cli, while fantastic, is not a full build environment.

I use scala-cli a lot precisely because the install is such a non-issue. I can write stuff in Scala and almost anyone can use it almost anywhere with almost zero effort. This completely blows away Python, R, etc.. It's good to play that up, not hide it, just because "most people will want sbt and/or mill".

Just make it very clear what you're getting, and I don't think there's any problem. If people cannot pay enough attention to Most Scala projects use a full build system, which this is not. See below (or above) for instructions on how to install common build tools., I'm not sure it bodes well for their ability to use Scala at all.

@Ichoran
Copy link

Ichoran commented Mar 3, 2025

(In case it's not clear, I mean: we shouldn't delete the instructions on how to install Coursier. They also need to be in an obvious place and made as clear as possible. However, we can lead with the simplest, which is scala-cli.)

@joan38 joan38 force-pushed the install branch 2 times, most recently from 941c495 to dc814e4 Compare March 3, 2025 22:20
@joan38
Copy link
Author

joan38 commented Mar 3, 2025

it does need to be clearly spelled out that scala-cli, while fantastic, is not a full build environment.

I might be mistaken but I would never think of going on scala-lang.org to get documentation on how to use SBT or Mill.
I'd be interested to see how many people get confused by going on scala-lang.org and not getting SBT or Mill doc.
To me there is no confusion on the expectation of the Getting Started of scala's official website to install nothing else than... Scala.

On the other hand right now people who land on the Getting Started of scala-lang.org have to learn about Coursier, need brew installed, then there is a table with sbt, amm, scalafmt... then some info how to cs launch scala:2.13.16.
Meanwhile I myself, a Scala dev for the last 12 years, don't have any of that installed on my laptop and seem to do fine. I don't install anything on purpose so that I level down with people onboarding on my projects.

@joan38
Copy link
Author

joan38 commented Mar 3, 2025

I pushed this version:

Screen.Recording.2025-03-03.at.17.49.45.mov

@SethTisue
Copy link
Member

SethTisue commented Mar 7, 2025

we can lead with the simplest, which is scala-cli

I agree. I would like to see this PR merged — in some form. I haven't gone over it in detail, but the core idea is right IMO.

I think it's fine to also offer sbt and/or mill, but the main, clearly foregrounded path should be Scala CLI.

@philwalk
Copy link

philwalk commented Mar 7, 2025

I love the video!

it would be a good habit to also install the bat file

I assume that very few scala devs working on a Windows system work from a CMD.EXE command line (does anybody know?).
If not working from WSL (which is Linux), I'm guessing they tend to work from MSYS2 or cygwin, or git-bash.

A batch file isn't adequate by itself, except for the subset of developers who do prefer CMD.EXE.
A wrapper helps, but example scala scripts tend to look like the following, and it won't work unless scala.exe is in the PATH.

#!/usr/bin/env -S scala
sys.props.foreach( (k, v) => printf("%-44s: %s\n", k, v) )

However, if scala-cli.exe is installed, the script can do this works fine, even on Windows:

#!/usr/bin/env -S scala-cli shebang
sys.props.foreach( (k, v) => printf("%-44s: %s\n", k, v) )

@sjrd
Copy link
Member

sjrd commented Mar 7, 2025

I assume that very few scala devs working on a Windows system work from a CMD.EXE command line (does anybody know?).
If not working from WSL (which is Linux), I'm guessing they tend to work from MSYS2 or cygwin, or git-bash.

cmd.exe gives the best experience for sbt. The interactive shell doesn't work so well inside git bash. And WSL is a huge beast. cygwin is nowhere to be seen; it's always been the worst and only got a good run because it was the only thing 15 years ago.

@philwalk
Copy link

philwalk commented Mar 7, 2025

interactive shell doesn't work so well inside git bash

I work mostly in WSL and MINGW64, which seems quite solid, less experience with git bash.
I added a wrapper script named sbt here %APPDATA%\Local\Coursier\data\bin\sbt and it seems solid.

#!/bin/bash
exec "$0".bat "$@"

Likewise for other .bat files below %APPDATA%\Local\Coursier\data\bin\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants