Nekka has quit [Read error: Connection reset by peer]
woodruffw has joined #crystal-lang
Nekka has joined #crystal-lang
hightower4 has quit [Ping timeout: 268 seconds]
woodruffw has quit [Ping timeout: 240 seconds]
woodruffw has joined #crystal-lang
rocx has joined #crystal-lang
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
rohitpaulk has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> hi
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
woodruffw has quit [Ping timeout: 240 seconds]
woodruffw has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
_whitelogger has joined #crystal-lang
<FromGitter>
<ImAHopelessDev_gitlab> YES finally got my stash system working on the server. thank goodness for classes and hashes baby. SOOOOOOO powerful
ht_ has joined #crystal-lang
DTZUZO has quit [Ping timeout: 276 seconds]
tdc has quit [Quit: Leaving]
<FromGitter>
<watzon> Has anyone seen about getting forum.crystal-lang.org added to Tapatalk? @asterite?
<FromGitter>
<fizvlad> I've tried to create PDF version of gitbook myself but encountered lot of template errors, so I simply removed few pages which were causing errors lol
hightower3 has joined #crystal-lang
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 276 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
<hightower3>
Why are there no specific methods to make Colorize::ColorRGB convert to/from tuples easily?
<FromGitter>
<Blacksmoke16> couldn't you just do like `Colorize::ColorRGB.new *tuple`?
woodruffw has quit [Ping timeout: 268 seconds]
woodruffw has joined #crystal-lang
woodruffw has quit [Ping timeout: 268 seconds]
woodruffw has joined #crystal-lang
<hightower3>
well yeah, suppose that'd work. But I also didn't find options to convert the values to a tuple...
<hightower3>
is there anything more elegant than {rgb.red,rgb.green,rgb.blue} ?
<FromGitter>
<tenebrousedge> where are your values coming from?
<hightower3>
I have code which manipulates rgb values using tuples exclusively. I'm trying to see if I could use more of Crystal's ColorRGB objects
<hightower3>
but I suppose it doesn't really matter since they don't offer any particularly useful methods on them... so I've just done it so that I can accept ColorRGB as input to my functions, and that's it
<FromGitter>
<tenebrousedge> they're just structs
<hightower3>
yeah
* FromGitter
* tenebrousedge shrugs
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
alexherbo2 has joined #crystal-lang
dannyAAM has joined #crystal-lang
<hightower3>
Hey I have a socket, and IO::Memory with already constructed binary data in the desired endianness. What's the best way to directly write that content into the socket?
<FromGitter>
<ilanpillemer> this seems wrong to me
<FromGitter>
<watzon> You know, when coming back to Crystal after coding in Python for a while there are two things I find myself missing. Explicit imports, and list comprehensions.
<FromGitter>
<watzon> Especially the list comprehensions. Those are nice.
<FromGitter>
<lbarasti> Yes @tenebrousedge, crystal-lang/crystal#4066 looks like *the one*
<FromGitter>
<DRVTiny> Hello4all! ⏎ Does anybody knows, why empty? method was removed from Channel core class and why this change was not metnioned in Changelog, so i don't know, to look at comment for the commit, where empty? was removed ?
<FromGitter>
<lbarasti> > `include` works, sort of https://play.crystal-lang.org/#/r/7zmt ⏎ ⏎ I guess that grants you access to the module variable, but not to the `n` method itself?
<FromGitter>
<watzon> Damn that is an old ass release
<FromGitter>
<tenebrousedge> @lbarasti if it works, I guess that's what you have to use :/ I'll file that one away for when I need it next
<FromGitter>
<Daniel-Worrall> They had `#empty?` on `Channel::Buffered` and `Channel::Unbuffered` which were removed
<FromGitter>
<lbarasti> @tenebrousedge I commented on the issue, too 👍
<FromGitter>
<tenebrousedge> thank you!
<FromGitter>
<watzon> That was over 2 years ago now though. Channel isn't even defined in the same file anymore. It's now `src/channel.cr`
<FromGitter>
<DRVTiny> @Daniel-Worrall but why? :) ⏎ For example, i have to inject this method again to the Channel, so cr-dns, the only DNS library for Crystal, can work. ⏎ And i think there are good reasons to have, for example receive_nb method to receive value only it it was actually sended on the other side of the Channel. Author of cr-dns uses empty? to implement this logic.
<FromGitter>
<lbarasti> @watzon would be great to have like a mega banner on the API pages whenever you're not looking at the latest version? Akka does
<FromGitter>
<watzon> Agreed. Docs are just lacking in general imo.
<FromGitter>
<watzon> It looks like Channel was refactored pretty recently though. They must've forgot to mention that `empty?` got removed.
<FromGitter>
<lbarasti> @DRVTiny but how good would `empty?` be really, in a soon-to-be multi-threaded world?
<FromGitter>
<Daniel-Worrall> Seems it was removed in the `MT` PR. Either the removal was unintentional, or the mention of removing it was.
<FromGitter>
<Daniel-Worrall> (lack of mention)
<FromGitter>
<DRVTiny> @lbarasti there many non-blocking I/O method in modern multithreaded world :) In some cases methodology "spawn new fibers in all unclear situations" - is not comfort, so non-blocking I/O which not yield's from fiber to event loop is more suitable
<FromGitter>
<Daniel-Worrall> Can you give a usage example of `empty?`
<FromGitter>
<lbarasti> @DRVTiny what I meant is, checking for emptiness is a bit flaky, as making decisions based on that might lead to race conditions
<FromGitter>
<lbarasti> for example here: https://github.com/teknomunk/cr-dns/blob/a262e16d1213c55bc6463a999df55fa141409570/src/dns/server.cr#L46 ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ There is no guarantee that `request_channel` will be non-empty when the fiber gets to call `request_channel.receive`, unless you're assuming the program runs on a single thread - which is true right now, but won't be true in the future
<FromGitter>
<Blacksmoke16> iirc it works very similar/the same to how it does in go
<FromGitter>
<j8r> Don't use empty? for channels
<FromGitter>
<j8r> it was a bad feature, thus removed
<FromGitter>
<j8r> you can count how many fibers are spawn
<FromGitter>
<DRVTiny> @lbarasti Thank you! i'll try to understand how select works and what is intended for. I'm not very familar with Crystal but i need DNS library that works on 0.31.x, so i have no choice :)
<FromGitter>
<j8r> then receive X times
<FromGitter>
<j8r> cc @DRVTiny
<FromGitter>
<DRVTiny> @j8r what about fiber that must send something but raises exception and dont send anything. 10 fibers were spawned, i'll wait for 10 values, but fibers "forgot" to send its values. What to do next?
<FromGitter>
<DRVTiny> @Blacksmoke16 things stand more complex if code of that fibers is not my code, fibers spawned inside the shard i use :( Unfortunately many shards, not only cr-dns, written in a very "tricky"/dilettantish manner.
<FromGitter>
<Daniel-Worrall> Well, they just need to be reworked and there's no avoiding that
<FromGitter>
<j8r> propose a PR that exposes a counter, or a similar feature
<FromGitter>
<j8r> @Daniel-Worrall 💯
<FromGitter>
<DRVTiny> Fibers may not send value to channel because of mistake in its algorithm: some if branch will not be fired in some rare cases, for example. No exception and no value in the Channel. But receiver will wait it forever.
<FromGitter>
<didactic-drunk> You either 1) Tell it to wait and it waits 2) Have a timeout.
<FromGitter>
<Blacksmoke16> thats what specs are for
<FromGitter>
<lbarasti> I found this on reddit the other day, a crystal implementation of wait group: https://github.com/jasonrobot/crystal-wait-group ⏎ Might help @DRVTiny. Basically, you make sure you count down on the wait group every time a fiber terminates - you could put that in the `ensure` block so that the code will be executed even in case of exception
<FromGitter>
<DRVTiny> @lbarasti Oh, it's very similar AnyEvent's $condvar->begin, $condvar->end, $condvar->receive in Perl. Very (help|use)ful shard!