question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `using` directives straight from the REPL

See original GitHub issue

Scala CLI version: 0.1.17 Scala version (default): 3.2.0

Using the following script

//> using lib "com.lihaoyi::os-lib:0.7.8"
//> using lib "org.typelevel::cats-effect:3.4.1"
import os._
import cats.implicits._
println("toto")

when running

> scala-cli script.sc                                                                                                                                                                                                                                              
Downloading 3 dependencies
Compiling project (Scala 3.2.0, JVM)
Compiled project (Scala 3.2.0, JVM)
toto

Which is ok.

But when doing the same thing in the REPL it’s like if the using directive was not used.

> scala-cli                    
Welcome to Scala 3.2.0 (11.0.16, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                                                                                                                                                                                                                                       
scala> //> using lib "com.lihaoyi::os-lib:0.7.8"
                                                                                                                                                                                                                                                                                                                                                       
scala> //> using lib "org.typelevel::cats-effect:3.4.1"
                                                                                                                                                                                                                                                                                                                                                       
scala> import os._
-- [E006] Not Found Error: -----------------------------------------------------
1 |import os._
  |       ^^
  |       Not found: os
  |
  | longer explanation available when compiling with `-explain`
1 error found
              

when using --amm I have same issue, except os-lib which is imported by default.

I would have expected the script to the same way in REPL than from a file. So I could try in REPL what is in my script.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Gedochaocommented, Nov 28, 2022

re-tagging this as a wontfix feature request. it doesn’t seem we’ll be able to support this until Scala REPL/Ammonite REPL add using directive support.

0reactions
Gedochaocommented, Nov 29, 2022

Closing this for the time being, since there’s not much to be done about it on our side for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chapter 12 The toplevel system or REPL (ocaml)
These directives control the behavior of the toplevel; they are listed below in section 12.2. Unix: The toplevel system is started by the...
Read more >
F# Interactive (dotnet) Reference - Microsoft Learn
Learn how F# Interactive (dotnet fsi) is used to run F# code interactively at the console or to execute F# scripts.
Read more >
Node.js environment: REPL - Lost-in-Code
The REPL comes with every Node.js installation and helps to conduct quick tests and explore JavaScript code in the Node environment without ...
Read more >
@programmeruser idk just add... - Replit
I have no idea how Microsoft Visual C++ works so I can't help you with that. After that you will want to run...
Read more >
How to launch a C# REPL or interactive compiler in Visual ...
We can load an assembly and call its methods using the #r command, which has important features like resetting the environment, clearing the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found