<watzon>
Right now I'm actually doing a direct port of a collection of Ruby gems and adapting them to Crystal, but I'm definitely open to suggestions and PRs if things could be done in a more portable way
<FromGitter>
<pynixwang> this is a c runtime error
<FromGitter>
<pynixwang> libsystem_platform
<FromGitter>
<pynixwang> macos c runtime?
<FromGitter>
<naqvis> looks like a seg fault, you better share crystal C interface (you imported) as well as how you are calling that. More likely problem happening on how you are passing values to FFI
<FromGitter>
<stronny> `address=0x0` is this just a null pointer?
postmodern has quit [Quit: Leaving]
<coderobe>
Hey, how would i check whether a TCPSocket is still connected? `.closed?` always returns false.
<FromGitter>
<stronny> what do you mean connected?
<FromGitter>
<pynixwang> it qt5.cr
<FromGitter>
<pynixwang> generate from qt c++ codebase
<FromGitter>
<pynixwang> so too many c++ symbol
<FromGitter>
<pynixwang> it hard to debug
<FromGitter>
<pynixwang> interface file it too large
<coderobe>
stronny: as in, the other end of the socket hasn't gone away yet..
<FromGitter>
<pynixwang> `compute_kernel_digest` looks like GL operation.
<FromGitter>
<stronny> basically there is no way to "check" it
<coderobe>
if i netcat to a TCPServer and keep doing `puts client.closed?` in a fiber i pass the client IO to, it will keep printing `false` forever, even when my netcat side goes away
<FromGitter>
<stronny> what you do is rescue exceptions that arise when the other side does go away
<coderobe>
There are no exceptions thrown.
<coderobe>
My issue is that i have literally no way to find out whether the other end is dead
<FromGitter>
<stronny> yes
<FromGitter>
<stronny> that's the sockets API for you
<FromGitter>
<stronny> you may try TCP keepalives
<FromGitter>
<stronny> you may invent some form of line control at L7
<coderobe>
read/write will just block for eternity (unless i set a timeout, but a r/w timeout doesn't tell me whether the other end just hasn't sent or processed any data, or whether the connection is gone)
<coderobe>
i should get an Errno from this...
<FromGitter>
<stronny> are you developing a network daemon?
<coderobe>
a tcp proxy.
<FromGitter>
<pynixwang> about macos CoreImage
<FromGitter>
<stronny> in my opinion Crystal is not your friend in these cases
<FromGitter>
<stronny> try pony!
<coderobe>
...
<FromGitter>
<stronny> but to answer you question directly TCP has no way to know if the connection is still okay
<FromGitter>
<stronny> no language could do that
<FromGitter>
<stronny> set a timeout on read
<FromGitter>
<stronny> I mean what do you want from kernel? How does it know why there are no packets for a port?
<coderobe>
... because the connection got a RST?
<coderobe>
i'm not literally unplugging the ethernet cable
<FromGitter>
<stronny> you'll get an exception on RST and FIN
<FromGitter>
<stronny> or a nil, depends
<FromGitter>
<stronny> or even an empty string? I don't remember off the top of my head sorry
<FromGitter>
<wout> Why doesn't `BigDecimal` have a `from_json` method? Is there a specific reason, or kjust not implemented yet?
<FromGitter>
<Blacksmoke16> i think you need to do `require "big/json"`
<FromGitter>
<wout> Aaah...
<FromGitter>
<wout> You're right. Thanks! I've been using a converter all this time. 😂️
<FromGitter>
<ImAHopelessDev_gitlab> nice @faustinoaq, happy to hear from you!!
<FromGitter>
<smalls12> is there a way to cast Int32 to Uint32? ⏎ I understand Int could be negative so how would you represent that in UInt ⏎ My question stems from Array returning Int32 for size()
<FromGitter>
<Blacksmoke16> `1.to_u32`?
<FromGitter>
<Blacksmoke16> it would either raise an `OverflowError` or wrap
<FromGitter>
<smalls12> aw really, I tried 1.as(Uint32)
<FromGitter>
<wout> What's the best one-liner to create a hash like Ruby's `Hash[:key, "value"]`? I've got `Hash.zip([:key], ["value"])` right now, but is there a more concise alternative?
<FromGitter>
<Blacksmoke16> does that just make a hash with that one key/value pair?
<FromGitter>
<Blacksmoke16> {:key => "value"}?
_ht has joined #crystal-lang
<FromGitter>
<wout> Yes, but I have to note that the key is a variable.
<FromGitter>
<smalls12> oh and thats part of stdlib
<FromGitter>
<smalls12> nice
<FromGitter>
<Blacksmoke16> are others out there that might be more advanced
<FromGitter>
<smalls12> basics should be good enough for me
ur5us has quit [Quit: Leaving]
_ht has quit [Quit: _ht]
<FromGitter>
<smalls12> @Blacksmoke16 how would one go about testing a change to the stdlib ⏎ ie. I want to test some differnet behavior with the OptionParser
<FromGitter>
<smalls12> would I have to go and build crystal myself ?
ur5us has joined #crystal-lang
<FromGitter>
<Blacksmoke16> that would be easiest
<FromGitter>
<Blacksmoke16> otherwise could just override/reopen stuff if its simple
<FromGitter>
<smalls12> I did find option_parser.cr on my system
<FromGitter>
<smalls12> it seems I can modify that on the fly
<watzon>
Is there a way to get the size of an IO that doesn't require using `gets_to_end`?
<watzon>
I'm thinking no, but it would be nice
chachasmooth has quit [Ping timeout: 246 seconds]
chachasmooth has joined #crystal-lang
confact_ has joined #crystal-lang
confact has quit [Ping timeout: 246 seconds]
confact_ is now known as confact
<watzon>
Really I just want to convert a File to a Slice easily