<FromGitter>
<Blacksmoke16> i think its note worthy
<FromGitter>
<Daniel-Worrall> Hm, how do you guys propose I do run "all" branches of a case statement on a flag? Would I have to `|| all` on each when branch or a clever refactor?
<FromGitter>
<Daniel-Worrall> I'm thinking I instantiate a list/hash of conditionals and just set them all to true if all
<FromGitter>
<Blacksmoke16> Maybe a case isn't the best option?
<FromGitter>
<Daniel-Worrall> yeah, I'm changing it around now
<FromGitter>
<Blacksmoke16> Wouldn't it just run the first it matches then stop?
<FromGitter>
<Blacksmoke16> Can't say I ever tried that
DTZUZO has quit [Ping timeout: 240 seconds]
turbo1 has quit [Quit: WeeChat 2.6]
ur5us has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 276 seconds]
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 276 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
return0e_ has quit [*.net *.split]
DTZUZU has quit [*.net *.split]
teardown has quit [*.net *.split]
Raimondi has quit [*.net *.split]
chachasmooth has quit [*.net *.split]
baweaver has quit [*.net *.split]
fifr has quit [*.net *.split]
go|dfish has quit [*.net *.split]
dom96 has quit [*.net *.split]
<FromGitter>
<Daniel-Worrall> Can I convert string to regex?
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
teardown has quit [Quit: leaving]
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
Nekka has quit [Ping timeout: 250 seconds]
Nekka has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 245 seconds]
sagax has quit [Ping timeout: 252 seconds]
sagax has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
<FromGitter>
<randiaz95> dang i deleted my Nix ISO
<FromGitter>
<randiaz95> I need to remake my Virtualbox instance
<FromGitter>
<randiaz95> @manveru what is your experience with Netlify? I was checking out your blog off of your github repo and was interested in looking into it.
<FromGitter>
<tenebrousedge> I've enjoyed using netlify for a personal blog
<FromGitter>
<manveru> @randiaz95 it's pretty neat, i use it for a bunch of stuff
<FromGitter>
<manveru> the closest to fire-and-forget deploys i ever got :)
<FromGitter>
<randiaz95> Hey guys, I had a question about the Builder pattern, I can't find a real reason why not just put those methods and variables within the original class?
<FromGitter>
<Blacksmoke16> example?
<FromGitter>
<j8r> @Blacksmoke16 Ho wait, there is a problem
gangstacat has quit [Quit: Δis!]
<FromGitter>
<j8r> the `"$(pkg-config)"` command has been run inside your PC
<FromGitter>
<Blacksmoke16> comes with a bug fix for cutoff output on mac and supports XML as an input format
<FromGitter>
<kinxer> The Builder pattern is also good for constructing objects that really shouldn't change after they're built. For example, if you have some `Material` class that contains physical properties of a material that you'll later use to help define properties of particular objects, that shouldn't really change after it's been created. So it would be better to do β β ```code paste, see link```
<FromGitter>
<Blacksmoke16> main problem with this approach is that unless you new everything up in the initializer you would have to have these ivars be nilable
<FromGitter>
<kinxer> Okay, but if `Computer` is a struct, won't you be doing a whole lot of copying?
<FromGitter>
<Blacksmoke16> which might not make sense
<FromGitter>
<Blacksmoke16> computer would be a class, but its components could be structs
<FromGitter>
<Blacksmoke16> is like if you had some "assembly line" the computer could be "assembled" in various "workers"
<FromGitter>
<Blacksmoke16> each worker adds diff components to the same instance
<FromGitter>
<Blacksmoke16> really depends on the exact use case tho
<FromGitter>
<kinxer> So the mutability concern is solved by using a struct, but it may still be useful from a UX and performance perspective to build that struct using a builder anyway.
baweaver has joined #crystal-lang
<FromGitter>
<Blacksmoke16> i suppose yea
<FromGitter>
<Blacksmoke16> wouldnt that mean the ivars of the struct would have to be nilable, or use `property!` i guess
<FromGitter>
<Blacksmoke16> which seems kinda hacky to have setters on a struct in the first place
<FromGitter>
<Blacksmoke16> maybe it would be better if the builder stored the state then have a final `#build` method that news up the struct with the builder context?
<FromGitter>
<j8r> I will wait crystal 0.32.1 to submit a PR to Alpine
<FromGitter>
<nsuchy> nothing after the line before compiler had loaded
<FromGitter>
<nsuchy> Currently we've been interpolating `"#{Time.utc}"` as Granite silently fails on String if we don't do this way
<FromGitter>
<nsuchy> Will we need to adjust our code after this?
<FromGitter>
<Blacksmoke16> have to do what now?
<FromGitter>
<nsuchy> like will that now bug out with the new change to string interpolation or will it work as normla
<FromGitter>
<nsuchy> interpolating the value into a string
<FromGitter>
<Blacksmoke16> it'll prob be as it was before
<FromGitter>
<Blacksmoke16> but i more so meant, whats the granite issue?
<FromGitter>
<nsuchy> also this is the first time in like at least three or four crystal releases where amber hasn't broken after the update
<FromGitter>
<nsuchy> im impressed
<FromGitter>
<nsuchy> :)
<FromGitter>
<bew> @manveru about https://github.com/NixOS/nixpkgs/pull/75719 (note: I'm quite new to the world of Nix) Why does splitting output reduces the closure size? the compiled binary would still reference the compiler (then llvm etc... no?)
<FromGitter>
<manveru> basically, it referenced a path like `/nix/store/...-crystal/lib/some/path/to/some.cr` in the compiled binary, which is later used for printing backtraces and such i think
<FromGitter>
<manveru> since `/nix/store/...-crystal` also contains `/nix/store/...-crystal/bin/crystal`, it'd indirectly depend on the crystal binary at runtime
<FromGitter>
<manveru> which in turn needs llvm to compile stuff
<FromGitter>
<manveru> by splitting the derivation output, and setting `CRYSTAL_LIBRARY_PATH` to the `lib` output, we ensure that all references only point to the subdirectory at runtime, and so it won't need the crystal binary as a runtime dependency anymore
<FromGitter>
<manveru> since the subdir will be another derivation like `/nix/store/...-crystal-lib`, with no paths pointing to the other one
<FromGitter>
<bew> oooh ok I see, I love the idea! That's something (the dep on the whole crystal derivation) that annoyed me, so I'm happy to see this fixed!
<FromGitter>
<manveru> since nix determines dependencies by looking for store paths in all files of the output
<FromGitter>
<manveru> yeah, it got my deploy sizes down to a few kilobyte instead of 300 MB or so :)
<FromGitter>
<manveru> well, almost, but the remaining dependencies are really tiny anyway
<FromGitter>
<manveru> i'd really appreciate if you could try to build something with it, and see if it still works when errors happen, or some more complex libraries are in play
<FromGitter>
<bew> you've been using Nix for a long time? I just got into it (1-2 weeks) to have my latest packages on an old distrib I have to use at work, and I think I'll move to nixos when I have time
<FromGitter>
<manveru> yeah, a couple of years now
<FromGitter>
<manveru> started using nixos fulltime around 2016 or so :)
<FromGitter>
<bew> so nice! still using it I guess? :D
<FromGitter>
<manveru> sure :D
<FromGitter>
<manveru> also finally my fulltime job since september
<FromGitter>
<bew> my very first derivation was to compile this year' advent of code in crystal (yes I'm proud of it π )
<FromGitter>
<manveru> now i'm just trying to make the crystal ecosystem for nix better, it's already pretty painless to build crystal packages using crystal2nix and such, but there's still some work to do
<FromGitter>
<manveru> i'd love in particular if shard lockfiles could include a hash, so we wouldn't need crystal2nix anymore
ht_ has quit [Quit: ht_]
<FromGitter>
<bew> crystal2nix is a function? or a pkg?
<FromGitter>
<bew> still don't understand why I would need these kind of X2nix tool
DTZUZO has quit [Read error: Connection reset by peer]
<FromGitter>
<manveru> it's a pretty simple script
<FromGitter>
<manveru> it just runs `nix-prefetch-git` for each dependency, so we know the expected hash of it
<FromGitter>
<manveru> in nix, you cannot download anything during a build, unless you know already the hash of what you expect
<FromGitter>
<manveru> that ensures that builds are reproducible, can be cached, and don't have side-effects
DTZUZO has joined #crystal-lang
<FromGitter>
<manveru> so, if your language-specific package manager doesn't put hashes in the lockfile, we have to calculate them before starting a build
<FromGitter>
<manveru> and that's what all those 2nix tools are doing
<FromGitter>
<bew> okay, will have to test that some day with a bigger project, thanks for the explanation!
ur5us has quit [Ping timeout: 245 seconds]
<FromGitter>
<straight-shoota> > i'd love in particular if shard lockfiles could include a hash, so we wouldn't need crystal2nix anymore β β => https://github.com/crystal-lang/shards/issues/242
<FromGitter>
<straight-shoota> Bascially just needs someone to implement it (which shouldn't be hard, really).
ur5us has joined #crystal-lang
<FromGitter>
<manveru> @straight-shoota awesome, I'll probably give it a try this week then :)
<FromGitter>
<bew> @manveru I tried your new crystal building method, on compiling the compiler: Now the build binary is at a wrong location I think: /nix/store/v8mg1l99i7jvkxwlcazzj9r475ca400c-crystal-0.31.1/bin/bin/crystal (`bin`is mentionned twice..)
<FromGitter>
<manveru> yeah, please use `crystal.buildCrystalPackage` for that
<FromGitter>
<manveru> `stdenv.mkDerivation` implicitly pulls in the full `gcc`, which ends up being the one being referenced
<FromGitter>
<bew> Oo
<FromGitter>
<manveru> it's usually used for building C/C++, so it makes sense :)
<FromGitter>
<bew> but you're also using `stdenv.mkDerivation` in `crystal.buildCrystalPackage` ..?
<FromGitter>
<manveru> you're right... i somehow thought i had a different result
<FromGitter>
<bew> we also have a dep on glibc (~30MB) just for ld-linux... would be nice to have a separate output for this single thing that ~ every packages need, to really have a few KB worth of deps