stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
105 stars 27 forks source link

[ re #270 ] Make `extra-args` work more appropriately #302

Closed buzden closed 2 months ago

buzden commented 2 months ago

PR #270 introduces --extra-args option enabling us to pass additional arguments to the compiler. But this options works in an unexpected way sometimes: e.g.

What I propose is to pass extra-args to each call to the compiler (except for the very special internal calls of pack to the compiler using idrisExec function directly) so that any current and future command would respect this option. Also, I propose to take all passed extra arguments into account.

The only change that I made and I'm not certain about is the order: currently for the REPL options, where now --extra-args are used, those options are in the right of pack's own options, while I made them to be on the left. I personally think this is, actually, good, since we don't want user extra options to fiddle or override options that are important to pack itself. But this behaviour may break current behaviour is case of existing abuse of --extra-args option.

buzden commented 2 months ago

Also I propose to clean up types a little bit. Unlike rlwrap arguments, there is no need to distinguish between not set extra arguments and empty list of extra arguments, so there is no need to have a type isomorphic to Maybe CmdArgList, so let's clean code up and remove unneeded equivalent state representation. I made this a separate commit to (hopefully) make review easier.

buzden commented 2 months ago

Pinging @0xd34df00d as the original option's author. What do you think of the order change?