Skip to content

Inconsistent handling of --trace-compile argument #56274

Closed as not planned
Closed as not planned
@paulmelis

Description

@paulmelis

With 1.11 (and 1.10 as well):

$ julia --help | grep project
 --project[={<dir>|@.}]     Set <dir> as the active project/environment.

$ julia --help-hidden | grep trace-compile
 --trace-compile={stderr|name}

Both options are listed in the <option>=<value> form, with --trace-compile even suggesting there must be a = used to set its value.

For --project you cannot provide its value as a separate argument:

melis@blackbox 17:13:~$ julia --project `pwd`
ERROR: SystemError: opening file "/home/melis": No such file or directory
Stacktrace:
 [1] include(mod::Module, _path::String)
   @ Base ./Base.jl:557
 [2] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:323
 [3] _start()
   @ Base ./client.jl:531

While for --trace-compile you can:

melis@blackbox 17:13:~$ julia --trace-compile doh
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.1 (2024-10-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> 
melis@blackbox 17:13:~$ cat doh
precompile(Tuple{typeof(Base.print), Base.TTY, String})

It would be better if --trace-compile (and other options of the same form) would raise an error if they're not using the <option>=<value> form as listed in the help, as it will unexpectedly overwrite the argument following it when you pass only --trace-compile. I did this inadvertently as I was expecting julia --trace-compile script.jl to output the precompile statements to stderr by default, but instead it overwrote my script file (which was luckily in git).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions