cx
cx copied to clipboard
"." as the 1st arg passed to CX gives false runtime error (but WORKS as 2nd arg)
corpusc opened this issue on Sep 2, 2019 (in the OLD repo, before a move to the newer "SkycoinProject" org lost them)
when using a common dir with a relative path (like i do for my 3 games), you have to move the "." argument out of the 1st argument slot (i did not try "." in the 3rd or higher numbered slots). making an argument for every file in the Current Working Directory instead of using "." will also work, FWIW.
To Reproduce
-
Go into a working project dir (one that works properly, when run with "cx .")
-
Make a "..\2DFWork" dir
-
Move 1 of your files there
-
Run it with "cx . ..\2DFWork\app.cx" <--- ERROR
-
Run it with "cx ..\2DFWork\app.cx ." <--- IT WORKS
ERROR "error: draw.cx:57, CX_RUNTIME_ERROR, runtime error: integer divide by zero"
and there was no cases of "/" or "div" in draw.cx. i believe in my experiments it also reported some OTHER erroneous message. but the same source code works fine if "." isn't the 1st argument (however i did not try it in the 3rd slot, or higher).
Desktop:
OS: Windows 10 CX Version 0.7.0 full release
this comment was NOT ME on the old repo
------------------ [ingwal commented on Sep 9, 2019] ------------------
" Hi @corpusc, this does look like a bug.
Please note that in this line: cx foo hello.cx foo is a parameter to the cx interpreter, while in this line: cx hello.cx foo foo is a parameter to the hello.cx program. That's actually a big difference. "
this comment was NOT ME on the old repo
------------------ [ingwal commented on Sep 9, 2019] ------------------
" Note to the CX team: I put this bug on the 0.7.2 milestone because the division by zero looks like we should take care of it. It may be moved to 0.7.x if it's difficult but has low impact. "