why is `project_names` constant lowercase?

Global constants are usually named in uppercase in Julia, right?

https://github.com/JuliaLang/julia/blob/ef496b060af9bbfe093297b8659dc75b79d30c94/base/loading.jl#L269-L270 has two definitons

const project_names = ("JuliaProject.toml", "Project.toml")
const manifest_names = ("JuliaManifest.toml", "Manifest.toml")

later they surface like black magic in current_project(dir) from https://github.com/JuliaLang/julia/blob/d789231e9985537686052db9b2314c0d51656308/base/initdefs.jl#L85-L98

function current_project(dir::AbstractString)
    # look for project file in current dir and parents
    home = homedir()
    while true
        for proj in project_names
            file = joinpath(dir, proj)
            isfile_casesensitive(file) && return file
        # bail at home directory
        dir == home && break
        old, dir = dir, dirname(dir)
        dir == old && break

Is this intentional? Why not fix this?

Yeah, why not?

As a note, they are currently used in e.g. the package manager: https://github.com/JuliaLang/Pkg.jl/search?q=project_names&unscoped_q=project_names.

1 Like
Maybe could use a helper function to start with:

"""Return <path>/"JuliaProject.toml" or <path>/"Project.toml"
   if <path> is a directory with project file.
function find_project(path::AbstractString)::Union{String, Nothing}
  for proj in project_names
    file = abspath(path, proj)
    isfile_casesensitive(file) &amp;&amp; return file

function has_project(path::AbstractString)::Bool
  return !isnothing(find_project(path))