Julia: Automatically remove `.jl` termination in `Pkg.add`

Created on 16 Feb 2017  Â·  11Comments  Â·  Source: JuliaLang/julia

julia> Pkg.add("Lint.jl")
ERROR: unknown package Lint.jl
good first issue help wanted packages

Most helpful comment

PkgDev is another: how many times have I said PkgDev.generate("MyNewPackage.jl") and created a MyNewPackage.jl.jl?

All 11 comments

Very good idea. Should be simple to implement.

Also in e.g.
using Lint.jl
import Lint.jl

PkgDev is another: how many times have I said PkgDev.generate("MyNewPackage.jl") and created a MyNewPackage.jl.jl?

What if a package is named "package.jl"? That is, the source file is "package.jl.jl". Such a naming pattern is not hard to imagine. Maybe somebody has a package for different languages, and decided to append .py, .jl, etc to the package name to identify the language.

Would anybody really have a source file package.jl.jl? Have you ever actually seen that? We should definitely be anti-encouraging that.

I have never seen it. But it should be kept in mind if one decides that Pkg.add("Lint.jl") automatically removes the .jl. Maybe mention it in the documentation.

Also in e.g.
using Lint.jl
import Lint.jl

Note that these are already legal expressions.

Ah, I was checking on 0.5 where they weren't, thanks.

It always is

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.0 (2016-09-19 18:14 UTC)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |  x86_64-pc-linux-gnu

julia> module A
       jl = 1
       end
A

julia> using A.jl

Ah, oops, thanks.

As @yuyichao pointed out, using Foo.jl already has a meaning. Package names can't contain dots so there's no actual danger of a package named Foo.jl with source file Foo.jl.jl.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StefanKarpinski picture StefanKarpinski  Â·  3Comments

Keno picture Keno  Â·  3Comments

StefanKarpinski picture StefanKarpinski  Â·  3Comments

musm picture musm  Â·  3Comments

i-apellaniz picture i-apellaniz  Â·  3Comments