Closed IR0NSIGHT closed 3 months ago
Current state after stdlib changes #449:
# build for each backend, then run `./out/test hello world 42`
$ for BACKEND in js chez-callcc chez-monadic chez-lift llvm ml; do effekt --backend $BACKEND --build test.effekt && echo -n "$BACKEND: " && ./out/test hello world 42; done
js: Cons(world, Cons(42, Nil()))
chez-callcc: Nil()
chez-monadic: Nil()
chez-lift: Nil()
llvm: Cons(hello, Cons(world, Cons(42, Nil())))
ml: Cons(hello, Cons(world, Cons(42, Nil())))
If we apply the following patch that performs the "$@"
fix mentioned above:
diff --git i/effekt/jvm/src/main/scala/effekt/Runner.scala w/effekt/jvm/src/main/scala/effekt/Runner.scala
index c69f169b..d021557d 100644
--- i/effekt/jvm/src/main/scala/effekt/Runner.scala
+++ w/effekt/jvm/src/main/scala/effekt/Runner.scala
@@ -153,7 +153,7 @@ trait ChezRunner extends Runner[String] {
val out = C.config.outputPath().getAbsolutePath
val schemeFilePath = (out / path).unixPath
val bashScriptPath = schemeFilePath.stripSuffix(s".$extension")
- val bashScript = s"#!/bin/bash\nscheme --script $schemeFilePath"
+ val bashScript = s"#!/bin/bash\nscheme --script $schemeFilePath \"$$@\""
IO.createFile(bashScriptPath, bashScript, true)
bashScriptPath
}
we get that chez-* now corresponds to llvm & ml:
js: Cons(world, Cons(42, Nil()))
chez-callcc: Cons(hello, Cons(world, Cons(42, Nil())))
chez-monadic: Cons(hello, Cons(world, Cons(42, Nil())))
chez-lift: Cons(hello, Cons(world, Cons(42, Nil())))
llvm: Cons(hello, Cons(world, Cons(42, Nil())))
ml: Cons(hello, Cons(world, Cons(42, Nil())))
https://github.com/effekt-lang/effekt/issues/318 Here is a related issue -- the same issue, but with the JS backend.
As of merging #487, this is the current state with the patch above:
js: Cons(world, Cons(42, Nil()))
chez-callcc: Cons(hello, Cons(world, Cons(42, Nil())))
chez-monadic: Cons(hello, Cons(world, Cons(42, Nil())))
chez-lift: Cons(hello, Cons(world, Cons(42, Nil())))
llvm: Cons(hello, Cons(world, Cons(42, Nil())))
ml: Cons(hello, Cons(world, Cons(42, Nil())))
for both:
--build
and then ./run
[same as above]:
for BACKEND in js chez-callcc chez-monadic chez-lift llvm ml; do effekt --backend $BACKEND --build test.effekt && echo -n "$BACKEND: " && ./out/test hello world 42; done
effekt test.effekt -- hello world 42
)
for BACKEND in js chez-callcc chez-monadic chez-lift llvm ml; do echo -n "$BACKEND: " && effekt --backend $BACKEND test.effekt -- hello world 42; done
So if these two are the only ways of building & running, then we can just update: https://github.com/effekt-lang/effekt/blob/cd741e8a4576c62ab318efd48fc0831958ba7e8d/libraries/common/args.effekt#L12 and that should be enough.
My first reaction was: "but what if I run the compiled effekt program from node directly?". But then, why should I do this?
There is two kinds of software:
Right now we do not support case 2 very well anyways, so...
ran after pulling latest master:
minimal effekt implementation:
note 1: issue can be fixed by changing the executable bash script to pass the arguments, tested only on chez-lift:
note: llvm and ml backends dont even compile because they cant typecheck println(commandLineArgs()) will make separate issues there.