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
Aytan72 has joined #crystal-lang
Aytan72 has quit []
greengriminal has joined #crystal-lang
_whitelogger has joined #crystal-lang
<bmcginty> Can anyone tell me how to pull in the json.mapping from an inherited class into an inheriting one? so `class A JSON.mapping end class B < A end`, B will have all class A's json.mapping bits, while still allowing b to have it's own initialize methods?
<FromGitter> <codenoid> morning
<FromGitter> <codenoid> why crystalgiri cant parse from string :( ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=597172a5c101bc4e3aa6ba04]
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=597172ca1c8697534a459659]
<FromGitter> <codenoid> HAHAHA
pwned has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
<FromGitter> <watzon> Here’s a hypothetical for you guys. Would it be possible, using macros, to directly modify the AST? I mean actually creating nodes and adding them rather than just using other macros’ to do trivial things
<FromGitter> <watzon> I was looking at Nim recently and it has that ability. Just wondering if Crystal does as well
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 255 seconds]
<oprypin> watzon, there is no such ability. you can however write a program depending on the compiler that does this, generates code, and use it at compile time of another program
<oprypin> Nim has arbitrary code execution at compile time, Crystal has a tiny templating language that only trivially resembles Crystal
<FromGitter> <watzon> Hmm, maybe that could be a feature in a future revision of the compiler? I don't have a use case for it at the moment, but I think it would be awesome to be able to hook into the compiler like that
<oprypin> it is extremely doubtful
<FromGitter> <watzon> Yeah I figured as much haha
<FromGitter> <watzon> Probably a ton of work
<oprypin> note that Nim basically has an interpreter that duplicates almost all functionality, in order to do that
<FromGitter> <codenoid> hhmm, my latest chat wasnt deleted,
<oprypin> not only is it a lot of work that nobody really has time for, but also macros are intentionally kept limited, even within the current incarnation, according to the language's creator
<FromGitter> <codenoid> hi, can i get attr value with https://github.com/madeindjs/Crystagiri
<FromGitter> <johnjansen> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971a2b2c101bc4e3aa75f08]
<FromGitter> <codenoid> thanks `attributes["href"]`
tzekid has joined #crystal-lang
<FromGitter> <codenoid> ```code paste, see link``` ⏎ ⏎ is nth doesnt work with crystagiri ? [https://gitter.im/crystal-lang/crystal?at=5971a64b2723db8d5e3109a1]
<FromGitter> <watzon> Is it not possible to use `self` while creating an instance variable in the `initialize` method? Any workarounds? ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971a74cbc464729740ed483]
<FromGitter> <johnjansen> `self` refers to a class method @watzon you dont have a class method called `get_number` just an instance one
tzekid has quit [Ping timeout: 240 seconds]
mark_66 has joined #crystal-lang
<FromGitter> <johnjansen> also `5` is an Int32, not an Int16, you need `5_i6`
<FromGitter> <johnjansen> and its `initialize` not `initializer`
yogg-saron has joined #crystal-lang
<FromGitter> <watzon> Whoops lol. Didn't even run that crap, just an example
<FromGitter> <watzon> So my main problem would be the `self` then?
<FromGitter> <johnjansen> unless you define get_number as self.get_number ...
<FromGitter> <watzon> Well there we go
<FromGitter> <watzon> Stupid me lol
<FromGitter> <watzon> Here I was using `self` everywhere
<FromGitter> <johnjansen> no problem
<Yxhuvud> your main problem was not running the initializer.
<FromGitter> <johnjansen> ;-)
<FromGitter> <codenoid> please tell me how to get, 3 tag inside .star.clearfix :( ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971af9e329651f46eab0242]
<FromGitter> <johnjansen> code please
<FromGitter> <codenoid> doc = Crystagiri::HTML.from_url "http://www.storial.co/book-list" ⏎ puts doc.where_tag("title") { |tag| puts tag.content } ⏎ doc.css("ul li.book") do |tag| ⏎ val = Crystagiri::HTML.new tag.node.to_xml ⏎ writer, title, url, viewer, image = "", "", "", "", "" ... [https://gitter.im/crystal-lang/crystal?at=5971b10bbc464729740efe44]
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971b119c101bc4e3aa79462]
<FromGitter> <codenoid> on `#notarealselector` @johnjansen
<FromGitter> <johnjansen> whats the error
<FromGitter> <codenoid> i doesnt get any value from `<div class="star clearfix">`
<FromGitter> <codenoid> with `css("div.star")`
<FromGitter> <johnjansen> i dont see that in the code?
<FromGitter> <codenoid> okk, now you see it
<FromGitter> <johnjansen> yep
tzekid has joined #crystal-lang
snsei has joined #crystal-lang
<FromGitter> <codenoid> how ? can i make a `new issue` now ?
snsei has quit [Ping timeout: 240 seconds]
<FromGitter> <johnjansen> crystagiri doesnt look like a particularly good implementation actually
Groogy_ is now known as Groogy
<Groogy> Hai!
crack08 has joined #crystal-lang
<FromGitter> <johnjansen> hey groogy
<FromGitter> <johnjansen> @codenoid you can certainly achieve what you want with crystals xml and xpath ⏎ ⏎ the following is a hack that works, not suggested code ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971b90d89aea4761dbd3cce]
<FromGitter> <codenoid> thanks @johnjansen ^^
<FromGitter> <johnjansen> @codenoid you can in fact *hack* something in to xml that works more like nokogiri fairly easily ⏎ again, this is not in any way recommended code, but a starting point ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971bca576a757f80830ce38]
<FromGitter> <johnjansen> then you can ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971bce7f5b3458e306a6b40]
<FromGitter> <codenoid> noted & saved, <3 thanks ^^
<FromGitter> <johnjansen> you could get really serious and reverse engineer this http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/CSS/Parser#xpath_for-instance_method
<FromGitter> <watzon> How do you display a classes methods?
<Groogy> would be cool with a obj.methods -> gives array of proc's to each method
<FromGitter> <bew> well you can use a macro for that
<Groogy> how would it retrieve every method though?
<FromGitter> <watzon> Groogy: I agree
<Groogy> without having to register each?
<FromGitter> <watzon> Doesn't Ruby have that ability?
<Groogy> Yes but this is quite different from Ruby though
<FromGitter> <watzon> Can someone explain to me why this (https://play.crystal-lang.org/#/r/2ec7) fails?
<FromGitter> <watzon> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5971bf792723db8d5e31791c]
<FromGitter> <watzon> It's a contrived example, but it shows my issue
<FromGitter> <bew> you want to have classes in the Hash, not instances of TestClass
<FromGitter> <watzon> Lol well there you go
<FromGitter> <watzon> Thanks
<FromGitter> <bew> to get the methods of a type I have this: https://carc.in/#/r/2eca (crystal 0.23.0)
<FromGitter> <bew> weird, it doesn't work in 0.23.1: https://carc.in/#/r/2ec8 :/
<FromGitter> <watzon> Well that's a super easy macro. I feel like it should be in the standard library
<FromGitter> <watzon> I wonder why it doesn't work in 0.23.1
<FromGitter> <watzon> bug?
<FromGitter> <bew> there have been some movement about macro and method lookup recently, it probably broke this example, but I'm not sure how and why exactly..
<FromGitter> <watzon> Is there at least an easy way to check if a class has a method?
<FromGitter> <watzon> I feel like I've seen it in the API
<FromGitter> <watzon> But now I can't find it
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
tzekid has quit [Remote host closed the connection]
tzekid has joined #crystal-lang
rohitpaulk has joined #crystal-lang
yogg-saron has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <crisward> Anyone here using Crystal-db ?
rohitpaulk has quit [Ping timeout: 246 seconds]
tzekid has quit [Remote host closed the connection]
Mark-6ma has joined #crystal-lang
<Mark-6ma> how can I cache responses with memcache in kemal app?
Philpax_ has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
Disrecollection has quit [Remote host closed the connection]
tzekid has joined #crystal-lang
Mark-6ma has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rohitpaulk has joined #crystal-lang
<FromGitter> <tpberntsen> @crisward Yes, I am. :-)
mark_66 has quit [Remote host closed the connection]
mark_66 has joined #crystal-lang
<FromGitter> <tpberntsen> @Mark-6ma: What kind of application are your developing, and what kind of responses are you looking to cache (JSON, HTML, etc.)?
raz has quit [Changing host]
raz has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 255 seconds]
<FromGitter> <crisward> @tpberntsen just wondering how everyone is handling connection errors. At the moment my errors trickle up to Kemal's 500 page. I can customise this, but can't help thinking there should be something else. Pretty sure the driver has retry logic in it, but I had an incident recently when a severs hard drive filled and when I cleared the issue, my node app came straight back up, but crystal needed restarting.
<FromGitter> ... Pretty sure it was db related.
<crystal-gh> [crystal] mverzilli closed pull request #4726: Correct parsing string interpolation with trailing newline (master...fix/crystal/4713-parse-string-interpolation-newline) https://git.io/vQjUD
<travis-ci> crystal-lang/crystal#f4178bc (master - Correctly parse string interpolation with trailing newline (#4726)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/256062141
greengriminal has joined #crystal-lang
<travis-ci> crystal-lang/crystal#f4178bc (master - Correctly parse string interpolation with trailing newline (#4726)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/256062141
<travis-ci> crystal-lang/crystal#f4178bc (master - Correctly parse string interpolation with trailing newline (#4726)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/256062141
Mark-6ma has joined #crystal-lang
greengriminal has quit [Quit: Leaving]
nikkkk has joined #crystal-lang
<FromGitter> <tpberntsen> @crisward Ouch, a full disk is a bad thing. I haven't experienced an error like the one you mention, but I am wrapping my database requests in exception handlers to proactively handle any connectivity problems that can throw exceptions. However, a disk running full I would consider force majeure, and I wouldn't expect really any non-OS level system to recover gracefully from that situation. It's nice that
<FromGitter> ... the Node app did, though. :-)
<RX14> @crisward you're saying that crystal-db's connection pool didn't recover after a period of failure?
mark_66 has quit [Remote host closed the connection]
<FromGitter> <crisward> @RX14 Not been able to recreate it locally. But I think the lack of disk space may have caused the db to not respond, as opposed to disconnect causing the failure. I'm really guessing though at this point. @tpberntsen We're using a process manager with Node (PM2), which I think was the magic behind that recovery. The full disk was caused by gitlab BTW. It's backups are massive.
Mark-6ma has quit [Quit: -]
Philpax_ has quit [Ping timeout: 246 seconds]
fenicks has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 248 seconds]
tzekid has quit [Remote host closed the connection]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
mhib has joined #crystal-lang
mhib has quit [Remote host closed the connection]
mrCrystal has joined #crystal-lang
<mrCrystal> how can I detect interrupts
<mrCrystal> yes
<oprypin> mrCrystal, well yeah that's how (see pull request for full info)
rohitpaulk has quit [Ping timeout: 255 seconds]
olbat has quit [Ping timeout: 255 seconds]
rohitpaulk has joined #crystal-lang
olbat has joined #crystal-lang
olbat has joined #crystal-lang
olbat has quit [Changing host]
mrCrystal has quit [Quit: Page closed]
<crystal-gh> [crystal] RX14 pushed 1 new commit to master: https://git.io/v7TP1
<crystal-gh> crystal/master 1ae9414 Oleh Prypin: Add documentation to Signal
<travis-ci> crystal-lang/crystal#1ae9414 (master - Add documentation to Signal): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/256207399
rohitpaulk has quit [Ping timeout: 248 seconds]
<travis-ci> crystal-lang/crystal#1ae9414 (master - Add documentation to Signal): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/256207399
pwned has quit [Ping timeout: 260 seconds]
catfuneral[m] has joined #crystal-lang
catfuneral[m] has left #crystal-lang ["User left"]
catfuneral[m] has joined #crystal-lang
rohitpaulk has joined #crystal-lang
nikkkk has quit [Quit: Textual IRC Client: www.textualapp.com]
<FromGitter> <faustinoaq> Small binaries on Crystal 👉 https://gist.github.com/teaearlgraycold/c7b181f7bc543ee9c37cfd45df5f8856 (Spoiler use `--release --no-debug` and then `strip -d`) 😄
rohitpaulk has quit [Ping timeout: 248 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <elorest> Good to know.
<FromGitter> <watzon> Anyone know if there is a built in function in Crystal ly Python's `all()`? https://www.programiz.com/python-programming/methods/built-in/all