notzmv has quit [Read error: Connection reset by peer]
hightower2 has joined #crystal-lang
notzmv has joined #crystal-lang
maria_elis has joined #crystal-lang
hightower2 has quit [Ping timeout: 250 seconds]
maria_elis has quit [Quit: WeeChat 3.0]
notzmv has quit [Ping timeout: 252 seconds]
<FromGitter>
<alexherbo2> how to avoid namespace collision?, I have a `Snippet::Scope::Path`, now, when I want to refer to `Path`, I have to use `::Path` everywhere
<FromGitter>
<Blacksmoke16> the solution is to use `::Path` if you want to refer to the stdlib `Path` type, otherwise it would refer to your `Path` type
<FromGitter>
<Blacksmoke16> so either keep doing that or pick a diff name
<FromGitter>
<alexherbo2> it's not recommended to have generic name such as `Path`, `String`, etc., even under namespaces?
<FromGitter>
<Blacksmoke16> no its perfectly fine
<FromGitter>
<alexherbo2> I'm never sure how the lookup works
<FromGitter>
<alexherbo2> is there a difference between writing
<FromGitter>
<Blacksmoke16> it's because when you use `Path` in your code it uses the first type that has that name, which is `Snippet::Scope::Path` when it actually meant `::Path` before you added it
<FromGitter>
<Blacksmoke16> so if you want to refer to your type use `Path`, if you want the stdlib type use `::Path`
<FromGitter>
<Blacksmoke16> for the most part no, the only diff that comes to mind is if you wanted to inherit from another type
<FromGitter>
<Blacksmoke16> `class Path < BasePath` would work in the first example but not the 2nd
<FromGitter>
<Blacksmoke16> would need to do `class Snippet::Scope::Path < Path::To::BasePath` which isnt a big deal imo, and is better than all the extra nesting
<FromGitter>
<HertzDevil> but that just means `BasePath`is resolved relative to `::`, it isn't the same thing as not working
<FromGitter>
<HertzDevil> on the other hand, if `Snippet` and `Snippet::Scope` weren't defined prior to writing the second form then they will implicitly become modules
<FromGitter>
<HertzDevil> so if they are actually classes then they must be defined before
<FromGitter>
<Blacksmoke16> yea, its not a bug or anything, just different than if you were to do it the other way
<FromGitter>
<Blacksmoke16> and good call, thats the other main issue that bites me sometimes
<FromGitter>
<tenebrousedge> why can I connect to pg using psql but rails gets "no role" with the same credentials?
<FromGitter>
<Blacksmoke16> using the `postgres` user?
<FromGitter>
<tenebrousedge> nah, one set by docker env var
<FromGitter>
<tenebrousedge> rails and postgres are literally using the same .env file
<FromGitter>
<tenebrousedge> hmmm, that ain't right
<FromGitter>
<foxxx0> Hi, is it somehow possible to specify the interface identifier for ipv6 link local addresses when opening a socket?
<FromGitter>
<foxxx0> IPv6 link local adresses are, as the name implies, bound to their respective interface.
<FromGitter>
<foxxx0> the usual `fe80::1%br0` notation results in ```Unhandled exception: Invalid IP address: fe80::1%br0 (Socket::Error)```
Elouin has quit [Quit: So long and thanks for all the fish!]
Elouin has joined #crystal-lang
<FromGitter>
<foxxx0> I've been fiddling with `LibC.getaddrinfo` and the resulting `LibC::SockaddrIn6*` pointers, the struct in `src/lib_c/x86_64-linux-gnu/c/netinet/in.cr` seems to correctly contain the `sin6_scope_id` which is supposed to contain the interface identifier
notzmv has joined #crystal-lang
<FromGitter>
<foxxx0> But I am completely lost at what to do with that now
<FromGitter>
<manufaktor> Hi, should it be possible with crystal-db to execute multiple statements with `db.exec`? I'm writing SQL in a file and then executing it, but it only ever executes the first statement (using the sqlite3 driver).