brownplt / pyret-lang

The Pyret language.
Other
1.06k stars 106 forks source link

--run flag doesn't pass command line arguments #998

Closed awstlaur closed 6 years ago

awstlaur commented 7 years ago

When using the --run flag (or one of phaseX scripts), the "command-line-arguments" parameter never gets set by load-lib, which can result in such cryptic errors as:

The run ended in error:
Abstraction breaking: Uncaught JavaScript error:
 TypeError: Cannot read property 'brands' of undefined
    at hasBrand (/home/alex/repos/pyret-lang/build/phaseA/pyret.jarr:168792:25)
    at PBase.app (/home/alex/repos/pyret-lang/build/phaseA/pyret.jarr:168808:30)
    at PBase.isExit [as app] (/home/alex/repos/pyret-lang/build/phaseA/pyret.jarr:297056:36)
    at PBase.$temp_lam771 [as app] (/home/alex/repos/pyret-lang/build/phaseA/pyret.jarr:793316:21)
    at ActivationRecord.$temp_branch819 [as fun] (/home/alex/repos/pyret-lang/build/phaseA/pyret.jarr:793601:22)
    at Immediate.iter [as _onImmediate] (/home/alex/repos/pyret-lang/build/phaseA/pyret.jarr:170787:28)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

I have a partial-fix on the back burner, but I'm trying to figure out a good/robust way to distinguish between the flags that are meant for pyret.jarr and the flags meant for the Pyret program to be run.

blerner commented 7 years ago

One relatively common trick is to pass an argument of - such that everything after that argument is destined for the program-being-run, while everything before it is destined for the running-environment. There might be a slight issue with cmdline.arr being unhappy about - without any characters after it, I'm not sure...

awstlaur commented 7 years ago

I could always try special-casing the parsing logic for something like that.

schanzer commented 6 years ago

Now that the great horizon->master merge is complete, is this still an issue?