modules names, files, and directory names

126 views
Skip to first unread message

lgautier

unread,
Dec 15, 2012, 5:41:09 PM12/15/12
to juli...@googlegroups.com
Hi,

Is there a convention for the module name (that is the directory Foo/ where LICENSE, REQUIRE, src/, test/ are, and presumably the matching Julia source file in src/), and the name of the module in the `module` block ?

Example (the code is not doing anything meaningful, just an example):

julia> require("pkg") # lower-case p
julia> Pkg.add("Options") # upper-case p
julia
> require("Options")
julia
> OptionsMod.ref(Int32) # name changed from "Options" to "OptionsMod" ?
0-element Int32 Array

L.

Tom Short

unread,
Dec 15, 2012, 6:25:50 PM12/15/12
to juli...@googlegroups.com
You found two of the exceptions where a package's name doesn't match
the main module name in the package. I wish we'd automatically wrap
packages in a module of the same name. That would enforce this
convention and make each package only have one main module. Without
that there can be naming collisions between packages.

There are some naming issues with packages, modules, and types. The
reason that OptionsMod is not named Options is that OptionsMod has a
main type called Options. There was a thread on this mailing list
entitled "naming things" where this was discussed more (with nothing
really resolved).
> --
>
>
>

Viral Shah

unread,
Dec 16, 2012, 7:02:16 AM12/16/12
to juli...@googlegroups.com
We have generally kept filenames with lower-case names, because some filesystems do not distinguish between upper case and lower case, and this can lead to confusion.

We should certainly strive to use the same names for the file, package, and module, and try to make much of this automatic to the extent possible.

-viral

lgautier

unread,
Dec 16, 2012, 8:06:47 AM12/16/12
to juli...@googlegroups.com


On Sunday, December 16, 2012 1:02:16 PM UTC+1, Viral Shah wrote:
We have generally kept filenames with lower-case names, because some filesystems do not distinguish between upper case and lower case, and this can lead to confusion.

We should certainly strive to use the same names for the file, package, and module, and try to make much of this automatic to the extent possible.


Pkg.new() does follow the lower-case bit, AFAIUI.
The code base will be patched with a call to `lowercase()` when the directory/file are created ?

Patrick O'Leary

unread,
Dec 16, 2012, 10:22:08 AM12/16/12
to juli...@googlegroups.com
No, Pkg.new() uses exactly the same as the package name capitalization, including for the default .jl file, since that's what most modules in METADATA were doing, including some being explicitly renamed to add the capitalization.

lgautier

unread,
Dec 17, 2012, 7:16:06 AM12/17/12
to juli...@googlegroups.com
I meant upper-case.
The irony is that the package module does not follow the rule proposed.
(`require("pkg")`, but `Pkg.new()`).

Patrick O'Leary

unread,
Dec 17, 2012, 8:30:50 AM12/17/12
to juli...@googlegroups.com
Blame Stefan. I think all the files in base/ have lower-cased filenames.

Stefan Karpinski

unread,
Dec 17, 2012, 11:53:00 AM12/17/12
to Julia Dev
On Mon, Dec 17, 2012 at 8:30 AM, Patrick O'Leary <patrick...@gmail.com> wrote:
Blame Stefan. I think all the files in base/ have lower-cased filenames.

I offer professional scapegoating services at very reasonable prices. I named it "pkg.jl" to match everything else in base. It should really be loaded for you by default, but it depends on glpk, which is in extras, yada, yada. So I deemed it not a good idea to load automatically yet, but would really ideally like to. 

lgautier

unread,
Dec 17, 2012, 12:20:42 PM12/17/12
to juli...@googlegroups.com
I understand that 'base' appeared before the the packaging system, but wouldn't it make sense to unify the naming scheme (if a naming scheme is recommended or enforced) ? It would allow base to be handled like a local package install and in that case facilitate the promotion of third-part packages into base

L.

Stefan Karpinski

unread,
Dec 17, 2012, 12:26:46 PM12/17/12
to Julia Dev
Most things in base aren't package-like and don't introduce modules. If anything, we'll generally move more stuff out of base, rather than into it. FFTW, for example. The only exception is plotting because it seems like we need to ship with a plotting facility. This will all get straightened out in due course as we move things out of extras into either base or packages.



L.

--
 
 
 

Reply all
Reply to author
Forward
0 new messages