Skip to content

Conversation

@chengluyu
Copy link
Member

@chengluyu chengluyu commented Dec 16, 2025

Note

The web IDE is (manually) deployed and accessible at https://mlscript.fun.

Planned Tasks

  • Support importing standard libraries through import "std/Stack.mls" instead of using relative paths.
  • Rewrite as many web components as possible with MLscript.
  • Generate deployable compiled project source files.

Bugs to be fixed

  • The file explorer doesn't navigate when using Firefox and Safari.

@chengluyu chengluyu changed the base branch from mlscript to hkmc2 December 16, 2025 11:12
@CAG2Mark
Copy link
Contributor

FYI: pressing tab does not insert whitespace, but instead navigates to the next element

Comment on lines +72 to +83
val pwd = os.pwd
val workingDir = pwd

val mainTestDir = workingDir/"hkmc2"/"shared"/"src"/"test"
val stdPath = mainTestDir / "mlscript-compile"

val compilerPaths = new MLsCompiler.Paths:
val preludeFile = mainTestDir / "mlscript" / "decls" / "Prelude.mls"
val runtimeFile = mainTestDir / "mlscript-compile" / "Runtime.mjs"
val termFile = mainTestDir / "mlscript-compile" / "Term.mjs"

val nodeModulesPath = workingDir / "node_modules"
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to move all of these in the companion? Doing so means they can no longer be overridden by other users of the test suite. (There is just one example with BenchTestState for now.)

import hkmc2.semantics.*
import hkmc2.syntax.Keyword.`override`
import semantics.Elaborator.{Ctx, State}
import hkmc2.io.Path
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused?


raise:
ErrorReport(msg"Cannot resolve the import path ${actualFile.toString}" -> rawPath.toLoc :: Nil)
Import(sym, rawPath.value, actualFile)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Import(sym, rawPath.value, actualFile)
Import(sym, rawPath.value, actualFile)

Copy link
Contributor

Choose a reason for hiding this comment

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

Beautiful! :^)

catch ex =>
// System.err.println("Unexpected error in watcher: " + ex)
// ex.printStackTrace()
ex.printStackTrace()
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't the stack trace already shown when throw ex propagates to the top-level?

@FlandiaYingman
Copy link

How about having a special syntax to denote that std is a predefined shortcut instead of an actual place? Say something similar to TypeScript's @ prefix for predefined paths and Typst's @preview or @local. We can have @std.

@LPTK
Copy link
Contributor

LPTK commented Dec 27, 2025

I didn't know TypeScript did that. It's not strictly necessary (since paths not starting with . are treated as absolute and the others are for libs/predefined folders), but it could be a nice way of getting some more disambiguation. WDYT @chengluyu?

@chengluyu
Copy link
Member Author

chengluyu commented Dec 28, 2025

How about having a special syntax to denote that std is a predefined shortcut instead of an actual place? Say something similar to TypeScript's @ prefix for predefined paths and Typst's @preview or @local. We can have @std.

@ usually represents the scope name. You can register an organization in a package registry like npm, and the packages published within that organization must include this prefix when importing, for example @mlscript/ucs-demo-build (the MLscript compiler package I published for the UCS web demo).

The practice you mentioned should be more or less like, in TypeScript projects, some people use paths to shorten long path names. For example, the usage here: https://github.com/Netflix/metaflow-ui/blob/ed4c2d34f12e7c4ac0020978bcfb8c8c2d938c6b/tsconfig.json#L28-L37

I plan to implement path remapping options like this. So that projects in mlscript-apps can resolve to the std in other directories.

I didn't know TypeScript did that. It's not strictly necessary (since paths not starting with . are treated as absolute and the others are for libs/predefined folders), but it could be a nice way of getting some more disambiguation. WDYT @chengluyu?

As to whether we should use @std, I think this is not bad.

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.

4 participants