ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
maxpowa has quit [Ping timeout: 245 seconds]
maxpowa has joined #crystal-lang
chachasmooth has quit [Ping timeout: 250 seconds]
chachasmooth has joined #crystal-lang
chachasmooth has quit [Ping timeout: 245 seconds]
chachasmooth has joined #crystal-lang
<postmodern> nice, just need to wire it up. suppose i could write a shard for winsize.
<FromGitter> <kaukas_gitlab> > otherwise it seems to be because you're capturing the blocks, which need to have their input/output values/types defined beforehand as it turns the block into a proc ⏎ ⏎ Thank you for your answer! It does make a bit more sense now. Unfortunately, I am forced to rely on type inference because generics are buggy (https://github.com/crystal-lang/crystal/issues/10394)… And no, I can't just use
<FromGitter> ... `yield`; this example is strongly simplified. I feel stuck. :-(
_ht has joined #crystal-lang
<mps> riffraff169: also I'm self taught in programming (and all computing) and I designed industrial computer (long ago) and some real time national wide parking services in two countries in europe
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
<FromGitter> <confact> How to split long numbers into 3 3 number ones in a good optimized way? like 191853 to 000, 191, 853
<FromGitter> <MrSorcus> Does anyone have any openings in Crystal? X-)
postmodern has quit [Quit: Leaving]
<FromGitter> <drum445> Hi Guys, if I wanted to get the properties of a Class and their types how would I go about this? ⏎ ⏎ ```Class User ⏎ property id : String ⏎ .... ⏎ end``` ⏎ ⏎ Then I would like something like {"id" => String} [https://gitter.im/crystal-lang/crystal?at=608fd834ff705616c76ce8b0]
<straight-shoota> @confact: Assuming you're only working with integers, truncated division + remained is prob the best way to go
<FromGitter> <alsoijw> Hello everyone. I want to create array using macros. I wrote this code
<FromGitter> <alsoijw> Hello everyone. I want to create array using macros. I wrote this code ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I expect that it create array with tree elements, but it create with only last element. [https://gitter.im/crystal-lang/crystal?at=608fde280056b2262c2730a3]
<FromGitter> <erdnaxeli:cervoi.se> I don't know exactly why it does that, but this works: https://carc.in/#/r/b21e
<FromGitter> <erdnaxeli:cervoi.se> I have to declare `arr` outside of the macro, else it complains that it is not visible at top level
<FromGitter> <erdnaxeli:cervoi.se> I think that your macro expand to ⏎ ⏎ ```"a" ⏎ "b" ⏎ "c"``` ⏎ ⏎ and the return value of this block is `"c"` [https://gitter.im/crystal-lang/crystal?at=608fe340d5e2793379ec8603]
<FromGitter> <erdnaxeli:cervoi.se> the code generated from a macro must be valid crystal code *by itself*
<FromGitter> <erdnaxeli:cervoi.se> that's why this does not work: https://carc.in/#/r/b21f
<FromGitter> <erdnaxeli:cervoi.se> it is like the compiler is wrapping the macro code at top level in a method
<FromGitter> <erdnaxeli:cervoi.se> no, it does the same in a method too
<FromGitter> <alsoijw> > I don't know exactly why it does that, but this works: https://carc.in/#/r/b21e ⏎ ⏎ Thank you, it's solution.
<straight-shoota> The explanation is correct, the result of a macro must be valid crystal code. You can just wrap the array literal itself in {%begin%}...{%end%}
<FromGitter> <Blacksmoke16> @drum445 use `@type.instance_vars` in a method and use it to build out the hash
mps has quit [Ping timeout: 252 seconds]
<FromGitter> <MrSorcus> Looks like no one does. :sad:
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #crystal-lang
<FromGitter> <djberg96> loop preemption in Go: https://www.youtube.com/watch?v=1I1WmeSjRSw
<FromGitter> <djberg96> not sure if relevant to Crystal (?)
<yxhuvud> not really, crystal only has cooperative scheduling (though it happens automatically when doing io)
<straight-shoota> @MrSorcus Maybe look in the forum? More people there.
<FromGitter> <MrSorcus> @straight-shoota hmm, forum. I've forgot about forum...
<mipmip> quit
ua has quit [*.net *.split]
fifr` has quit [*.net *.split]
woodruffw has quit [*.net *.split]
f1refly has quit [*.net *.split]
fifr` has joined #crystal-lang
woodruffw has joined #crystal-lang
ua has joined #crystal-lang
f1refly has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<FromGitter> <ahcm> hoi
<FromGitter> <Blacksmoke16> `case filenames` no need for `typeof()`
<FromGitter> <ahcm> thanks
<jhass> damn, too slow. https://play.crystal-lang.org/#/r/b25v yeah, just do less work :D
<FromGitter> <ahcm> What keeps the compiler from understanding it otherwise?
<FromGitter> <Blacksmoke16> could also use `in` instead of `when` for exhaustive case https://crystal-lang.org/reference/syntax_and_semantics/case.html#union-type-checks
<FromGitter> <oprypin:matrix.org> @ahcm: `case` is implemented as `===`, and `filenames == Array` is implemented as `filenames.is_a?(Array)`. however `typeof(filenames).is_a?(Array)` is false
<jhass> https://play.crystal-lang.org/#/r/b25y even less work, even more compile-time safety
<FromGitter> <Blacksmoke16> 🚀
<jhass> also if filenames and ARGV has to do anything with your real usecase, check ARGF
<FromGitter> <ahcm> thanks
wmoxam has joined #crystal-lang
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
sagax has joined #crystal-lang