RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.27.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <Blacksmoke16> stdlib spec is sufficient for me
return0e has joined #crystal-lang
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
sp3ncer has joined #crystal-lang
sp3ncer has left #crystal-lang [#crystal-lang]
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Ping timeout: 268 seconds]
_whitelogger has joined #crystal-lang
<FromGitter> <girng> Have fun!
DmitryBochkarev has joined #crystal-lang
marmotini_ has joined #crystal-lang
marmotini_ has quit [Ping timeout: 245 seconds]
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
decal has quit [Read error: Connection reset by peer]
ua_ has joined #crystal-lang
ua has quit [Ping timeout: 246 seconds]
<FromGitter> <bew> @Maroo-b checkout #6074
return0e has quit [Remote host closed the connection]
tdc has joined #crystal-lang
<FromGitter> <Maroo-b> @bew thank you :)
return0e has joined #crystal-lang
ashirase has quit [Ping timeout: 250 seconds]
<wuehlmaus> RX14: is 0.27.1 more stable than 0.27.2? because the topic still lists 0.27.1
ashirase has joined #crystal-lang
<wuehlmaus> i thought 0.27.2 improved on 0.27.1
<FromGitter> <yxhuvud> it is probably the case that someone forgot to update it
<FromGitter> <straight-shoota> Which topic?
<wuehlmaus> is there any news on the multi threading theme? my git version has the method parallel, is that it?
<wuehlmaus> straight-shoota: our channel topic
<FromGitter> <straight-shoota> oh, on IRC
<FromGitter> <straight-shoota> I don't think I have IRC admin rights
<FromGitter> <straight-shoota> `parallel` is not parallelism, it executes multiple fibers concurrently and returns once all have finished. So it's more like a wait group.
<FromGitter> <straight-shoota> #7456 and #7547 show current state of MT development
<FromGitter> <straight-shoota> sry, #7546
<wuehlmaus> straight-shoota: thanks for telling me
<FromGitter> <straight-shoota> It looks like we'll get a preview in 0.28 =)
<FromGitter> <straight-shoota> at least for the GC
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev_ has joined #crystal-lang
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev_ has quit [Remote host closed the connection]
<FromGitter> <vladfaust> @straight-shoota could you explain #7546? If I understand it right, this would enable GC in threads, so they would behave just like the main tread?
DmitryBochkarev has joined #crystal-lang
<FromGitter> <vladfaust> No automatic splitting if fibers between threads yet?
return0e has quit [Remote host closed the connection]
return0e has joined #crystal-lang
marmotini_ has joined #crystal-lang
<FromGitter> <straight-shoota> Yes. Currently, the garbage collector is not aware of threads. This PR makes it work in a multithreaded environment. But it doesn't change the scheduler. So it only makes a difference when manually scheduling fibers to different threads like in the example.
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
<FromGitter> <vladfaust> That's still awesome. Hello, multithreaded apps!
<FromGitter> <vladfaust> Does the team aim to implement "automatic splitting of fibers between threads", @straight-shoota?
<FromGitter> <j8r> that would be the point of the scheduler
<FromGitter> <vladfaust> That. Is. Epic.
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
DmitryBochkarev has quit [Remote host closed the connection]
DmitryBochkarev has joined #crystal-lang
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 250 seconds]
marmotini_ has quit [Remote host closed the connection]
<FromGitter> <girng> ^
DmitryBochkarev has quit [Ping timeout: 245 seconds]
t1|Mike has quit [Read error: Connection reset by peer]
t1|Mike has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
<FromGitter> <Blacksmoke16> anyone have trouble running https://github.com/the-benchmarker/web-frameworks locally?
<FromGitter> <Blacksmoke16> i keep getting like `Unhandled exception: Invalid Float64: unable to connect to 172.17.0.2:3000 Operation timed out`
<FromGitter> <kinxer> Does Crystal have recursive procs?
<FromGitter> <bew> @kinxer i don't think so.. You can't reference the current proc when you're defining it iirc
DmitryBochkarev has quit [Remote host closed the connection]
<FromGitter> <kinxer> @bew Good to know. Thanks. I was thinking of using Crystal on codegolf.stackexchange.com (for fun and as language exposure), and someone added a ruby solution with a recursive proc, so I didn't know whether Crystal also has that functionality.
DmitryBochkarev has joined #crystal-lang
<FromGitter> <kinxer> I'm assuming you're right, though.
<FromGitter> <bew> Actually there is a way: https://stackoverflow.com/a/45279884/5655255 (see the UPDATE note), but i'd not recommend it #hack
rohitpaulk has joined #crystal-lang
<FromGitter> <kinxer> Ah... Interesting. Too verbose for code golf, though. :P
<FromGitter> <kinxer> And I agree that it would be pretty hacky in real code.
<FromGitter> <vladfaust> Not everything involving raw access to memory is a hack, though
<FromGitter> <vladfaust> I'd call it a "trick"
<FromGitter> <aemadrid> amazing that you can do it please heck no, don’t do it
lucasb has joined #crystal-lang
<FromGitter> <bew> Yeah a nice trick then! @kinxer you could do a `g = nil; g = ->{ g.not_nil!.call }` (might be shorter)
<FromGitter> <bew> (not tested)
<FromGitter> <kinxer> @vladfaust I agree with your first statement on principle, but I think this one is a hack. If you ever need a recursive proc you should just write out a method definition and capture it. That'll be much clearer to read.
<FromGitter> <vladfaust> Indeed
<FromGitter> <kinxer> @bew That is *much* shorter, but still longer than a loop-based solution to the particular problem I'm looking at (this one (https://codegolf.stackexchange.com/questions/182221/implement-the-thanos-sorting-algorithm)).
rohitpaulk has quit [Remote host closed the connection]
<FromGitter> <bew> Indeed..
<FromGitter> <kinxer> Alas, Crystal's type system is a liability in code golf, as `->a{...}` in Ruby is instead `->(a : Array(Int32)){...}` (for this particular problem).
<FromGitter> <bew> Oooh that's the thing i didn't understood in the ruby example
DmitryBochkarev has quit [Ping timeout: 250 seconds]
Jenz has joined #crystal-lang
DmitryBochkarev has joined #crystal-lang
<FromGitter> <vladfaust> Yeah, cool shard
<FromGitter> <vladfaust> Will be very needed on 0.28 release
<Jenz> Oh? Why is that?
<z64> 0.28 is scheduled to come with a preview of mt features via compiler flag
<FromGitter> <vladfaust> Yup
DmitryBochkarev has quit [Ping timeout: 255 seconds]
<FromGitter> <tenebrousedge> Perhaps someone could explain to me why `StringScanner` is only returning one result here? https://play.crystal-lang.org/#/r/6n13
<Jenz> Ah right, that'll be cool
<FromGitter> <bew> About immutable, the concepts behind it it soo interesting
return0e_ has quit [Remote host closed the connection]
<Jenz> StringScanner will return nil on no match, and *not advance*, it will only advance in the string on match apparently
<FromGitter> <tenebrousedge> but why does it not match the next occurrence?
<Jenz> Hence you need to scan for the whitespace (\s) to get to the next non digit [^\s]
<Jenz> What do you mean: > why does it not match the next occurrence?
<Jenz> I suggest you read the docs: https://crystal-lang.org/api/0.27.2/StringScanner.html#scan(pattern)-instance-method
<Jenz> The different behaviour of String#scan and StringScanner#scan can be quite confusing
<FromGitter> <tenebrousedge> we scan for non-ws, get "1". Remaining string is " 2 3 4 5". repeating the scan should get "2", not nil
<FromGitter> <tenebrousedge> I've read the docs and the source, thanks
<FromGitter> <Blacksmoke16> `[^\s]+` doesn't match whitespace
<FromGitter> <Blacksmoke16> so it never advances
<FromGitter> <Blacksmoke16> would be my guess
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6n1p
<Jenz> I'd agree with you tenebrousedge, but clearly that's not how it is. Seems to me #scan returns nil if the anything does not match
<Jenz> Since the first char of the remaining string: " " doesn not match /[^\s]/, nil is returned, #scan_until would return " 2"
<FromGitter> <Blacksmoke16> well `scan` scans at current pos and advances if it does
<FromGitter> <Blacksmoke16> so it matches `1`, advances 1, since that was the size of it, and now is trying to match something that doesnt match whitespace against whitespace
<FromGitter> <tenebrousedge> it's not matching against whitespace, it's matching against the rest of the sring
<FromGitter> <Blacksmoke16> its not tho
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/0.27.2/StringScanner.html#scan%28pattern%29-instance-method
<FromGitter> <Blacksmoke16> `Tries to match with pattern at the current position.`
<FromGitter> <Blacksmoke16> which is whitespace
<FromGitter> <tenebrousedge> so it operates character-at-a-time?
<FromGitter> <Blacksmoke16> you can use `scan_until` to advance to the next match https://play.crystal-lang.org/#/r/6n1s
<FromGitter> <Blacksmoke16> id vote its based on the size of the match
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6n1x yup
<FromGitter> <Blacksmoke16> i.e. `If there's a match, the scanner advances the scan offset`
<FromGitter> <tenebrousedge> that's bizarre
<Jenz> To me it seems as if a /^/ is appended to the regex, by #scan
<Jenz> This is how I'd do it: https://play.crystal-lang.org/#/r/6n1y
<FromGitter> <Blacksmoke16> why? `[^\s]+` is saying match everything except whitespace
<Jenz> If you find it bizarre, StringScanner is probably not what you want to use, but simply String#scan
<FromGitter> <Blacksmoke16> or `#match`
<FromGitter> <Blacksmoke16> if you want to pull out matches based on pattern
<Jenz> #match would only return the first match though
<FromGitter> <tenebrousedge> I'm really quite sure that what I want is Scanner, in this instance, thank you
<FromGitter> <tenebrousedge> I appreciate the explanation and the code examples, they have made this much clearer
<FromGitter> <Blacksmoke16> np
<Jenz> Definitely not "character-at-a-time": https://play.crystal-lang.org/#/r/6n24, *that* be quite bizarre I'd agree
<FromGitter> <Blacksmoke16> ah yea, scan does it tho
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6n25
<FromGitter> <Blacksmoke16> its not character, its based on size of the match
<Jenz> size?
<FromGitter> <Blacksmoke16> so like match `I`, advance 1, skip 1 whitespace, match `am`, advance 2, skip 1 whitespace
<FromGitter> <Blacksmoke16> match `some`, advance 4
<FromGitter> <Blacksmoke16> i.e. the size of the matched string
<Jenz> Well, yeah, or just "the match" as I'd put it XD, but my english is not great
<Jenz> It was as I thought, it sets the option "ANCHORED", which is equavilent to prepending a `^` to the regex
<FromGitter> <wontruefree> I am having trouble building crystal in my environment. When run `make clean` then `make crystal` the build just never finishes. I can build it on my system though other means but is there a good way to debug the build process?
<Jenz> So /[^\s]+/ effectively matches for /^[^\s]+/ which will not match anything beginning with whitespace
<FromGitter> <Blacksmoke16> :thinking:
<Jenz> Just takes ages for me
<Jenz> About 15min IIRC
<FromGitter> <Blacksmoke16> :0
<FromGitter> <Blacksmoke16> whoa
<Jenz> I'm on an ancient machine
<FromGitter> <Blacksmoke16> `make progress=1 stats=1`
<FromGitter> <Blacksmoke16> thats rough
<Jenz> Worth it though :P
tdc has quit [Ping timeout: 246 seconds]
Jenz has quit [Quit: night]
<FromGitter> <Blacksmoke16> @wontruefree are you sure it just doesn't take a while?
<FromGitter> <wontruefree> I left it building overnight this weekend and it didnt finish
<FromGitter> <wontruefree> also I opened up an issue with more info
<FromGitter> <wontruefree> but I can build it in zsh
<FromGitter> <wontruefree> It kind of puzzles me
<FromGitter> <wontruefree> @Blacksmoke16 when I run with `progress` and `stats` it does not show any more output. I think it gets stuck before that
<FromGitter> <Blacksmoke16> oh overnight, yea shouldnt take *that* long :P
<FromGitter> <wontruefree> :)
return0e has joined #crystal-lang
Vexatos has quit [Read error: Connection reset by peer]
RX14 has quit [Ping timeout: 250 seconds]
Vexatos has joined #crystal-lang
RX14 has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
<FromGitter> <j8r> In zsh?
<FromGitter> <j8r> What's shell and version you use, in which the build blocks?
<FromGitter> <ryanstout> will it be possible in the future to get a pointer to a struct from a structs instance method? (or is there a limitation I don't understand)
<FromGitter> <wontruefree> @j8r here is the version from --version `GNU bash, version 5.0.3(1)-release`
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/athena/blob/cors/docs/routing.md#cors got the docs written for handling cors
<FromGitter> <Blacksmoke16> oops, link is broken
lucasb has quit [Quit: Connection closed for inactivity]
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/6n2v am i missing something or can you not access annotations on classes when using `#ancestors`?