Skip to content

Conversation

@mpollmeier
Copy link
Owner

Part 1 (this PR): predef files. Prior to this we concatenated all predef files
and handed that over to the REPL/script/embedded driver for interpretation.
That worked, but the line numbers were wrong, and the implementation more
complicated than necessary.

A followup PR will address the issue for scripts as well. That's somewhat
different because we need to embed the script content in some wrapper code..

@mpollmeier mpollmeier requested a review from maltek May 29, 2024 18:25
Comment on lines 42 to 43
val predefCode = "" // TODO drop
val scriptContent = wrapForMainargs(predefCode, Files.readString(scriptFile))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
val predefCode = "" // TODO drop
val scriptContent = wrapForMainargs(predefCode, Files.readString(scriptFile))
val scriptContent = wrapForMainargs("", Files.readString(scriptFile))

(or is this still used somewhere else I haven't seen?)

Copy link
Owner Author

Choose a reason for hiding this comment

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

forgot to cleanup - done now

re scripts: default predef only contain imports, so with the new model
of compiling other predef code, and also to simplify everything, we
don't want to make them available in scripts
@mpollmeier mpollmeier merged commit 664b2e6 into main Jun 4, 2024
@max-leuthaeuser max-leuthaeuser deleted the michael/predef-via-files branch August 2, 2024 07:59
mpollmeier added a commit that referenced this pull request Nov 19, 2024
Prior to 0.1.92 we concatenated and executed all predef code. That was
very simple but had quite
a few downsides, including incorrect line number reporting and some edge
cases when handling complex
compilation units, e.g. ordering of imports etc. 

#157 changed this
behaviour to instead compile
the given files and add the results to the classpath. At the same time
we unintendedly broke
the ability to execute code on startup of the repl - that's reintroduced
as a new parameter
 `--runBefore` now.
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.

3 participants