Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider implicit Base #1522

Closed
pao opened this issue Nov 9, 2012 · 7 comments
Closed

Consider implicit Base #1522

pao opened this issue Nov 9, 2012 · 7 comments
Assignees
Labels
needs decision A decision on this change is needed

Comments

@pao
Copy link
Member

pao commented Nov 9, 2012

I believe we've briefly gone over this before, but since it's the Month of Chaos I'd like it to be made as an explicit decision.

Lots of Julia is implemented as pure Julia in the Base module. This means that lots of the useful bits of the language are only accessible in a module that has a using Base statement, such that nearly every module will end up needing a using Base.

Given:

  1. Julia will need to be usable by technical non-programmers,
  2. Much of what we would consider the core Julia language is in Base,
  3. The Main module already implicitly loads Base

I would suggest that all modules should implicitly open with using Base, unless some escape mechanism (TBD, but cf. GHC's NoImplicitPrelude) is used to prevent that from occurring.

If nearly every module needs it anyways, it seems like the sort of thing that will just annoy the heck out of people for no good reason.

@JeffBezanson
Copy link
Member

This is totally reasonable, it just always struck me as ugly to have a not using mechanism just for this purpose. But if somebody has a good syntax idea for this I will implement it.

@mlubin
Copy link
Member

mlubin commented Nov 9, 2012

I second this and also question why, for example, import Base.(+) is needed if we implement (+) for a custom type. Seems like it creates unnecessary clutter and potential confusion.

@JeffBezanson
Copy link
Member

The reason is that you could write function foo(...) intending to create a new, private function, not realizing that there is actually a foo in Base that you'd be modifying.

@nolta
Copy link
Member

nolta commented Nov 9, 2012

using !Base?

@mlubin
Copy link
Member

mlubin commented Nov 9, 2012

Seems like that would be a small minority of the cases, but it is a bit strange syntactically that methods are automatically exported if they modify an existing method, but otherwise aren't. It would be more consistent to modify an existing method from another module only if you list the local function in export. Not sure how difficult that would be to implement.

@mlubin
Copy link
Member

mlubin commented Nov 9, 2012

exclude Base is legible and maybe wouldn't need to be a restricted keyword if it only has a special meaning right after the module line.

@pao
Copy link
Member Author

pao commented Nov 9, 2012

Just for reference, the Haskell equivalent to a "skip Base"/"use part of Base" syntax:

{-# LANGUAGE NoImplicitPrelude #-}
-- one could also use import Prelude (), though I understand that's subtly different

-- then maybe (roughly equivalent to current Julia `import Base`)
import qualified Prelude
-- or possibly (no obvious Julia equivalent)
import qualified Prelude as P
-- or even (no current Julia equivalent)
import Prelude hiding (zip, foldr)

Of course the latter two import statements would be useful even outside the context of Base.

@ghost ghost assigned JeffBezanson Nov 28, 2012
fredrikekre pushed a commit that referenced this issue Dec 13, 2019
…34091)

git log --oneline 0c2dddd40e4d7492d2a7337be54c345011e5f1e1^..8e236a7f993f1e732ffd0ab5c15736b2594e4109

8e236a7 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #1544 from JuliaLang/sk/telemetry
90b8482 telemetry: factor out telemetry file loading
228fb97 CI telemetry: send indicators for common CI env vars
246dbd0 Pkg protocol: basic anonymous opt-out telemetry
e66a75f Introduce special REPL syntax for shared environments (#1488)
afeb1ee Merge pull request #1538 from JuliaLang/sk/pkg-client-auth
9c357bb Pkg client auth: support connecting to authenticated Pkg servers
6dd7f34 PlatformEngines: revert API part of headers support (broken)
6825b48 Merge pull request #1539 from 00vareladavid/00/fixes
3f1cf40 it is invalid to `add` a package with no commits
0766765 test: default environment should be created when the primary depot does not exist
43f46f8 check no overwrite is occuring when resolving from a project file
37b6853 handle primary depot as relative path
53fdf24 Check for duplicate name/UUID input
8a6387c Remove redundant precompile statement
4d0901e Dont throw error when autocompleting faulty input (#1530)
d69f6d7 Refactor and test `Pkg.test` (#1427)
8ca8b6d PlatformEngines: use `tar -m` to ignore mtimes (#1537)
6797928 Make sure sandbox's temp Project.toml and Manifest.toml files are writable (#1534)
f968cc9 clarify: stacked envs only affect top-level loading (#1529)
0dfef59 PlatformEngines.download: add header support (#1531)
49ab53e Fix tree hashing with nested empty directories (#1522)
0c2dddd fix #1514: install_archive call in backwards_compatible_isolation (#1517)
KristofferC pushed a commit that referenced this issue Apr 11, 2020
…34091)

git log --oneline 0c2dddd40e4d7492d2a7337be54c345011e5f1e1^..8e236a7f993f1e732ffd0ab5c15736b2594e4109

8e236a7 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #1544 from JuliaLang/sk/telemetry
90b8482 telemetry: factor out telemetry file loading
228fb97 CI telemetry: send indicators for common CI env vars
246dbd0 Pkg protocol: basic anonymous opt-out telemetry
e66a75f Introduce special REPL syntax for shared environments (#1488)
afeb1ee Merge pull request #1538 from JuliaLang/sk/pkg-client-auth
9c357bb Pkg client auth: support connecting to authenticated Pkg servers
6dd7f34 PlatformEngines: revert API part of headers support (broken)
6825b48 Merge pull request #1539 from 00vareladavid/00/fixes
3f1cf40 it is invalid to `add` a package with no commits
0766765 test: default environment should be created when the primary depot does not exist
43f46f8 check no overwrite is occuring when resolving from a project file
37b6853 handle primary depot as relative path
53fdf24 Check for duplicate name/UUID input
8a6387c Remove redundant precompile statement
4d0901e Dont throw error when autocompleting faulty input (#1530)
d69f6d7 Refactor and test `Pkg.test` (#1427)
8ca8b6d PlatformEngines: use `tar -m` to ignore mtimes (#1537)
6797928 Make sure sandbox's temp Project.toml and Manifest.toml files are writable (#1534)
f968cc9 clarify: stacked envs only affect top-level loading (#1529)
0dfef59 PlatformEngines.download: add header support (#1531)
49ab53e Fix tree hashing with nested empty directories (#1522)
0c2dddd fix #1514: install_archive call in backwards_compatible_isolation (#1517)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs decision A decision on this change is needed
Projects
None yet
Development

No branches or pull requests

4 participants