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
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #crystal-lang
sagax has quit [Ping timeout: 264 seconds]
entel has quit [Quit: Connection closed for inactivity]
<watzon> Can anyone see any potential issues with this? https://carc.in/#/r/agjn
<watzon> Trying to make my own Int128 and Int256 types that wrap BigInt and can be written to a byte slice using IO::ByteFormat
<FromGitter> <oprypin:matrix.org> watzon, hold up, im pretty sure you don't need to reopen the byteformat module
<watzon> No?
<watzon> `write_bytes` requires that IO::ByteFormat have a method to handle that particular type.
<watzon> I could just implement `write_bytes` for the type, but that also doesn't take into account writing to a `Bytes` object. It just works for `IO`.
<FromGitter> <oprypin:matrix.org> no it requires that the object has a `to_io` method
<FromGitter> <oprypin:matrix.org> see the link
<watzon> `to_io` relies on `IO::ByteFormat` though, and still only works for IOs
<FromGitter> <oprypin:matrix.org> IO::Memory writes into a Bytes object
<FromGitter> <oprypin:matrix.org> hold up
<watzon> I already implemented to_io locally, but it uses `IO::ByteFormat` underneath
<FromGitter> <oprypin:matrix.org> watzon, yeah you know what, what you're doing is best
<FromGitter> <oprypin:matrix.org> watzon, the implementation looks a bit odd in that it never uses `bytesize`
<FromGitter> <oprypin:matrix.org> the slice should be enforced to a fixed size, right?
<watzon> Not necessarily fixed, but I should probably validate that the slice has enough capacity
<watzon> Then again the other ByteFormat methods don't. Pretty sure they just rely on the overflow error.
<FromGitter> <oprypin:matrix.org> @watzon the difference is that those methods can't write too much but i think your impl can
<FromGitter> <oprypin:matrix.org> well maybe not if you're enforcing it at creation
<FromGitter> <oprypin:matrix.org> watzon, actually now i remember what I wanted to say
<FromGitter> <oprypin:matrix.org> a 16 bit integer always serializes to 2 bytes
<FromGitter> <oprypin:matrix.org> what do you mean io.gets_to_end lol
<FromGitter> <oprypin:matrix.org> you need to get exactly N bytes
<FromGitter> <oprypin:matrix.org> and when serializing you need to write exactly N bytes
<watzon> Ahh yeah you’re right there. I do need to get the right number of bytes.
<watzon> This is why I wanted extra eyes haha
<FromGitter> <oprypin:matrix.org> the bytesize is always exact - no difference from this code https://github.com/crystal-lang/crystal/blob/5999ae29beacf4cfd54e232ca83c1a46b79f26a5/src/io/byte_format.cr#L141
<FromGitter> <oprypin:matrix.org> and pass that constant size to libgmp, not the calculated one
<FromGitter> <oprypin:matrix.org> not the slice's size i mean
<watzon> Yeah good idea
<watzon> Thanks man
entel has joined #crystal-lang
_ht has joined #crystal-lang
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 268 seconds]
<FromGitter> <HertzDevil> `-1.unsafe_chr.ascii? # => true`
<FromGitter> <erdnaxeli:cervoi.se> it should probably be `0 < ord < 128`
Human_G33k has joined #crystal-lang
Nekka_ has joined #crystal-lang
coderobe9 has joined #crystal-lang
justinmcp_ has joined #crystal-lang
jrayhawk_ has joined #crystal-lang
alexherbo2 has joined #crystal-lang
HumanG33k has quit [*.net *.split]
Nekka has quit [*.net *.split]
coderobe has quit [*.net *.split]
jrayhawk has quit [*.net *.split]
justinmcp has quit [*.net *.split]
Nekka_ is now known as Nekka
coderobe9 is now known as coderobe
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 264 seconds]
<straight-shoota> unsafe_chr on a negative value should be expected to show undefined behaviour
<FromGitter> <HertzDevil> are negative chars a different failure condition than chars above 0x10ffff
<FromGitter> <HertzDevil> in `Char#bytesize` for example
<straight-shoota> I suppose they're both out of range
<straight-shoota> so yeah, raising for one side but not the other doesn't make sense
alexherbo2 has joined #crystal-lang
alexherbo29 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo29 is now known as alexherbo2
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #crystal-lang
teardown has quit [Ping timeout: 268 seconds]
<FromGitter> <JoeeGrigg> Hi, I am trying to use JSON mapping but when I try to use even the examples given by the JSON module I get the error `Error: undefined method 'mapping' for JSON:Module`. Can anybody help me please?
teardown has joined #crystal-lang
<FromGitter> <Blacksmoke16> JSON mapping has been deprecated, see https://crystal-lang.org/api/master/JSON/Serializable.html instead
<FromGitter> <JoeeGrigg> That has got passed the error. Thanks :)
<straight-shoota> Probably looked at some older docs?
<FromGitter> <jrei:matrix.org> looks like using lld vs bfd linker is faster
<FromGitter> <jrei:matrix.org> but the most time is spent on codegen, thus it is a bit worthless
<FromGitter> <jrei:matrix.org> I confirm, twice as fast. Usually the linking takes at worst 2 seconds for really big programs like the compiler
alexherbo2 has quit [Ping timeout: 265 seconds]
jrayhawk_ is now known as jrayhawk
alexherbo2 has joined #crystal-lang
<watzon> Yeah codegen is usually the slow part
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo2 has joined #crystal-lang
andremed- has joined #crystal-lang
raz has quit [Excess Flood]
yxhuvud has quit [Write error: Broken pipe]
chachasmooth_ has quit [Quit: Quit]
deavmi has quit [Quit: No Ping reply in 180 seconds.]
^ has quit [Remote host closed the connection]
Nekka_ has joined #crystal-lang
chachasmooth has joined #crystal-lang
yxhuvud has joined #crystal-lang
^ has joined #crystal-lang
avane_ has joined #crystal-lang
badeball_ has joined #crystal-lang
wmoxam has quit [Write error: Broken pipe]
early has quit [Quit: Leaving]
Seich has quit [Quit: Gone fishing.]
Flipez has quit [Quit: Ping timeout (120 seconds)]
Stephanie has quit [Quit: Fuck this shit, I'm out!]
coderobe has quit [Quit: Ping timeout (120 seconds)]
deavmi has joined #crystal-lang
Nekka has quit [Quit: zzz]
Nekka_ is now known as Nekka
Human_G33k has quit [Remote host closed the connection]
hpyc9 has quit [Quit: 420]
early has joined #crystal-lang
teardown has quit [Remote host closed the connection]
hendursa1 has quit [Remote host closed the connection]
hpyc9 has joined #crystal-lang
teardown has joined #crystal-lang
Stephie has joined #crystal-lang
Human_G33k has joined #crystal-lang
asterite_ has joined #crystal-lang
teardown has joined #crystal-lang
teardown has quit [Changing host]
badeball has quit [Write error: Broken pipe]
holst has quit [Write error: Broken pipe]
ua_ has quit [Excess Flood]
skrzyp has quit [Remote host closed the connection]
tskalyo has quit [Ping timeout: 246 seconds]
hendursa1 has joined #crystal-lang
raz has joined #crystal-lang
justinmcp has joined #crystal-lang
hamoko[m] has quit [Ping timeout: 240 seconds]
ua_ has joined #crystal-lang
justinmcp_ has quit [Write error: Broken pipe]
andremedeiros has quit [Quit: ZNC 1.8.2 - https://znc.in]
andremed- is now known as andremedeiros
Liothen has quit [Ping timeout: 264 seconds]
Liothen has joined #crystal-lang
hendursa1 has quit [Client Quit]
deavmi has quit [Ping timeout: 260 seconds]
coderobe has joined #crystal-lang
hendursaga has joined #crystal-lang
oz has quit [Quit: EOF]
watzon has quit [Ping timeout: 240 seconds]
asterite has quit [Quit: Bye]
asterite_ is now known as asterite
avane has quit [Quit: ZNC - https://znc.in]
avane_ is now known as avane
wmoxam has joined #crystal-lang
deavmi has joined #crystal-lang
_ht has quit [Remote host closed the connection]
tskalyo has joined #crystal-lang
_whitelogger has joined #crystal-lang
watzon has joined #crystal-lang
^ has quit [Quit: We're here. We're queer. Connection reset by peer]
duane has quit [Ping timeout: 272 seconds]
^ has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 256 seconds]