-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[TODO] import ./[foo1,foo2]
gives error; import ./bar/[foo1,foo2]
works
#8792
Comments
Where is that documented to work? |
it should be (IMO) based on orthogonality of features: import bar/foo #ok
import ./foo #ok: foo is relative to ./
import ./foo/[bar1, bar2] #ok
import bar/[foo] #ok
import ./[foo] # error
import ./[bar1, bar2] # error here's an example where it's useful to have: import
commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes,
extccomp, strutils, os, osproc, platform, main, parseopt,
nodejs, scriptconfig, idents, modulegraphs, lineinfos it's not clear which of these are in ./ (ie, compiler) vs eg, once #8614 (Nim now allows modules with same name in a package) is implemented, keeping that ambiguitiy is not good, and following code is better (IMO): import
./[commands, lexer, condsyms, options, ... ]
std/[strutils, os, osproc, ...] |
|
is standard and
is much more ugly IMO. |
There is no "standard", Nim is its own programming language. |
So you want two ways to do the same thing? This is really unnecessary. |
import ./[options]
does not work (gives: "Error: cannot open file: ./[options]" instead of behaving like import current_dir/[options]
)import ./[options]
does not work (gives: "Error: cannot open file: ./[options]" instead of behaving like import current_dir/[options]
)
/cc @dom96 also this: import ./foo/[bar1, bar2] # works
import ../foo/[bar1, bar2] # works
import ./[bar1, bar2] # error
import ../[bar1, bar2] # error
we already have 2 ways to use import with and without quotes. Quotes is typically used for cases where non-quotes would result in error, eg from the docs: import "gfx/3d/somemodule" # in quotes because '3d' is not a valid Nim identifier and the overwhelming majority (98% using following coarse measurement) of import uses non-quotes:
Furthermore the docs says it should be allowed: it's just a bug, and it's probably easy to fix. |
import ./[options]
does not work (gives: "Error: cannot open file: ./[options]" instead of behaving like import current_dir/[options]
)import ./[foo1,foo2]
gives error; import ./bar/[foo1,foo2]
works
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys]
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 / 7624153 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys]
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 / 7624153 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys] Signed-off-by: Jamie Lokier <jamie@shareable.org>
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 / 7624153 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys] Signed-off-by: Jamie Lokier <jamie@shareable.org>
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 / 7624153 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys] Signed-off-by: Jamie Lokier <jamie@shareable.org>
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 / 762415 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys] Signed-off-by: Jamie Lokier <jamie@shareable.org>
`les_protocol.nim` failed to build, due to very silly Nim bugs nim-lang/Nim#8792 and nim-lang/Nim#17102. import ../../[rlp, keys], ../../common/eth_types, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types, The silly part is `../` has to be quoted if it's before a group of files, but not before a single file. Most places in PR #344 / 7624153 use the workaround `".."/` but it was missed in `les_protocol.nim`: nimbus-eth1/vendor/nim-eth/eth/p2p/rlpx_protocols/les_protocol.nim(14, 3) Error: cannot open file: ../../[rlp,keys] Signed-off-by: Jamie Lokier <jamie@shareable.org>
No description provided.
The text was updated successfully, but these errors were encountered: