ur5us has quit [Remote host closed the connection]
dwdv has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter>
<watzon> It would be cool if we have the Crystal playground be like the ponylang playground and have the option to show the LLVM IR and ASM output
<FromGitter>
<watzon> I've seen some other ones that have it too
<FromGitter>
<watzon> Dark mode would also be nice to have
Creatornator has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
ht_ has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #crystal-lang
ht_ has quit [Quit: ht_]
_whitelogger has joined #crystal-lang
kotrcka has quit [Remote host closed the connection]
<FromGitter>
<bnsv> Hi All, what is the meaning of this error when running a kemal app, thank you. ⏎ ⏎ > In lib/kemal/src/kemal/base_log_handler.cr:4:31 ⏎ > ⏎ > 4 | class Kemal::BaseLogHandler < HTTP::Handler ... [https://gitter.im/crystal-lang/crystal?at=5deb753cb065c6433c52e15d]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
<foxxx0>
good morning. when i'm spawning fibers that have interconnected channels and i want to wait for all fibers to return before i continue, how would i do that?
<foxxx0>
do i need control-channel for the fiber and wait for them to send e.g. "finished" there and have blocking receive calls on the control channel?
<foxxx0>
yep, that seems to work
<FromGitter>
<bew> yes that's the way to go foxxx0 :)
<foxxx0>
works like a charm, slowly i'm getting the hang of it
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
DTZUZO has joined #crystal-lang
dwdv has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
HumanG33k has quit [Ping timeout: 240 seconds]
tleydxdy has quit [Quit: killed]
olbat[m] has quit [Quit: killed]
HumanG33k has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 245 seconds]
DTZUZO has joined #crystal-lang
Human_G33k has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
HumanG33k has quit [Ping timeout: 268 seconds]
tleydxdy has joined #crystal-lang
olbat[m] has joined #crystal-lang
beepdog has joined #crystal-lang
erdnaxeli has joined #crystal-lang
ternarysolo has joined #crystal-lang
DTZUZO has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
hightower2 has quit [Ping timeout: 276 seconds]
sagax has quit [Read error: Connection reset by peer]
duane has quit [Ping timeout: 268 seconds]
sagax has joined #crystal-lang
duane has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
duane has quit [Ping timeout: 246 seconds]
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #crystal-lang
Creatornator has joined #crystal-lang
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #crystal-lang
<FromGitter>
<johnpyp> Is there a shorthand way to cast a type of (T | Nil) to T at runtime, because you know that an invariant has been met that allows you to bypass the nil check? I know you can do `.as(T)`, but that gets cumbersome
<FromGitter>
<Blacksmoke16> `not_nil`?
<FromGitter>
<Blacksmoke16> only if you know for sure it wont be nil tho
<FromGitter>
<tenebrousedge> `try` also can be used
<FromGitter>
<Blacksmoke16> thats what `not_nil!` does tho
<FromGitter>
<johnpyp> Isn't it?
<FromGitter>
<Blacksmoke16> ` converts any value to a non-null type and throws an exception if the value is null`
<FromGitter>
<Blacksmoke16> exactly yes
<FromGitter>
<johnpyp> ah, yeah I mean it would be nice to have a shorthand syntax like what kotlin does (just for brevity), like `!!`
<FromGitter>
<Blacksmoke16> :shrug: ideally you shouldnt have to use it often
<FromGitter>
<Blacksmoke16> and crystal isnt a fan of aliases, which that essentially would be
<FromGitter>
<johnpyp> gotcha
<FromGitter>
<tenebrousedge> also `!!` is already a thing
<FromGitter>
<Blacksmoke16> naw its just `!` twice
<FromGitter>
<Blacksmoke16> but would cause some confusion thats for sure
<FromGitter>
<tenebrousedge> but since it's the quickest way to cast to a boolean, it's presumably used in a fair amount of real code
<FromGitter>
<tenebrousedge> so it's not an operator *per se*, but it's a common technique in Crystal and most other Algol derivatives, and if you used `!!` to get rid of `Nil` then you would have to find some other way to express `!!`
<FromGitter>
<Blacksmoke16> Technically `!!` gets rid of `Nil` :trollface:
<FromGitter>
<r00ster91> when i call a macro inside a method, is it in the macro possible to receive the name of the method that called it?
<FromGitter>
<Blacksmoke16> prob can use `{{@def.name}}` within the macro
<FromGitter>
<r00ster91> ah yeah forgot about that special variable
<FromGitter>
<watzon> Crap, so it's not possible to decode `Bytes` into a `BigInt`?
<FromGitter>
<watzon> With `IO::ByteFormat`
<FromGitter>
<tenebrousedge> you can probably do `unsafe_as` to get it to an `Int` of some sort, but I don't know how `BigInt` works
<FromGitter>
<Blacksmoke16> i.e. like `BigInt.new String.new bytes` that would prob do it...
<FromGitter>
<Blacksmoke16> idk if its the *best* way to do it tho
<FromGitter>
<watzon> Unfortunately I don't think that will do it. The bytes represent data, not a number. So in this case I end up with an `Invalid BigInt` exception
<FromGitter>
<Blacksmoke16> gotcha
<FromGitter>
<bew> @watzon `IO::ByteFormat` works for normal integer/floats because their binary representation is widely known and it basically "casts" the memory region as the target type and returns that. The binary representationof Big* is not widely known as far as I know, so unless your data is a binary dump of a Big* you'll have to convert it some other way
<FromGitter>
<watzon> Yeah that's what I'm figuring out
<FromGitter>
<watzon> Crap
<FromGitter>
<tenebrousedge> so why are you trying to treat data like a number, anyway?
<FromGitter>
<bew> what is your data?
<FromGitter>
<watzon> It's for encrypting a payload using RSA
<FromGitter>
<watzon> The data should be 256 bytes though
<FromGitter>
<watzon> So it shouldn't be too hard
<FromGitter>
<watzon> cls
<FromGitter>
<tenebrousedge> how are you transforming it?
<FromGitter>
<bew> offtopic: yay I finished day3 of advent of code :P
<FromGitter>
<tenebrousedge> @bew what's your code like?
<FromGitter>
<bew> will put it on the forum once I cleaned it
<FromGitter>
<watzon> It's pretty easy to get bytes from a hex string it
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter>
<watzon> Since Crystal doesn't have good RSA support yet, and I don't feel like implementing it myself right now, this seemed like the easiest way around it
* FromGitter
* tenebrousedge pokes it with a stick
<FromGitter>
<watzon> Because apparently "aes-256-ige" doesn't work
<FromGitter>
<watzon> AES256 does, but I need the IGE variant 😢
<FromGitter>
<mavu> advent of code day 7. I think its time for bed. ⏎ My code is producing almost the correct solutions for the tests, but the last digit is missing. ⏎ When I went looking for the problem, I noticed that my code *should NOT* be working. ⏎ I now have a solution that almost works, and that I myself, after writing it, don't understand. [https://gitter.im/crystal-lang/crystal?at=5dec241bf65fec1c8ede64f7]
<FromGitter>
<mavu> > .>
<FromGitter>
<tenebrousedge> that happens. Usually for me it's when I do actually fix it
<FromGitter>
<bew> lol, good luck trying to sleep without thinking about it
<FromGitter>
<tenebrousedge> "Yay, it works! ...Wait, what does this even do, again?"
<FromGitter>
<mavu> Yes, sleep will help, even if I will keep thinking about it )
<FromGitter>
<mavu> found it. Still running fiber when the program ends. have to add a Fiber.yield.
<FromGitter>
<mavu> Is there a kind of "ps aux" for fibers?
<FromGitter>
<watzon> Can someone that understands C a little better tell me what exactly the GET and PUT macros are doing here? And maybe the Crystal equivalent?
<FromGitter>
<christopherzimmerman> I get that unsafe as takes the pointer of whatever is being passed, but in this context, isn't GET typecasting to a uInt32 pointer, and not a uint32?
<FromGitter>
<watzon> Yeah, and then PUT is setting the value of that pointer
<FromGitter>
<christopherzimmerman> In crystal you probably wouldn't be passing by reference like this though.
<FromGitter>
<bew> hum I may be wrong indeed, @watzon p is a pointer?
<FromGitter>
<bew> if so, then `*((uint32_t *)(p))` is basically dereferencing p and getting a uint32 out of it (even if p was a pointer to some other type)
<FromGitter>
<bew> what are you binding?
<FromGitter>
<watzon> In this case not binding, I'm trying to port some C code to pure Crystal
<FromGitter>
<watzon> Some AES stuff
<FromGitter>
<bew> 🙏 I'm praying for you :D
<FromGitter>
<watzon> Lol I'll need it
<FromGitter>
<watzon> I've definitely seen worse C code
<FromGitter>
<watzon> Half of it is defining lookup tables
<FromGitter>
<bew> nice, note that lookup tables are not optimzed by cr compiler, meaning that if you put them in constants, there will be some (small) time at the program launch to create those lookup tables (C does not have this overhead, as the lookup tables are embedded directly in the compiled bianry)
<FromGitter>
<watzon> Hmm, even stored as StaticArrays?
<FromGitter>
<bew> don't know..
<FromGitter>
<watzon> I figured that StaticArrays would actually be embedded into the binary since they're known at compile tile
<FromGitter>
<watzon> Either way, not a huge deal
<FromGitter>
<bew> true! btw how are you creating the static arrays?