# Making io.StdIn.readLine imported by default

**URL:** <https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803>\
**Category:** Language Design\
**Created:** [October 30, 2024, 6:36pm UTC](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803 "2024-10-30T18:36:26Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![bishabosha](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/bishabosha/32/3101_2.png) [@bishabosha](https://contributors.scala-lang.org/u/bishabosha)\
**Post date:** [November 9, 2024, 8:31pm UTC](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803/21 "2024-11-09T20:31:28Z")

</div>

@velvetbaldmime was working on something similar: [GitHub - neandertech/cue4s: Experimental library for CLI prompts in Scala 3, available on JS, JVM, and Native platforms](https://github.com/neandertech/cue4s)

---

<div class="post-metadata">

**Author:** ![velvetbaldmime](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/velvetbaldmime/32/2575_2.png) [@velvetbaldmime](https://contributors.scala-lang.org/u/velvetbaldmime)\
**Post date:** [November 9, 2024, 9:03pm UTC](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803/22 "2024-11-09T21:03:20Z")

</div>

Funny that cue4s came up twice in independent conversations in the last 7 days 🙂 cc @lbialy

The very simple task of making even a **prompts** clone in Scala for all 3 platforms has proven to be more difficult than I anticipated – but mostly due to my lack of experience with TUIs and how they work under the hood. I would _love_ to help train more contributors to share the burden.

On the subject of this conversation: I agree with some of the posters that `println` has a much wider applicability than `readLine`, the latter being only near and dear to the hearts of classically trained computer science students, such as myself 😛

For people building actual apps, the console interactions of today are much more complex (see [GitHub - charmbracelet/bubbletea: A powerful little TUI framework 🏗](https://github.com/charmbracelet/bubbletea) for inspiration), and having readLine available without import would not move the needle in the slightest.

---

<div class="post-metadata">

**Author:** ![MateuszKowalewski](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/mateuszkowalewski/32/77_2.png) [@MateuszKowalewski](https://contributors.scala-lang.org/u/MateuszKowalewski)\
**Post date:** [November 15, 2024, 2:41am UTC](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803/23 "2024-11-15T02:41:51Z")

</div>

People seemed to be open to the idea to make “toolkits” more powerful.

I think this is actually not so difficult. The compiler has switches for almost everything discussed so far (besides the “setup scripts”). You can add global imports, or switch Predef.

So if “toolkits” could define compiler (or scala-cli) parameters I guess one could easily create customized environments just by `using` a “toolkit”.

The compiler call and all its details (Predef, `-Yimports`, compiler flags) would be hidden this way, which is quite beginner friendly.

---

<div class="post-metadata">

**Author:** ![JD557](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/jd557/32/3004_2.png) [@JD557](https://contributors.scala-lang.org/u/JD557)\
**Post date:** [November 17, 2024, 11:10am UTC](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803/24 "2024-11-17T11:10:04Z")

</div>

> [@jducoeur](#):
>
> By contrast, I don’t think I’ve used readLine once, in 17 years of Scala programming.

I also don’t recall the last time I used `readLine` in Scala.

However, I think there might be a bit of a chicken and egg problem:

I feel like I would use `readLn` more often in my scripts (e.g. if an argument is missing), but I don’t because it’s cumbersome.  
Which in turn might be the reason why most tooling/libraries have a nice support for arguments, but there’s not much options for interactive TUIs.

At least I think I would use cue4s in my scripts, if it wasn’t for the “Library is experimental and is only available in Sonatype Snapshots” part 😛

---

<div class="post-metadata">

**Author:** ![dragove](https://contributors.scala-lang.org/user_avatar/contributors.scala-lang.org/dragove/32/3077_2.png) [@dragove](https://contributors.scala-lang.org/u/dragove)\
**Post date:** [November 18, 2024, 4:08pm UTC](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803/25 "2024-11-18T16:08:03Z")

</div>

I’m a Scala beginner who have Java experiences. I haven never called readLine function before.

Here are two toolkits help me to learn Scala with ease:

1. Scala worksheet: It’s something like Jupyter notebook but much easier to use for beginners. And [scastie](https://scastie.scala-lang.org/) is an online version of it. I can just install vscode’s extension and create a file named `demo.worksheet.sc` and start learning. IMO, for a beginner, Put literal values on the worksheet and see the results on demand is easier than using readLine (which may require type conversions)
2. Scala-CLI: It makes adding dependencies easier for single file. The `using directives` also support worksheet, and I can explore libraries on-demand by combining Scala-CLI and worksheet.

Hope my experience can be helpful for this discussion.

[Previous page](https://contributors.scala-lang.org/t/making-io-stdin-readline-imported-by-default/6803.md?page=1)
