<FromGitter>
<naqvis> might be worth if it you can raise a RFC
<FromGitter>
<Blacksmoke16> ill check for an existing issue tomorrow and make one if not
<FromGitter>
<naqvis> as this suggestion will get lost on gitter and difficult to see for others joining late
<FromGitter>
<tenebrousedge> I feel like that one has come up before
<FromGitter>
<naqvis> iirc there was whole lot of debate of having symbols removed
<FromGitter>
<Blacksmoke16> yes, i would like that :P
postmodern has joined #crystal-lang
<postmodern>
when you type in a floating point literal, is it a Float32 or Float64? I'm getting weird rounding issues in this algorithm I ported from chunky_png for converting RGB<->HSL/HSV
<postmodern>
think it may be related to single vs double precission
<FromGitter>
<RespiteSage> Is there a way to check whether one numeric type is coercable to another?
<FromGitter>
<tenebrousedge> which types?
<FromGitter>
<tenebrousedge> like you can try it and see if it goes boom
<FromGitter>
<RespiteSage> Yeah, but I'm trying to avoid exception handling as logic. That's the way my shard (saline (https://github.com/RespiteSage/saline)) currently works, and I want to improve its speed.
<FromGitter>
<tenebrousedge> I mean you can just take a look at how many bits you have and whether they're signed
<FromGitter>
<RespiteSage> I'm thinking that what I want doesn't actually exist in the language. For some reason, I thought that the numeric types had `#to_i?`-style methods.
<FromGitter>
<RespiteSage> Yeah, that's probably what I need to do. Thanks.
<FromGitter>
<tenebrousedge> I think they might
<FromGitter>
<tenebrousedge> but getting a nullable type isn't going to be an improvement, that's just a different way of doing error handling
<FromGitter>
<RespiteSage> All I see are `#to_iX`, which throws an exception on overflow, and `#to_iX!`, which wraps on overflow (where `X` is a bit-length).
<FromGitter>
<RespiteSage> And similarly for floats, unsigned ints, etc.
<FromGitter>
<tenebrousedge> I must have been thinking of the wrapping thing
<FromGitter>
<RespiteSage> Yeah, same here. Or I was getting mixed up with strings.
<FromGitter>
<elementio:salt-rock-lamp.ems.host> does crystal have a formal grammar? if so, it might be nice to have a tree-sitter parser for it
<FromGitter>
<ryanstout> I'm trying to convert a c uint16 array to a crystal uint16 array. (from a c-binding). Can anyone point me to where the `as` pseudomethod is implemented in the compiler. (Having the toughest time finding it).
<FromGitter>
<Blacksmoke16> pretty sure `.as` is for reducing unions, dont think thats what you want here?
<FromGitter>
<oprypin:matrix.org> cant go from C pointer to crystal array, you cant pass ownership of C-allocated memory to crystal, crystal only wants to deal with GC-allocated memory
<FromGitter>
<oprypin:matrix.org> if possible, u should allocae memory in crystal, pass that to the C lib, and let it fill that
<FromGitter>
<oprypin:matrix.org> if not possible, just .. yeah not possible
<FromGitter>
<ryanstout> seems like you could wrap it and let C side handle freeing right?
<FromGitter>
<ryanstout> bohem won't see it, but thats fine on my end
<FromGitter>
<ryanstout> unless the pointer being on the stack is going to mess things up
sorcus has quit [Ping timeout: 246 seconds]
<FromGitter>
<oprypin:matrix.org> @ryanstout: if it's "fine on your end" then why are you dealing with a Crystal Array at all
<FromGitter>
<ryanstout> but bohem wouldn't know it was a pointer to malloced memory right?
<FromGitter>
<ryanstout> for the bounds checks
<FromGitter>
<oprypin:matrix.org> that's a Slice then
<FromGitter>
<ryanstout> ah, good call
<FromGitter>
<ryanstout> thanks
<FromGitter>
<ryanstout> ^ coffee hasn't kicked in yet :-)
<FromGitter>
<oprypin:matrix.org> thanks for reminding, gotta grab mine
sorcus has joined #crystal-lang
Dreamer3 has quit [Quit: Leaving...]
<FromGitter>
<RespiteSage> Am I missing something with `crystal tool expand`? `crystal tool expand path/to/file` just prints the help message.
<FromGitter>
<Blacksmoke16> iirc theres some `-C` argument you need to do like `-C path/to/file:line:col`
<FromGitter>
<alex-kampa> I have a question about how to use HTTP::Client.post. Using "response = HTTP::Client.post(address, headers, msg)" I get the error
<FromGitter>
<alex-kampa> Error: no overload matches 'HTTP::Client.post' with types String, HTTP::Headers.class, String
<FromGitter>
<alex-kampa> Why can the msg not be a string?
<FromGitter>
<Blacksmoke16> `HTTP::Headers.class` you're not passing it the headers correctly
<FromGitter>
<Blacksmoke16> can you share more of the code?
<FromGitter>
<elementio:salt-rock-lamp.ems.host> So `HTTP::Client` doesn't support raw `Bytes` in the body? https://crystal-lang.org/api/1.0.0/HTTP/Client.html#post(url,headers:HTTP::Headers?=nil,tls:TLSContext=nil,*,form:String%7CIO%7CHash,&)-class-method
<FromGitter>
<Blacksmoke16> are looking at the wrong overload i think
<FromGitter>
<elementio:salt-rock-lamp.ems.host> `body` vs `form`
<FromGitter>
<tenebrousedge> So if I have a macro like ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ I get a bunch of newlines in the generated output. This is kinda obnoxious for debugging. Any way to avoid that? [https://gitter.im/crystal-lang/crystal?at=608b154aa05f8b582a15716c]
<FromGitter>
<Blacksmoke16> iirc yes, but i dont remember what i was
<FromGitter>
<Blacksmoke16> try doing like `%} \`
<FromGitter>
<tenebrousedge> huh
<FromGitter>
<tenebrousedge> those get output literally
<FromGitter>
<riffraff169> in erb it was `-%}` i believe
<FromGitter>
<tenebrousedge> syntax error
<FromGitter>
<riffraff169> actually, erb used `-%>` i think, but since this uses `}`, maybe that...hmmm
<FromGitter>
<Blacksmoke16> `%}\`
<FromGitter>
<Blacksmoke16> no space
<FromGitter>
<riffraff169> ha interesting
<FromGitter>
<tenebrousedge> Thanks @Blacksmoke16
<FromGitter>
<tenebrousedge> oh gumdrops 😾
<FromGitter>
<tenebrousedge> the bug goes away when I add `focus: true` to the failing test
DTZUZU has quit [Read error: Connection reset by peer]
DTZUZU has joined #crystal-lang
<FromGitter>
<tenebrousedge> okay, great, now it's just segfaulting :plus1:
<FromGitter>
<Blacksmoke16> lovely
<FromGitter>
<tenebrousedge> it could be that I'm just allocating my strings wrong. I'll check in a minute