ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.19.4 | 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
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPB5d
<crystal-gh> crystal/master 2be9f09 Ary Borenszweig: Formatter: fixed case with block arg decomposition and parenthesized exp. Fixes #3407
<travis-ci> crystal-lang/crystal#2be9f09 (master - Formatter: fixed case with block arg decomposition and parenthesized exp. Fixes #3407): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/166297740
<DeBot> https://github.com/crystal-lang/crystal/issues/3407 (Formater fails in specific example (tuples and decomposition))
mrslowly has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 244 seconds]
Philpax has quit [Ping timeout: 268 seconds]
vikaton has joined #crystal-lang
Philpax has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 248 seconds]
markvillacampa has joined #crystal-lang
kulelu88 has quit [Quit: Leaving]
<markvillacampa> Hello! Is there any Crystal model library that lets me do something like this? Person.new({"name" => "foo", "father" => { "name" => "bar"}})
<markvillacampa> So it will create a Person instance, with a property "father" holding another Person instance
<markvillacampa> I've tried to implement this myself but type resolution has gotten a bit out of hand :D
markvillacampa has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
markvillacampa has joined #crystal-lang
markvillacampa has quit [Ping timeout: 260 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 248 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
onethirtyfive has joined #crystal-lang
pawnbox has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 248 seconds]
vikaton has quit [Quit: Connection closed for inactivity]
<FromGitter> <raydf> @markvillacampa, could you show an example of your code to help you more specifically?
pduncan has quit [Ping timeout: 256 seconds]
pduncan has joined #crystal-lang
bmcginty has joined #crystal-lang
<bmcginty> Does crystal have any way to detect if a process started with th eprocess.run |block| syntax has exitted? I'm running one process inside another, and I need to make sure that both processes are running, or exit both of them.
Philpax has quit [Ping timeout: 248 seconds]
mark_661 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
kiliankoe_ has joined #crystal-lang
early` has joined #crystal-lang
ryanf_ has joined #crystal-lang
jamie_ has joined #crystal-lang
foca_ has joined #crystal-lang
yossarian has joined #crystal-lang
yossarian has quit [Excess Flood]
mjblack- has joined #crystal-lang
yossarian has joined #crystal-lang
yossarian has quit [Excess Flood]
dom96 has quit [*.net *.split]
foca has quit [*.net *.split]
early has quit [*.net *.split]
woodruffw has quit [*.net *.split]
mjblack has quit [*.net *.split]
jamie_ca has quit [*.net *.split]
ryanf has quit [*.net *.split]
kiliankoe has quit [*.net *.split]
mose has quit [*.net *.split]
mjblack- is now known as mjblack
foca_ is now known as foca
jamie_ is now known as jamie_ca
yossarian has joined #crystal-lang
kiliankoe_ is now known as kiliankoe
dom96 has joined #crystal-lang
mose has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
Philpax has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
sooli has joined #crystal-lang
tliff has quit [Remote host closed the connection]
tliff has joined #crystal-lang
_whitelogger has joined #crystal-lang
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
soveran has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
crystal-lang604 has joined #crystal-lang
crystal-lang604 has quit [Client Quit]
eizua has joined #crystal-lang
<RX14> bmcginty, Process.run(&block) waits for the process to finish before returning
ponga has joined #crystal-lang
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 248 seconds]
bjz_ has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/vPRD1
<crystal-gh> crystal/master 9eab0f3 Ary Borenszweig: Compiler: left subexpression in `+=` was incorrectly evaluated twice. Fixes #3398
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
twisterghost has joined #crystal-lang
sooli has quit [Remote host closed the connection]
<FromGitter> <asterite> @sdogruyol @RX14 I think Go is faster to parse multipart because it peeks some bytes (4096) and see if the delimiter is there, so it doesn't end up reading the IO byte per byte. I think for this we could add a #peek method to IO that some IOs could implement if they have internal buffering. Or similar...
<RX14> yeah
<RX14> thats what I thought too
<RX14> i'm not all to good at following Go code
<RX14> but I saw it had a peek buffer
<RX14> yeah, if IOs had some sort of peek system it could make delimited much more efficient
<FromGitter> <sdogruyol> @asterite yeah you are right
Philpax has quit [Ping timeout: 248 seconds]
<RX14> the API would be quite interesting though
<RX14> how would you discover the amount that you're allowed to peek?
<RX14> maybe #peek would return a slice with all the available peek data
<RX14> but then you're making the assumption that the amount at any moment is fixed
<RX14> and all 0-cost
<RX14> or, at least the same cost
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
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
<FromGitter> <asterite> Yes, I was thinking of a peek(slice) method that would return the number of bytes peeked. Zero means nothing can be peeked, and a value less the slice.size would be allowed to be retuned.
<FromGitter> <asterite> *less than
<RX14> yeah that sounds about right
<RX14> basically #read but doesn't advance the "pointer"
<FromGitter> <asterite> Right. The default IO implementation would return zero, of course.
<RX14> yep
<RX14> probably should make an issue about it
<FromGitter> <asterite> I'll discuss this with waj. Another alternative is to have a different buffered IO that delimiter would always use, to make sure the data is buffered... though it will be a bit redundant if the data comes from a socket, which is already buffered (but maybe it doesn't matter)
<FromGitter> <asterite> I'd also like a #skip_to_end method, to avoid reading to dummy slices if possible
<RX14> well
<RX14> yes
<RX14> #discard?
<RX14> discard_all?
<RX14> discard!
<FromGitter> <asterite> We already have #skip, so #skip_to_end is maybe consistent with #gets, #gets_to_end, etc.
onethirtyfive has joined #crystal-lang
<FromGitter> <asterite> (I'd also like a #gets_fully(n) method, to read exactly n bytes into a string... I think this logic is duplicated in a few shards)
<RX14> heh, I can never remember all the methods on IO
<FromGitter> <asterite> So many enhancement to IO :-)
<RX14> now we want to add more
<FromGitter> <asterite> Yeah... other languages have small IOs and you use wrappers all the time. This is like that in Java, Go, C#
<RX14> yeah i'm not really complaining
<FromGitter> <asterite> I know :-)
<RX14> so gets_fully is gets(n) without the '\n' delimiter?
<FromGitter> <asterite> I just always wonder how to properly design things... Ruby is very convenient and easy to deal with, with just a single IO with many methods. And you can't accidentally read a file without automatically using a buffer, which would otherwise be very slow... so Ruby is great in that sense :-)
<RX14> yeah, ruby has the philosophy of shifting complexity into the stdlib
<FromGitter> <asterite> Yes... right now gets(n) might return less than n bytes. I'm not super sure it's the right methods and API, but at least it will be consistent with read(slice), read_fully(slice), so maybe it's good
<RX14> >> MemoryIO.new("\n\n\n").gets(5)
<DeBot> RX14: # => "\n" - https://carc.in/#/r/1boh
<RX14> yeah
onethirtyfive has quit [Ping timeout: 268 seconds]
<RX14> is that basically a gets or raise, or is that gets or raise without the '\n' limit?
<FromGitter> <asterite> gets_fully?
<RX14> yes
<RX14> without a delimiter, i wouldn't call it gets...
<RX14> read_string(5)
<RX14> _fully on IO methods should simply mean "raise on EOF"
<FromGitter> <asterite> Yes, it raises if there aren't at least n bytes. But read_fully will raise in that case, so it's just those 4 lines. But that way of reading strings is pretty common, so it's better to have it in the std (pretty common when reading strings in protocols)
<RX14> yes, i agree, but I wouldn't call it gets_fully if it doesn't have the '\n' delimiter
<RX14> or a delimiter
<FromGitter> <asterite> I read "gets" as "get string"
<FromGitter> <asterite> but I don't know the real meaning
<RX14> me too, but the family is characterised by having a delimiter
<RX14> a character or string that it will not read past
<RX14> the default being '\n', and sometimes an additional numeric limit can be passed
<RX14> but they all have a "sequence of bits" that they will stop at
<BlaXpirit> i agree with RX14
<FromGitter> <asterite> so how should we name this new method?
<RX14> read_string and read_string_fully?
<RX14> "abc".read_string(5) # => "abc"
<RX14> "abc".read_string_fully(5) # => raises
<RX14> where "abc" is actually an IO
<RX14> damn, I wrote a response to #3396 on the train but it seems it got lost...
<DeBot> https://github.com/crystal-lang/crystal/issues/3396 (Safer version of methods with `raise`)
<RX14> and now I can't remember what I wrote...
<BlaXpirit> RX14, could you retract the comment at #3402 ? I made the change, unfortunately now github doesnt hide the comment :<
<DeBot> https://github.com/crystal-lang/crystal/pull/3402 (Rework the Random module)
<RX14> well the rest of the stdlib is written in the other style so I think we should stick to that
<BlaXpirit> i can agree to that but other than that enforcing this wrong convention is.. wrong
<RX14> I think that crystal's formatter should be really strict actually, like go's
<BlaXpirit> it's already too strict, i consider it unusable
<RX14> because you disagree with the conventions?
<BlaXpirit> yes
<BlaXpirit> especially weird alignment with comments and i think `=`
<RX14> I think that enforcing a strict style is a good move forward, because having a strict standard style is better than letting everyone style how they wish
<BlaXpirit> if that is so, then there shouldn't be two styles in the first place
<RX14> not really
<RX14> do/end fits the style of the langauge, but it's too unwieldy for single-line calls
<RX14> so we add {} only for single-line calls
<BlaXpirit> disallow single-line calls. problem solved
<RX14> or eforce {} is single-line only in the compiler
<RX14> but It's much nicer to enforce it in the formatter
<RX14> because then if you *really* disagree you can just not use it
<RX14> the point of the formatter is to encourage a consistent and readable style
<BlaXpirit> what i disagree with is Array.new(10) do
<BlaXpirit> do what
<BlaXpirit> anyhow, RX14, do you have a button to say that changes from your code review have been made?
<RX14> no
<RX14> and i'd rather not delete it
<BlaXpirit> how so, weird
<RX14> i thinbk github should sort it out
<RX14> a "done" comment is what i've seen others use
<BlaXpirit> but previously comments on lines that were changed would be hidden
soveran has quit [Remote host closed the connection]
<RX14> yeah
<RX14> but i think it's hard to work that out properly with rebases and the like
<RX14> an "accept changes" button would be nice but I can sort of understand why they left it out
<BlaXpirit> i'm sure that at least repository owners can accept ,i've done that before
<RX14> they can accept
<RX14> but it doesn't collapse previous
<BlaXpirit> yeah
<BlaXpirit> just checked, that's correct. and in fact there is no indication on the page at all
<RX14> there is
<BlaXpirit> just one line at the point of acceptance but it's hard to see
<BlaXpirit> i mean it's disconnected from the review itself
<RX14> yes
<BlaXpirit> this whole change on github is a step backwards in my opinion
<RX14> well, I wouldn't say that
<RX14> it has some rough edges
<RX14> but I think explicit reviews like this are a step forwards
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
kulelu88 has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<Papierkorb> Is it possible to include a Module in a spec file-locally? `private include Foo::Bar` tells me "can't apply visibility modifier"
sandelius has joined #crystal-lang
onethirtyfive has joined #crystal-lang
mark_661 has quit [Remote host closed the connection]
onethirtyfive has quit [Ping timeout: 260 seconds]
eizua has quit [Quit: Leaving]
<FromGitter> <rdp> mrslowly I too found it odd you can't declare 2D array like "my_var_name = [] of [] of Float64" though you can do it like this "[] of Array(Float64)" FWIW...
<BlaXpirit> the syntax is [] of Type
<BlaXpirit> `[] of Float64` isn't itself a type
<BlaXpirit> so what's odd?
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Yxhvd has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
Yxhuvud has joined #crystal-lang
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
sandelius has joined #crystal-lang
<RX14> also
<RX14> another reason why you should use Array.new instead of [] of
<RX14> Array(Array(Foo)).new is nicer than [] of Array(Foo) really
soveran has quit [Remote host closed the connection]
onethirtyfive has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has joined #crystal-lang
<BlaXpirit> yes
willl has joined #crystal-lang
twisterghost has quit [Quit: Connection closed for inactivity]
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
tilpner has quit [Quit: :wq]
tilpner has joined #crystal-lang
bjz has joined #crystal-lang
onethirtyfive has joined #crystal-lang
bjz has quit [Client Quit]
bjz has joined #crystal-lang
onethirtyfive has quit [Ping timeout: 260 seconds]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 268 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
pduncan has quit [Ping timeout: 240 seconds]
pduncan has joined #crystal-lang
pawnbox has joined #crystal-lang
bjz has joined #crystal-lang
ponga has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang