if they had anything like modules in mind ADL would not have made a lot of sense
eddyb
oh god ADL
Ixrec
I think everyone uses them a little like a module system
it doesn't make a lot of sense to have your namespaces and your modules be completely unrelated to each other
eddyb
I actually read up on all the rules one night trying to figure out just how hard parsing C++ would be
Ixrec
lol
scott
eddyb: ADL isn't related to any parsing problems
eddyb
scott: parsing depends on types
are you saying ADL is late-bound?
Ixrec
"in some other languages the notion of a private namespace doesn’t really exist" oh yeah, I think that's another thing that confused me but I never really got this pointed out explicitly
in most languages it's *items* that are public or private, never modules/packages/namespaces
scott
eddyb: it might be incidentally related in the sense that any type checking is, but it's not directly related
eddyb
scott: right no that's what I meant
scott: I was looking at everything that can affect it
(there are even crazier rules around templates so that you can parse them before monomorphization :P)
ADL was just one stop on the crazy train
Ixrec
I was about to say, I thought the template "typename" thing was the main reason you can't parse C++ at all without building a symbol table
eddyb is amused by "symbol table" in 2017
I don't work on compilers lol
what do you use?
scott
Ixrec: you need that stuff to parse C and C++ without templates, even
eddyb
Ixrec: it's just ancient terminology
you have something more akin to a module tree
scott
C++ templates have keywords to disambiguate because otherwise parsing the polymorphic code would be impossible
eddyb
(think tree of name tables or something)
Ixrec
yeah, that makes more sense
I just assumed the symbol tree was using those hideous fully-qualified names you see in the error messages
eddyb
anyway, my conclusion was that you can't keep all the rules in your head unless you're the kind of person trained to build rube goldberg contraptions from memory
Ixrec: oh god no
Ixrec
lol
eddyb
a::b::c is never anything other than syntax for ['a', 'b', 'c']
Ixrec
even in C++?
eddyb
or ((a)::b)::c, depending how you design your system
Ixrec
(I did assume that was the case in Rust)
lukaramu joined the channel
eddyb
Ixrec: well yeah
nothing uses the stringification of a path
I'm not sure about C++ but in Rust a, b, c and the :: between them are all distinct tokens and can thus have any number of spaces between them
I was shocked the first time someone pointed out that Rust allows that
eddyb
Ixrec: again, a path is just syntax
Ixrec
oh, ok then
eddyb
this is obvious if you think about how it allows parameters
it can't be a monolithic thing
Ixrec
parameters?
eddyb
Vec::<T>::new()
this is valid syntax in Rust and C++ has several equivalents
hmm let me a bit clearer
std::vec::Vec::<T>::new desugars to <std::vec::Vec<T>>::new
one path with 3 identifiers and one type-dependent associated item lookup (which is always <Type>::identifier)
Ixrec
okay, I *think* that's how I was parsing the symbol in Rust before
eddyb
C++ has more complicated Rules but they are based on individual components
Ixrec
where's the original internals thread corresponding to woboat's "The Rust module system is too confusing" post? I can only find the new lang-team-minutes thread