ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
DTZUZO has quit [Ping timeout: 265 seconds]
<FromGitter> <Daniel-Worrall> turns out you can, you just stick the shard.yml where you launch `crystal play`
<FromGitter> <Daniel-Worrall> and if you don't have one, you could just create one through playground
<FromGitter> <Daniel-Worrall> and then `shards install` through playground too
<FromGitter> <Daniel-Worrall> so don't be running play insecurely ladies and gents
<FromGitter> <Daniel-Worrall> I'm thinking you could have it all setup/install/require in a single session using macros
tleydxdy has left #crystal-lang ["User left"]
DTZUZO has joined #crystal-lang
<FromGitter> <Blacksmoke16> oh that crystal play
<FromGitter> <dscottboggs_gitlab> where is the documentation for the `select` keyword? I know I've seen it before but now I can't find it :/
<FromGitter> <Blacksmoke16> i always head just go look at go
<FromGitter> <dscottboggs_gitlab> this is basically what I want to do https://carc.in/#/r/82uw
<FromGitter> <dscottboggs_gitlab> but it doesn't work
<FromGitter> <Daniel-Worrall> chan.receive
<FromGitter> <dscottboggs_gitlab> oh
<FromGitter> <dscottboggs_gitlab> thanks
<FromGitter> <dscottboggs_gitlab> oh man... ⏎ ⏎ I had `.recieve` in my code... 😞
<FromGitter> <Sija> https://carc.in/#/r/82v5 <- should this work or is it too l8 for me to do coding?
<FromGitter> <dscottboggs_gitlab> nope, pretty sure the type is squashed.
<FromGitter> <dscottboggs_gitlab> maybe if you do `of (Foo | Bar | Baz)`?
<FromGitter> <dscottboggs_gitlab> nope https://carc.in/#/r/82vb
ur5us has quit [Ping timeout: 245 seconds]
<FromGitter> <Sija> `is_a?` for some reason works differently (or doesn’t) - https://carc.in/#/r/82vj
<FromGitter> <Sija> sorry, that’s my bad since the `else` branch shouldn’t be there
ur5us has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Technically possible to setup shards from within play, but really not worth the hassle
<FromGitter> <Daniel-Worrall> just install them locally, then launch the play
sorcus has quit [Ping timeout: 276 seconds]
straight-shoota has quit [Ping timeout: 265 seconds]
ur5us has quit [Ping timeout: 245 seconds]
ur5us has joined #crystal-lang
lvmbdv has quit [Ping timeout: 276 seconds]
lvmbdv has joined #crystal-lang
lvmbdv has quit [Ping timeout: 240 seconds]
lvmbdv has joined #crystal-lang
sagax has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 245 seconds]
chachasmooth has quit [Ping timeout: 276 seconds]
chachasmooth has joined #crystal-lang
sagax has quit [Remote host closed the connection]
commavir has quit [Ping timeout: 265 seconds]
commavir has joined #crystal-lang
tleydxdy has joined #crystal-lang
ur5us has quit [Ping timeout: 250 seconds]
sagax has joined #crystal-lang
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
flaviodesousa has joined #crystal-lang
DTZUZO has quit [Ping timeout: 252 seconds]
ur5us has joined #crystal-lang
<FromGitter> <j8r> @dscottboggs_gitlab hi man, long time!
<FromGitter> <j8r> @bararchy are you here, have you time to review https://github.com/crystal-community/hardware/pull/15?
tleydxdy has quit [Read error: Connection reset by peer]
beepdog has quit [Remote host closed the connection]
olbat[m] has quit [Remote host closed the connection]
ternarysolo has quit [Write error: Connection reset by peer]
erdnaxeli has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 246 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
ur5us has quit [Ping timeout: 240 seconds]
DTZUZO has joined #crystal-lang
erdnaxeli has joined #crystal-lang
ternarysolo has joined #crystal-lang
olbat[m] has joined #crystal-lang
beepdog has joined #crystal-lang
tleydxdy has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
straight-shoota has joined #crystal-lang
<straight-shoota> exit
straight-shoota has quit [Client Quit]
Nekka has quit [Quit: zzz]
Nekka has joined #crystal-lang
sorcus has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 276 seconds]
alexherbo2 has joined #crystal-lang
DTZUZO has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 250 seconds]
alexherbo25 has joined #crystal-lang
duane has joined #crystal-lang
return0e_ has quit [Ping timeout: 268 seconds]
return0e_ has joined #crystal-lang
<repo> j8r my static builds are segfaulting again... :(
<repo> using jrei/crystal-alpine:0.31.1
<FromGitter> <j8r> They have rebuilt packages against a newest version of libevent
<repo> what does that mean?
<FromGitter> <j8r> Not sure it's due to that
<repo> dang
<FromGitter> <j8r> If you are using packages from older Alpine versions, depending of the older libevent, you will have issues
<FromGitter> <j8r> because a new one is out, and all packages depending of it were rebuilt
<FromGitter> <j8r> that's why I changed the Dockerfile to use a statically-linked `shards`
<repo> ah
<repo> ok
<FromGitter> <j8r> Another new thing is `libxml2-dev` now depends on `xz-dev`. I fixed earlier this day
<FromGitter> <j8r> But sorry, what was your issue exactly?
<FromGitter> <j8r> Ok, :/
<FromGitter> <j8r> And the source?
<FromGitter> <j8r> (Dockerfile)
<FromGitter> <j8r> when do you build it?
<repo> i just did
<FromGitter> <j8r> Hum don't know, you can try using the edge image instead, which use shards `0.9.0`
<repo> jrei/crystal-alpine:0.31.1-edge?
<FromGitter> <j8r> ho sorry, 0.31.1 is already based on edge
<FromGitter> <j8r> I rebuild the image
<repo> mmh
<repo> should i try again?
<FromGitter> <j8r> Sometimes `edge` is broken
<FromGitter> <j8r> In 15 minutes
<repo> ok
<FromGitter> <j8r> you can try with `jrei/crystal-alpine:edge`
<FromGitter> <j8r> and `jrei/crystal-alpine:latest`
<repo> will do
alexherbo257 has joined #crystal-lang
<FromGitter> <wontruefree> shameless plug for Chicago Crystal! Come watch @asterite speak on how the magic in crystal works chicagocrystal.org/events/bbhsjryzqbhb/
alexherbo25 has quit [Ping timeout: 240 seconds]
<FromGitter> <asterite> If you want, give me an email and I'll send you the slides I have so far
ht_ has joined #crystal-lang
<FromGitter> <vlazar> ❤️
<FromGitter> <vlazar> waiting for recorded video
HumanG33k has quit [Ping timeout: 268 seconds]
HumanG33k has joined #crystal-lang
Human_G33k has joined #crystal-lang
duane has quit [Ping timeout: 250 seconds]
baweaver has quit [Ping timeout: 250 seconds]
Human_G33k has quit [Remote host closed the connection]
DTZUZU has quit [Quit: WeeChat 2.2]
Human_G33k has joined #crystal-lang
DTZUZU has joined #crystal-lang
duane has joined #crystal-lang
HumanG33k has quit [Ping timeout: 276 seconds]
fifr has quit [Ping timeout: 250 seconds]
fifr has joined #crystal-lang
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
adam12 has quit [Ping timeout: 250 seconds]
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 250 seconds]
adam12 has joined #crystal-lang
alexherbo257 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Client Quit]
alexherbo2 has joined #crystal-lang
return0e_ has quit [Remote host closed the connection]
return0e has joined #crystal-lang
ur5us has joined #crystal-lang
duane has quit [Ping timeout: 268 seconds]
duane has joined #crystal-lang
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
ur5us_ has joined #crystal-lang
ur5us has quit [Ping timeout: 245 seconds]
alexherbo29 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 268 seconds]
ht_ has quit [Quit: ht_]
alexherbo292 has joined #crystal-lang
alexherbo29 has quit [Ping timeout: 250 seconds]
alexherbo2924 has joined #crystal-lang
alexherbo292 has quit [Ping timeout: 250 seconds]
alexherbo2924 has quit [Quit: The Lounge - https://thelounge.chat]
<raz> is there a short-hand/macro to generate a constructor for all non-nilable properties on a class?
<raz> i keep writing empty constructors like def initialize(@foo, @bar, @batz); end - which feels wrong somehw
<FromGitter> <tenebrousedge> I would consider whether you want a struct instead
<raz> in most cases i don't
<FromGitter> <tenebrousedge> structs are kinda the workhorse data structure, and generally better for performance
<FromGitter> <tenebrousedge> but there's also nothing wrong with empty initializers
<raz> i know but their semantics make me uncomfortable. i know i'll forget them sometime and likely introduce a bug. so i only consider them for cases where performance/high-throughput is really a concern
<raz> yea the empty initializers work. they just don't feel very DRY, order of arguments depends on my mood and caffeine/alcohol level, etc. - feels like there should be something automati
<raz> c
<raz> i mostly bump into it with classes that purely serve as a data-container with include JSON::Serializable
<raz> i think JSON::Mapping used to auto-generate the constructor
<FromGitter> <Blacksmoke16> it was a bug
<FromGitter> <Blacksmoke16> that including it allowed you to call the parent constructor
<raz> yea i remember it causing me headache so i'm actually glad it's not the default anymore
<raz> but having it as an option might be handy
<FromGitter> <Blacksmoke16> if there an initialize actually defined on the parent?
<FromGitter> <Blacksmoke16> could probably do (not tested0
<raz> ah no. my memory is blurry. i don't remember the details, just that i think had some issues with constructors and json-mapping
<FromGitter> <Blacksmoke16> ```def initialize(*args, **named_args) ⏎ super *args, **named_args ⏎ ned``` [https://gitter.im/crystal-lang/crystal?at=5ddefb1bd75ad3721d12c925]
<FromGitter> <Blacksmoke16> end*
<raz> that would magically give a ctor that takes all props as arguments?
* raz scratches head
<FromGitter> <Blacksmoke16> it should, but even this doesnt work...
<raz> yeh, no biggie, i'm mostly procrastinating here. it's really just a cosmetic issue
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/833f
* FromGitter * tenebrousedge continues to mumble something about structs
<FromGitter> <Blacksmoke16> can just use `self.new`
<FromGitter> <watzon> Trying to turn this (https://core.telegram.org/schema/json) into a list of Crystal classes is proving to be an enormous pain in the ass
<FromGitter> <Blacksmoke16> gl ha
<FromGitter> <watzon> It's mainly just deciding what should be abstract and not
<FromGitter> <watzon> And for each abstract class I have to generate a mapping to use with `use_json_discriminator`
<FromGitter> <Blacksmoke16> that working out well for you?
<raz> tenebrousedge: the "problem" remans tho when using a struct. they also want an initializer (unless i'm mistaken). if i want to have setters/getters too, or use the json decorators, i have to repeat all vars in the ctor-def
<FromGitter> <watzon> I haven't even gotten there yet haha. Too busy trying to get class generation to actually work right
<raz> but, admittedly, setters should prob be avoided for structs anyway
<FromGitter> <watzon> Yeah structs should generally only have getters
<FromGitter> <Blacksmoke16> mhm
<FromGitter> <watzon> They're meant to hold immutable data
<FromGitter> <tenebrousedge> raz https://crystal-lang.org/api/0.31.1/toplevel.html#record(name,*properties)-macro
<FromGitter> <watzon> records are very handy
<raz> ohhhh, you were referring to the record macro
<raz> indeed i should take a closer look at that
<raz> that looks exactly like what i was looking for, ha
<FromGitter> <tenebrousedge> :plus1:
<FromGitter> <wontruefree> is there a way to insert a char into a string without allocating a new string?
<FromGitter> <wontruefree> I want to do something lick `str[n] = "X"`
<FromGitter> <wontruefree> but now I am doing `str = str.insert(n, "X")`
<FromGitter> <watzon> Strings are immutable, so no
<FromGitter> <watzon> The ideal thing to do if you're going to have lots of concatenation is to use `String.build`
<FromGitter> <tenebrousedge> passing a block argument to `join` can also be very useful, depending on what you're doing
<FromGitter> <wontruefree> it is harder to do String.build in what I am doing but possible
<FromGitter> <wontruefree> why are strings immutable?
<FromGitter> <wontruefree> they are on the heap right?
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/String/Builder.html could also use the builder directly
<FromGitter> <Blacksmoke16> and pass around an instance of it or something
<raz> tenebrousedge: how do i include JSON::Serializable when using the record macro?
<FromGitter> <Blacksmoke16> ```record Foo, val : Int32 do ⏎ include JSON::Serializable ⏎ end``` [https://gitter.im/crystal-lang/crystal?at=5ddf06fcc3d6795b9fe26752]
<raz> blacksmoke16: Error: can't include dynamically
<FromGitter> <Blacksmoke16> what really?
<raz> that's what she said ¯\_(ツ)_/¯
<raz> guess i'll just use the regular struct-syntax for now
<FromGitter> <Blacksmoke16> ssec i prob just spelled something wrong
<raz> nah that's exactly what i tried before you even gave the example
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/833q
<FromGitter> <Blacksmoke16> sure its not your code?
<FromGitter> <Blacksmoke16> missing an `end` or something?
<raz> what the heck
* raz re-checks
ur5us_ has quit [Ping timeout: 240 seconds]
ur5us_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> is there a use case to alter the arguments that a controller action would be executed with?
<FromGitter> <Blacksmoke16> like `/some/endpoint/1/2` but call the action with `3, 4`?
<raz> oh... dreads
<raz> blacksmoke: i had this: https://play.crystal-lang.org/#/r/833u
<raz> pebcak ;)
<FromGitter> <Blacksmoke16> that would do it