jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.7 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
<xmgx> There's a way to clone a LineIterator?
kulelu88 has quit [Quit: Leaving]
xmgx has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
woodruffw has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
woodruffw has joined #crystal-lang
woodruffw has quit [Excess Flood]
woodruffw has joined #crystal-lang
woodruffw has quit [Excess Flood]
woodruffw has joined #crystal-lang
woodruffw has quit [Excess Flood]
woodruffw has joined #crystal-lang
ponga has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
txdv has quit [Quit: leaving]
mark_66 has joined #crystal-lang
txdv_ has joined #crystal-lang
txdv_ has quit [Client Quit]
txdv has joined #crystal-lang
txdv has quit [Client Quit]
txdv has joined #crystal-lang
onethirtyfive has joined #crystal-lang
akwiatkowski has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox_ has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox_ has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
<crystal-gh> [crystal] ysbaddaden closed pull request #3184: Logger#close nilable error fix (master...patch-1) https://git.io/v6DJr
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
pawnbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#07964d0 (master - Merge pull request #3184 from Exilor/patch-1): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/154388529
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
<BlaXpirit> is there any way to get rid of negative indices in an array?
<BlaXpirit> I hoped to be able to write `chunks.at(i - 1) { empty_chunk }` instead of `i > 0 ? chunks[i-1] : empty_chunk`
<BlaXpirit> i think `at` should not deal with negative indices
tomchapi_ has joined #crystal-lang
tomchapin has quit [Ping timeout: 252 seconds]
Philpax has quit [Ping timeout: 250 seconds]
Philpax has joined #crystal-lang
<FromGitter> <jmoriau> something like this? https://play.crystal-lang.org/#/r/17g6/edit
<FromGitter> <jmoriau> @blaxpirit
Philpax has quit [Ping timeout: 258 seconds]
<BlaXpirit> jmoriau, yes. well sure, i know how to code that, but that's not the point
<FromGitter> <jmoriau> ah the point is to get it int he stdlib then ?
<BlaXpirit> well yes
xmgx has joined #crystal-lang
<BlaXpirit> i also hate how range indexing behaves
<BlaXpirit> why is it such a special case that the left index must be inside range???
<FromGitter> <jmoriau> maybe introduce 2....4 to have neither 2 nor 4 :D
<BlaXpirit> oh no, I don't mean that
<BlaXpirit> >> [1, 2, 3][-3...3]
<DeBot> BlaXpirit: # => [1, 2, 3] - https://carc.in/#/r/17g8
<BlaXpirit> >> [1, 2, 3][-4...3]
<DeBot> BlaXpirit: Index out of bounds (IndexError) - https://carc.in/#/r/17g9
<BlaXpirit> >> [1, 2, 3][-3...4]
<DeBot> BlaXpirit: # => [1, 2, 3] - https://carc.in/#/r/17ga
<FromGitter> <jmoriau> I see your point
<FromGitter> <jmoriau> I guess it's just familiar this way
<BlaXpirit> but it isn't?
<FromGitter> <jmoriau> didn't it used to be this way in ruby?
<BlaXpirit> yes but ruby sucks
<FromGitter> <jmoriau> yeah but that's why it's familiar
<FromGitter> <jmoriau> not saying it's good just familiar
<FromGitter> <jmoriau> >> [1,2,3][4..-3]
<FromGitter> <jmoriau> sad doesn't work in gitter
<BlaXpirit> nope, the bot doesn't read those messages because in irc they have your nickname as part of the actual message
<FromGitter> <jmoriau> ah ok
<BlaXpirit> something could be done about this
<BlaXpirit> >> [1,2,3][4..-3]
<DeBot> BlaXpirit: Index out of bounds (IndexError) - https://carc.in/#/r/17gb
<FromGitter> <jmoriau> well at least it's consistent
jsaak_ has quit [Quit: leaving]
akwiatkowski has quit [Quit: Konversation terminated!]
<steenuil> hi, can you get information about a method such as arity or type restrictions of the arguments in Crystal?
<steenuil> in Ruby you can get the arity by doing {Class}.method(:m).arity
<steenuil> I was wondering if you could do something similar
<FromGitter> <Sija> There's `Proc#arity` but IMO that would it for runtime land
<FromGitter> <Sija> other than that, you can use macro to inspect the objects during compile-time
<steenuil> oh right, that's a good idea
<steenuil> thanks!
<BlaXpirit> hm I don't see how to access information about a top level method
<BlaXpirit> >> class C; def f(x,y,z); end; end; {{ C.methods[0].args.size }}
<DeBot> BlaXpirit: # => 3 - https://carc.in/#/r/17gd
<BlaXpirit> but here's something to get you started, steenuil
<steenuil> yeah I see, thank you
soveran has quit [Remote host closed the connection]
mkl0501 has joined #crystal-lang
mark_66 has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 276 seconds]
pawnbox has quit [Remote host closed the connection]
ponga has quit [Quit: Connection closed for inactivity]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
onethirtyfive has quit [Remote host closed the connection]
buggs has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 244 seconds]
mkl0501 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 276 seconds]
kulelu88 has joined #crystal-lang
tomchapin has joined #crystal-lang
Ven has joined #crystal-lang
Ven has quit [Client Quit]
<FromGitter> <ttdonovan> @jeromegn good job with https://github.com/jeromegn/protobuf.cr - I like the `include` over sub-classing of Protokol
<FromGitter> <ttdonovan> How are you planning to transmit IO? I tried looking at gRPC and the Ruby gem but it was way over my abilities to port and bind the C libraries.
<jeromegn> @ttdonovan thanks :) I’ve mostly built it to write a Mesos framework, which prefers protobuf for communication. It’s through HTTP, so I just convert the io to a string and send it with the correct headers
<jeromegn> the include allows to create structs and classes, the former is much more efficient :D
<jeromegn> there is some logic that checks for recursive structs and will use a class in that case.
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<FromGitter> <ttdonovan> OK, thanks - sounds like HTTP is the best option right now.
<FromGitter> <ttdonovan> I'm really enjoying Crystal and am looking for opportunities to create micro-services and roll into my companies current stack.
perks has joined #crystal-lang
<RX14> jeromegn, can you please use Benchmark.ips for your benchmarks
<RX14> it's much much more readable and a more useful statistic
<jeromegn> I probably can yes.
<jeromegn> going to look it up
<RX14> just do a run for each of creation encoding and ecoding
<RX14> wish you could import ruby Benchmark.ips results into crystal
aldum has left #crystal-lang [#crystal-lang]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
<jeromegn> how do I convert a LibC::Char** to an array of string?
tomchapin has joined #crystal-lang
<pabs> jeromegn: if it's the string you're pointing at is null-terminated, wouldn't String.new(ptr.value.as(Pointer(UInt8))) do what you want?
<pabs> (where ptr is the LibC::Char** you're referring to)
<jeromegn> right hmm
<jeromegn> I can get the first value out like that yes
<pabs> it's an array of strings?
<pabs> oh, i see, array of strings
<jeromegn> pretty sure :D haha. it’s a struct with a “count” and “data”, the count is an Int32 and data is LibC::Char**. that struct is named StringVector :)
<jeromegn> doing it once, I get the right value for the first item, but I know there are 2 items in there
<jeromegn> I’m basically writing the bindings for the zookeeper client
<jeromegn> too lazy to make a native one
<pabs> something like r = [] of String; count.times { |i| r << String.new((ptr + i).value.as(Pointer(UInt8)) } # (untested)
<jeromegn> oh
<jeromegn> that may make sense, going to give it a shot
<pabs> ok
<jeromegn> pabs: success!
<pabs> alright!
<jeromegn> TIL you can add to a pointer...
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 250 seconds]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
perks has quit [Quit: perks]
Dreamer3 has quit [Quit: Computer has gone to sleep.]
tomchapin has quit [Quit: Textual IRC Client: www.textualapp.com]
matp has quit [Remote host closed the connection]