Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
willl has quit [Quit: Connection closed for inactivity]
am_ has quit [Ping timeout: 240 seconds]
Oliphaunte has quit [Remote host closed the connection]
Yxhvd has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
onethirtyfive has quit [Remote host closed the connection]
nickc1 is now known as nickc
pawnbox has quit [Ping timeout: 265 seconds]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
txdv_ is now known as txdv
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Client Quit]
Yxhuvud has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
<jhass>
binary123: the plan is that the runtime spawns a pool of threads on which the fibers/coroutines are run, so you wouldn't deal with them yourself, your concurrency primitives are spawn and Channel
bjz has joined #crystal-lang
ponga has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
mark_66 has joined #crystal-lang
Kurisu has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
Kurisu has quit [Ping timeout: 264 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
<jeromegn>
this one line is a smaller example: puts String.new StaticArray[113u8, 9u8, 113u8, 113u8, 60u8, 62u8, 113u8, 50u8, 38u8, 1u8, 255u8].to_slice
<jhass>
don't really want to do UTF-8 detection on the output and then hexdump or whatever
<jhass>
and oh well, IMO String.new should already bail on it
<jeromegn>
jhass: that’s the error I was trying to get haha! I’m getting this in my program, but I can’t figure out why. so I was trying to show it here and get some help :)
<jeromegn>
because this works fine: crystal eval "puts String.new StaticArray[113u8, 9u8, 113u8, 113u8, 60u8, 62u8, 113u8, 50u8, 38u8, 1u8, 255u8].to_slice"
<jhass>
yeah IMO it shouldn't
<jeromegn>
right, I’m working on a protobuf decoder (I’m real close) and for some reason this UTF 8 string is difficult to decode and parse into a crystal string
<jhass>
it's not a UTF-8 string
<jhass>
0xff (255) is not a valid UTF-8 byte
<jhass>
the highest valid UTF-8 byte is 0xf7 or something
<jeromegn>
mmm
<jeromegn>
"q\tqq<>q2&\001\377"
<jeromegn>
I can’t replicate it when not decoding from protobuf… which is the hard part of debugging this
<jhass>
377 is octal for 255
Oliphaunte has joined #crystal-lang
<jhass>
where is that from? what do you get for the source when decoding with an existing implementation?
<FromGitter>
<sumproxy> I have a question about 'moves': does crystal support them. I mean if I have a struct which is stack allocated that has a pointer to heap allocated data will the data on the heap be copied or just the pointer. Anyway I'm looking for clarifications on this topic if there's any
<jhass>
pretty sure only the pointer
<jhass>
anything else wouldn't make any sense to me
<BlaXpirit>
sumproxy, seems quite clear to me and should be clear to you because you understand how pointers work. the default copy operation is to copy all data byte by byte, so the pointer is copied, and data it points to has no reason to be copied
<FromGitter>
<sumproxy> right, so the same would be if I had a struct with a class member?
<jhass>
that's just never copied, it's a global
<BlaXpirit>
it makes you think for a moment, but yes
<FromGitter>
<sumproxy> a class member is a global?
<BlaXpirit>
jhass misunderstood the question
<jhass>
what's a class member then?
<BlaXpirit>
a member which is a class
<jhass>
oh
<FromGitter>
<sumproxy> exactly
<jhass>
I thought you meant class variable
<FromGitter>
<sumproxy> no
<FromGitter>
<sumproxy> thanks guys
<jhass>
mh, I'm actually not sure what the crystal generates for class, I guess the type tag?
<Papierkorb>
can I use StaticArray(T,N) inside a lib struct to? Or should I do something like "unused1, unused2, ... : UInt8" ?
<Papierkorb>
-to
<BlaXpirit>
Papierkorb, sure, you can use, there's even a special syntax T[N]
<jhass>
struct Foo; _dummy : UInt8[48]; end is in fact a common way to define an opaque struct you have to allocate still
<BlaXpirit>
if only that size was always predictable
<jhass>
well, thank the C folks :P
<Papierkorb>
it adds padding at the end?
<BlaXpirit>
Papierkorb, i dunno, probably
<BlaXpirit>
does whatever C does
<Papierkorb>
Next issue: I have a string in the structure exactly 22 bytes in length. In C, I'd just do `char name[22];` - Is there something better than `name : UInt8[22]` in crystal for that?
<BlaXpirit>
LibC::Char[22] but it's exactly the same
mark_66 has quit [Quit: Leaving.]
pawnbox has quit [Remote host closed the connection]