ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.23.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
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/vFUMq
<crystal-gh> crystal/master 2006b44 Luis Lavena: Relocate and document Time::DayOfWeek...
<crystal-gh> crystal/master 6d1a6a7 Ary Borenszweig: Merge pull request #5188 from luislavena/refactor-day-of-the-week...
<crystal-gh> [crystal] ysbaddaden closed pull request #5098: Add parenthesis to all occurences of expect_raises (master...jm-parenthesis-expect_raises) https://git.io/vdwtR
<travis-ci> crystal-lang/crystal#6d1a6a7 (master - Merge pull request #5188 from luislavena/refactor-day-of-the-week): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293430514
<DeBot_> https://github.com/crystal-lang/crystal/pull/5188 (Relocate and document Time::DayOfWeek)
nicbet has joined #crystal-lang
nicbet has quit [Ping timeout: 248 seconds]
greengriminal has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <pnloyd> @oprypin interested in more examples for for https://github.com/oprypin/crsfml-examples?
<FromGitter> <OldhamMade> hey everyone.
<FromGitter> <OldhamMade> is it possible to include/import/require/extend/use with ecr templates?
<FromGitter> <OldhamMade> maybe something similar to jinja2's extend, or maybe an import to include smaller templates?
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <bew> @ondreian sorry I fell asleep too early, I didn't even saw your reply ˆˆ glad found the issue! In next release you'll have better error messages for a failed macro run (you'll see the exception immediatly without having to mess with the caches etc!)
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 258 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
alex`` has joined #crystal-lang
alex`` is now known as alexherbo2
alexherbo2 is now known as alex``
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
<oprypin> pnloyd, you'd think that i should be interested, but I'm not so sure, because crsfml-examples is kind of a personal thing, just small games that i couldn't bother finishing, rather than proper examples. and then there's crsfml/examples, which maybe shouldn't have to much stuff. "it depends"
claudiuinberlin has joined #crystal-lang
mark_66 has joined #crystal-lang
Papierkorb_ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
rohitpaulk has joined #crystal-lang
<Papierkorb_> Morning
<Groogy> Morning! o7
<FromGitter> <OldhamMade> morning all :)
<FromGitter> <pnloyd> @oprypin, ya that's figured It was probably a personnel project.
<FromGitter> <pnloyd> ya I*
<FromGitter> <petoem> good morning
rohitpaulk has quit [Ping timeout: 248 seconds]
<FromGitter> <Rinkana> Morning :)
alex`` has quit [Ping timeout: 255 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest275
Guest275 is now known as Ven``
shelvac2 has quit [Ping timeout: 248 seconds]
shelvacu has joined #crystal-lang
<FromGitter> <r3bo0t> @crisward from our last conversation, seems like I have some sort of IO::Stream leak issue in some of my query, unable find it yet. But for now I used mysql connection pool with ∞ (unlimited) pool size and `checkout_timeout=0.5` for now, I’m not getting the same error now. I’ll debug the same over the weekend. :) thanks again.
Ven`` has quit [Ping timeout: 240 seconds]
Ven has joined #crystal-lang
Ven is now known as Guest35603
<FromGitter> <bew> Hello here ;)
RickHull has quit [Ping timeout: 260 seconds]
Guest35603 has quit [Ping timeout: 255 seconds]
tdc has joined #crystal-lang
Ven_ has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
Ven_ has quit [Ping timeout: 240 seconds]
<FromGitter> <bew> Is there a way to wait for a child process termination, like Process#wait but wait for it to close by itself (Process#wait will close stdin of the process, then wait)
<FromGitter> <bew> Currently I have a loop `until process.terminated?; sleep 0.1; end`
<FromGitter> <bew> Is there a better way?
Ven has joined #crystal-lang
Ven is now known as Guest10069
<Papierkorb_> bew, I regard that `#wait` behaviour as non-intuitive, and it should be changed.
<Papierkorb_> Tripped over it myself recently
<Papierkorb_> bew, workaround is using `LibC.waitpid` directly
flaviodesousa has joined #crystal-lang
<FromGitter> <bew> Doesn't that block other fibers?
<Papierkorb_> Yes
<FromGitter> <bew> Hmm not for me then :/
<FromGitter> <bew> I'll stick with my until loop thenv
<FromGitter> <bew> s/v$/!
Guest10069 has quit [Ping timeout: 264 seconds]
DTZUZO has joined #crystal-lang
Ven_ has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdc has quit [Read error: Connection reset by peer]
tdc has joined #crystal-lang
salvor has quit [Ping timeout: 264 seconds]
salvor has joined #crystal-lang
<crystal-gh> [crystal] asterite opened pull request #5192: Disallow typeof in type restrictions (master...disallow-typeof-in-type-restricitons) https://git.io/vFTRG
claudiuinberlin has joined #crystal-lang
Ven_ has quit [Ping timeout: 248 seconds]
<FromGitter> <mvlootman> How can I write some text to the STDIN of a child process? I have two separate processes which I want to communicate to. e.g. Master creates child process and passes a message to which the child responds by sending to stdout. see gist: https://gist.github.com/mvlootman/00cf1d012190b7d7b13c9b7d69314b7b
<Papierkorb_> mvlootman, build a IO pipe, set the readable one as `stdin`, and then write stuff into the writable one to send data over https://crystal-lang.org/api/0.23.1/IO.html#pipe%28read_blocking%3Dfalse%2Cwrite_blocking%3Dfalse%29-class-method
<Papierkorb_> mvlootman, the same principle for the other way around (child -> parent)
<FromGitter> <mvlootman> OK I wil l try that, I thought that wasn't possible when they are two separate processes.
<Papierkorb_> Sure, its what your shell does when you pipe | stuff
<FromGitter> <mvlootman> ah I see, thank you!
<FromGitter> <Rinkana> Does Crystal have an `scanf` implementation?
<FromGitter> <asterite> nope
<FromGitter> <OldhamMade> hey all. is there a mechanism for importing/including one ecr template into another? or something like jinja2's "extends"?
<FromGitter> <unreadable> doesn't seem so
<crystal-gh> [crystal] asterite closed pull request #5139: HTTP::Client: use required named argument `form` instead of post_form and put_form (master...refactor/5136-http-client-post-form) https://git.io/vd9R0
<FromGitter> <OldhamMade> yeah, I checked the docs, just thought there may be something undocumented or something that's part of the standard lib that can be used but isn't necessarily linked
<FromGitter> <unreadable> Well, you can read the template and paste the content with `File.open`
<FromGitter> <unreadable> it shouldn't be done in the runtime though..
<FromGitter> <petoem> i wonder, if you can do a require inside a ecr template.
<FromGitter> <petoem> if you do ECR.embed, it should probably be translated to `io << require "other.ecr"`
<Papierkorb_> unreadable, ECR is compiled
<FromGitter> <unreadable> ikr
<FromGitter> <straight-shoota> @petoem no, you cant. require can only be called in the top level context
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <petoem> yes,i know now. I just tried it out.
<FromGitter> <petoem> i think this should be mentioned in the docs.
claudiuinberlin has joined #crystal-lang
<travis-ci> crystal-lang/crystal#1ac8880 (master - Merge pull request #5139 from asterite/refactor/5136-http-client-post-form): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293646674
<DeBot_> https://github.com/crystal-lang/crystal/pull/5139 (HTTP::Client: use required named argument `form` instead of post_form and put_form)
greengriminal has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #crystal-lang
<FromGitter> <OldhamMade> ah. ecr is nice because I can pass any crystal datatype to them and just use them (eg. iterate through a list of objects and print various attrs), but when templates get complex (you need to include navigation but only if authenticated, etc) it gets tricky. I quickly tried moving to crinja, but I'll have to reformat all my object into more simple data structures to pass into the templates, which is a *lot*
<FromGitter> ... more work. :(
<FromGitter> <asterite> ECR is meant to be used for simple things. For more complex stuff one probably should use a shard
<FromGitter> <straight-shoota> @OldhamMade You can pass any object directly to Crinja, it's class just needs to include `Crinja::PyObject`and expose it's values with `getattr` (see https://github.com/straight-shoota/crinja/blob/master/playground/objects.md)
<FromGitter> <mvlootman> I managed to get pipes working between the processes but how can I signal the end and close the pipe? i tried closing the stdout in the client but my 'master' still loops on the each_line iterator? see: https://gist.github.com/mvlootman/00cf1d012190b7d7b13c9b7d69314b7b
<Papierkorb_> line 23 and 24 will end up in the same thing. write to STDERR for logging instead
<FromGitter> <mvlootman> ok but the issue I have is in the reader2.each_line part
<FromGitter> <mvlootman> it loops there forever
<FromGitter> <mvlootman> do I need to do something else on the child part when its done?
<FromGitter> <OldhamMade> @straight-shoota thanks for the heads-up, I'll check that out. :D
<Papierkorb_> mvlootman, you shouldn't have to. Though #each_line's (inner) implementation is too complex for me to skim over to see what's up
osfx has joined #crystal-lang
_whitelogger has joined #crystal-lang
<FromGitter> <mvlootman> ah great it works here too!
<FromGitter> <mvlootman> when does the block gets executed, after the Process run has started/finished?
<FromGitter> <asterite> after the process started, it seems
<FromGitter> <mvlootman> ok so closing the writer2 in the block could close too early?
<FromGitter> <mvlootman> i am trying to understand how this works (:
<FromGitter> <akzhan> @asterite still waiting to stabilize Hasher to introduce Number Normalize :)
_whitelogger has joined #crystal-lang
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<FromGitter> <akzhan> @asterite it is not too cheap, but your current language specification requires it
_whitelogger has quit [Ping timeout: 258 seconds]
_whitelogger_ has joined #crystal-lang
<FromGitter> <akzhan> I prefer Знерщт кгдуы руку
<FromGitter> <asterite> But it's just wrong that you can do Hash(Int32 | Int64, String) and you can't distinguish those values
<FromGitter> <akzhan> ok
<FromGitter> <asterite> but I'm not super convinced about this
<FromGitter> <asterite> BUT, if number normalization makes everything slower, than I'm against it. No point in making things slow for no reason
<FromGitter> <asterite> Wow. Looks really cool! I'm always amazed how far macros and the type system can go. I actually would have no idea about how to accomplish all of that :-D
greengriminal has quit [Quit: This computer has gone to sleep]
<crystal-gh> [crystal] asterite closed pull request #4631: Format: show backtrace when formatting bug found (master...fix/crystal-format/show-backtrace-when-bug-found) https://git.io/vQcwW
<FromGitter> <akzhan> number normalization slower for BigFloats
<FromGitter> <akzhan> it’s slower ~3 for floats
<FromGitter> <akzhan> it’s slower Zero for ints
<FromGitter> <akzhan> and it;s pessimistic
<FromGitter> <akzhan> Will do PR and tets.
<FromGitter> <akzhan> Still no any hash speedoff fixed yet
<RX14> @asterite I disagree, h[1] and h[1_u64] should be equal, eql? and have the same hash
<RX14> i don't see why you'd ever want otherwise
<RX14> same with floats
<FromGitter> <unreadable> > So crystal 0.26 will be production ready in my opinion
<FromGitter> <unreadable> Why do you say that?
greengriminal has joined #crystal-lang
<FromGitter> <akzhan> it’s simple, it will be resistant for hashes.
<FromGitter> <akzhan> strings etc. arn’t touched with, they already resisteant by 0.25
<FromGitter> <akzhan> 1) 24 does nothing except infra
<RX14> @cearls looks cool good luck
<crystal-gh> [crystal] asterite opened pull request #5194: Formatter: fix bug regarding backslash (master...bug/5191-formatter-backslash) https://git.io/vFT54
Papierkorb_ has quit [Quit: Konversation terminated!]
<travis-ci> crystal-lang/crystal#ea4187c (master - Merge pull request #4631 from MakeNowJust/fix/crystal-format/show-backtrace-when-bug-found): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/293719848
<DeBot_> https://github.com/crystal-lang/crystal/pull/4631 (Format: show backtrace when formatting bug found)
<FromGitter> <unreadable> Grevat!
<FromGitter> <unreadable> Great!***
DTZUZO has quit [Ping timeout: 248 seconds]
mark_66 has quit [Remote host closed the connection]
<crystal-gh> [crystal] MakeNowJust opened pull request #5195: Format: correctly indent block of indented method chain (master...fix/crystal-format/5193-format-indentation-block) https://git.io/vFTNr
claudiuinberlin has joined #crystal-lang
DTZUZO has joined #crystal-lang
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
snsei has joined #crystal-lang
flaviodesousa has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
snsei has quit [Remote host closed the connection]
claudiuinberlin has joined #crystal-lang
hightower3 has joined #crystal-lang
hightower4 has quit [Ping timeout: 240 seconds]
tdc has quit [Read error: Connection reset by peer]
tdc has joined #crystal-lang
<FromGitter> <paulcsmith> @asterite Yeah the macros and type system are incredible! Took a lot of experimenting to get it to that points, but I think it turned out pretty well. Thanks for making such an incredible language :D
<FromGitter> <eliasjpr> @paulcsmith looking at one of the examples in the article `fax_number.try { |number| number.gsub("+1", "") }` can be `fax_number.try &.gsub("+1", “")`
<Papierkorb> or actually `fax_number.try(&.sub(/^\+1/, "")`
<FromGitter> <eliasjpr> QQ: What would you call the action of doing something like this `some_var.as(String)`, unboxing?
<oprypin> type assertion
<FromGitter> <eliasjpr> enlightening ✨
<oprypin> just had a random thought, is `a.as(B)` equivalent to `a = a.as(B)`
<FromGitter> <eliasjpr> thats a question?
<oprypin> yes
<oprypin> who needs question marks anyway, they're redundant
<FromGitter> <eliasjpr> well then why the need of `.as()` when there is `.is_a?`
<FromGitter> <eliasjpr> ?
<Papierkorb> .as can be chained
<oprypin> eliasjpr, it's just for convenience
<oprypin> it's actually just `if a.is_a? X; a; else; raise error`
<oprypin> holy crab, it actually is https://carc.in/#/r/2z6c
<oprypin> https://carc.in/#/r/2z6d wait what
<FromGitter> <unreadable> Yep chaining, one thing that I really missin in go..
<Papierkorb> oprypin: for a `T?`, a random `t.not_nil!` doesn't work in that way either, as in, it doesn't update the type inference
greengriminal has quit [Quit: Leaving]
<Papierkorb> Which did annoy me when writing specs
<oprypin> Papierkorb, too bad you werent using an assert macro, that would've straightened it right out
<Papierkorb> yeah too bad I didn't have yet another macro
<Papierkorb> all I had was an if and a raise
<oprypin> but it's really weird that such a clumsy construct has more power than a built-in syntax
<FromGitter> <asterite> `a.as(B)` is not equivalent to `a = a.as(B)`
<oprypin> asterite, apparently not, too bad though
<oprypin> especially seeing as `if a.is_a? B; a; else raise` is equivalent to `a = (that whole thing)`
<FromGitter> <asterite> I understand that it might make sense for that to happen, though
<FromGitter> <asterite> You can always do `a = a.as(B)`
<FromGitter> <paulcsmith> @eliasjpr @Papierkorb Thanks for the suggestion. I was thinking of using the `&.` shorthand, but I didn't want to introduce too many new concepts in one post, so opted for the more Ruby like approach since it's an intro post
<FromGitter> <paulcsmith> I like the improvement to the regex though. Nice idea 👍
<FromGitter> <HCLarsen> Speaking for Regex, can Crystal do Regex literals with custom delimiters like Ruby can?
<FromGitter> <bew> @paulcsmith maybe you can add a note, like "note that there is a short version using `&.` ..."
<FromGitter> <bew> @HCLarsen you can use `%r(abc)` and its family (`%r[]`, `%r{}`, ..)
<FromGitter> <HCLarsen> Thanks @bew
<FromGitter> <HCLarsen> Can you also use %x for command line interaction?
<oprypin> try and see
<oprypin> unfortunately yes
<FromGitter> <unreadable> Would binding to a multithreading c library work for crystal?
<oprypin> unreadable, for some definition of "work"
<oprypin> write to stdout? that's a segfault. create an array? that's a segfault. etc
<FromGitter> <nickbclifford> is https://github.com/crystal-lang-tools/intellij-crystal still under development and functional? I noticed that there haven't been any commits to it for a while
<oprypin> unreadable, you dont even need to bind anything, it's already there. an example of working multithreaded code: https://gist.github.com/oprypin/00953b336673719dba25
<FromGitter> <unreadable> Niice
<FromGitter> <unreadable> Does it run in parallel?
<oprypin> yes
<FromGitter> <unreadable> Exactly what I'm looking for
<oprypin> probably not, seeing as almost anything can cause a crash
<FromGitter> <unreadable> Well, thanks for the tips
<FromGitter> <mvlootman> anyone know how to specify format to add leading zero to integer when converting to string. So 9 -> 09 and 10 -> 10? I can't find it in the documentation
Groogy2 has quit [Quit: WeeChat 1.9]
<FromGitter> <Rinkana> The % operator should work just like ruby no? `"%02d" % 10` should do the trick
dexter1 has joined #crystal-lang
<FromGitter> <mvlootman> yes that works great, is there any documentation for Crystal? Or should I check/try Ruby syntax?
dexter1 has quit [Client Quit]
dexter1 has joined #crystal-lang
<FromGitter> <Rinkana> https://crystal-lang.org/api/0.23.1/ for all available objects. https://crystal-lang.org/docs/ for more context
dexter1 is now known as DTZUZUU
<FromGitter> <mvlootman> yes I checked those but couldn't find the specific syntax for formatting
<FromGitter> <asterite> RX14: do you have any idea how to link to llvm compiler-rt? Otherwise I guess the next release won't have the initial experimental support of Int128 (but maybe that's ok, it's not an essential feature)
<FromGitter> <Rinkana> @mvlootman That specific method is documented here: https://crystal-lang.org/api/0.23.1/String.html#%25%28other%29-instance-method while you are correct in that there is not much extended documentation on best practices etc
<FromGitter> <Rinkana> At least not yet anyways 👍
<FromGitter> <mvlootman> thanks for the link, for a newbie (like me) this is hard to find. I would love reading a book going in more detail, I believe a book might be published after 1.0
<FromGitter> <Rinkana> There is one in the works yeah AFAIK. And once you get more into the language searching for methods becomes easier. Or ask them here often someone knows the answer
<FromGitter> <mvlootman> will do thank you!
tdc has quit [Ping timeout: 246 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
robacarp has joined #crystal-lang
<robacarp> I'm running into an invalid memory access problem while tinkering with the Amber framework, but I'm not sure how to pin down where the problem is in my code. Any tips? https://gist.github.com/robacarp/82acd5d8f042347105b21b293dd2c840
<FromGitter> <bew> There not much we can do without some code! Can you show us your HomeController? It seems that this is where the error come from
<robacarp> (Crystal 0.23.1 (2017-10-12) LLVM 4.0.1 and Amber 0.3.0)
<robacarp> bew: I'm happy to, but there's nothing there beside the stock Amber template. This happens on any access to any url after the server is started.
Disrecollection has quit [Ping timeout: 260 seconds]
<robacarp> Heres the entire project: https://github.com/robacarp/amber_test
<robacarp> the only thing I can think of that I'm doing that might be a little out of the ordinary is here: https://github.com/robacarp/amber_test/blob/master/src/controllers/application_controller.cr#L7-L9
<robacarp> however, that code was running fine before the error cropped up. Comments at lines 16-21 were added in an attempt to dismiss the error because I had a thought the cookie might be corrupt.
<FromGitter> <mgarciaisaia> *ANN* If `It's friday, and you know it` resonates with you somehow, help us test Crystal's 0.24.0 pre-release ⏎ https://github.com/crystal-lang/crystal/releases/tag/0.24.0
<FromGitter> <mgarciaisaia> We'll wait to find&fix some bugs until we officially release it
<FromGitter> <mgarciaisaia> (That's why there's no repo's update, but only the debs published on Github)
lacour has joined #crystal-lang
<Papierkorb> If `$0` is no more, how else do you get and set the program name? `$PROGRAM_NAME` doesn't exist either
<FromGitter> <bew> Papierkorb try without $ ;)
<FromGitter> <bew> (It's in kernel.cr)
<Papierkorb> You can't set that
<Papierkorb> Which is what you're supposed to be able to
<Papierkorb> do
<FromGitter> <bew> Wut
<FromGitter> <bew> Why do you want to set it?
<Papierkorb> Ever wondered how programs set their title in your console tab or consoles window title?
<FromGitter> <bew> Yes by sending the correct escape sequence to the terminal with the name they want I guess?
<robacarp> in crystal, puts "\033]2;yolo\007" will change the title to "yolo"
<Papierkorb> That doesn't change the process name though
<FromGitter> <bew> Sure no, Didn't know that was possible to do!
<FromGitter> <bew> Papierkorb well you can still manipulate ARGV_UNSAFE
<FromGitter> <bew> @mgarciaisaia there's also the breaking change from Process's redirect enum
<Papierkorb> Also typo in " is now valid and reutrns 0"
<FromGitter> <bew> ===4445===
<FromGitter> <mgarciaisaia> Thanks @bew 👍
<FromGitter> <bew> ah no sorry I missed it
<FromGitter> <bew> it's already there
<FromGitter> <bew> hiddent in the flow of breaking change x)
<FromGitter> <mgarciaisaia> 🎉
<FromGitter> <mgarciaisaia> So I'll append it to `/dev/null` :P
<FromGitter> <bew> great idea :D
<FromGitter> <drosehn> It'd be more understandable to say that setting `$0` changes the process name as seen in `ps` output. Some terminal programs pick up that same value (used in `ps`) and will display it in the title (or tab-title) of the terminal window. But setting `$0` does not directly modify any terminal window.
<FromGitter> <bew> @mgarciaisaia typo in the first Macro change: `to is aliased type` => `to its aliased type` IMO
<FromGitter> <asterite> You couldn't change $0, so no harm done by removing it
Yxhuvud has quit [Remote host closed the connection]
lacour has quit [Quit: Leaving]