Skip to content

Conversation

@jiribenes
Copy link
Contributor

@jiribenes jiribenes commented Jun 7, 2024

Motivation

Resolves #390
Resolves #318

As far as I know, with #487 merged, there are two nice ways of running an Effekt program with arguments (please correct me if I'm wrong):

  1. Run the compiler directly on a file: effekt test.effekt -- hello world 42
  2. First build, then run the executable: effekt test.effekt && ./out/test hello world 42

Testing

I tested this locally with:

# 1. Run the compiler directly on a file
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

# 2. First build, then run the executable
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

on a small file test.effekt:

module test

import args

def main() = {
  println(commandLineArgs())
}

Both of those print the same output:

js: Cons(hello, 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())))

Questions

  1. How do we do this on Windows? Resolved, but untested, see below!
  2. Are there any other ways of running an Effekt program that I can try out?
  3. How does this interact with effekt.sh?
  4. How can we test this? Should we even test this?

Copy link
Contributor

@marzipankaiser marzipankaiser left a comment

Choose a reason for hiding this comment

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

LGTM, tested some variants (effekt.sh with js, chez-callcc, sbt run).

@b-studios b-studios merged commit 16876f2 into master Jun 7, 2024
@b-studios b-studios deleted the fix/issues449and318 branch June 7, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

commandLineArgs() passing doesnt work for chez backend executables JS backend ignores first command line argument

4 participants