ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.0 | 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> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d8bffc034a7236bf5bf9382]
<FromGitter> <repromancer_gitlab> the compiler message it gives you isn't super clear if you don't already understand why it's being thrown, so I may not use the capability
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d8bffcd86eddb6ea0d5c20f]
<FromGitter> <Blacksmoke16> seems pretty clear to me
<FromGitter> <Blacksmoke16> its defined in a parent so it must have the same or compatible return type
<FromGitter> <repromancer_gitlab> oh, sorry, I meant when you use it to enforce a class method
<FromGitter> <Blacksmoke16> ah gotcha
<FromGitter> <Blacksmoke16> but yea, thats how you would ensure your method returns the correct type
<FromGitter> <Blacksmoke16> i did find a bug tho
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/7myj
<FromGitter> <repromancer_gitlab> is `record` meant to work outside of a class/module definition?
<FromGitter> <Blacksmoke16> its just a macro that defines a struct with an initializer and getters
<FromGitter> <asterite> that record error message is super confusing! the problem is you have to leave a space before the colons...
<FromGitter> <Blacksmoke16> whoa good catch, i didnt even notice
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 268 seconds]
DTZUZU has quit [Ping timeout: 265 seconds]
DTZUZU has joined #crystal-lang
<FromGitter> <sam0x17> is it viable to have a git submodule within a shard repo?
<FromGitter> <sam0x17> will shards automatically pull down the submodule before building?
<FromGitter> <sam0x17> ah looks like not
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 264 seconds]
<FromGitter> <skota> hey all, is there something like javascript setTimeout in Crystal?
<FromGitter> <Blacksmoke16> sleep?
<FromGitter> <Blacksmoke16> Could easily make a method that seems for some time, then yields
<FromGitter> <Blacksmoke16> Sleeps
<FromGitter> <skota> thx
<FromGitter> <Blacksmoke16> Np, need an example?
<FromGitter> <wwselleck> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d8c3589bae2907f6c3b5976]
<FromGitter> <wwselleck> that ^ is supposed to be under the `t` in context
<FromGitter> <wwselleck> I don'tttt understand
<FromGitter> <wwselleck> this feels like I must be making some dumb mistake
<FromGitter> <Blacksmoke16> Need a space between the ) and : in your abstract method called method
<FromGitter> <wwselleck> ahhh, didn't suspect that because I had a bunch of ` ` before `:` errors before his
<FromGitter> <Blacksmoke16> That's the first thing I noticed at least, dunno if it's thee issue tho
<FromGitter> <wwselleck> oh nope, that didn't fix it :\
<FromGitter> <Blacksmoke16> Sure you don't have have some invalid character after that handle method?
<FromGitter> <Blacksmoke16> Like invisible control character? Dunno if that would cause that error tho
<FromGitter> <Blacksmoke16> Oh
<FromGitter> <Blacksmoke16> U don't think `getter @path` is valid
<FromGitter> <Blacksmoke16> Try dropping the at symbol
chemist69 has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> Or getter if that Ivar was defined somewhere else
chemist69 has joined #crystal-lang
<FromGitter> <wwselleck> ahh I think it was the @
<FromGitter> <wwselleck> This is what I get for writing exclusively javascript and typescript for the past 3/4 years
<FromGitter> <Blacksmoke16> :p
<FromGitter> <wwselleck> bleh, another one ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d8c39b0b6aa4d6c90e40ed9]
<FromGitter> <wwselleck> Array(Route) is an Array(Index). I'll be adding other Route classes later on, do I really have to declare `@routes` as `Array(Route)` in the mean time?
<FromGitter> <Blacksmoke16> Would want to add ` of Route` yea
<FromGitter> <Blacksmoke16> Like `[Indenx.new] of Route`
hypercore has quit [Ping timeout: 260 seconds]
<FromGitter> <Blacksmoke16> Meh, typing on phone is hard
<FromGitter> <wwselleck> ```code paste, see link``` ⏎ ⏎ scuse me [https://gitter.im/crystal-lang/crystal?at=5d8c3bd7692d464f79701283]
<FromGitter> <Blacksmoke16> no i meant literally `[Index.new] of Route`
<FromGitter> <wwselleck> OOOOOOO
<FromGitter> <Blacksmoke16> your code is trying to say the type is `Array(Array(Route))`
<FromGitter> <wwselleck> i missed that part
<FromGitter> <wwselleck> ok thank you
<FromGitter> <wwselleck> compiled! i am crystal master
<FromGitter> <Blacksmoke16> \o/
<FromGitter> <Blacksmoke16> are you making your own router?
<FromGitter> <wwselleck> I'm just trying to write a personal website w/o 3rd party shards
<FromGitter> <wwselleck> so yeah, writing some sort of router for it
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <Blacksmoke16> they have some lightweight router shards that would prob make that easier
<FromGitter> <Blacksmoke16> but for your case it would prob be kinda easy, assuming you dont have to worry about route params and stuff?
<FromGitter> <anamba> hmm. so i am mostly liking the MT except that every now and then i get "FATAL: tried to resume a dead fiber" + runaway CPU. I am trying to fix the root cause, but the associated runaway CPU is a little puzzling
<FromGitter> <Blacksmoke16> is experimental for a reason :P
<FromGitter> <Blacksmoke16> but yea, finding and making an issue with some reproducible code would be 💯
<FromGitter> <wwselleck> welll I assumed I would need to implement routes like `/blog/:blogPostId`, but I may be able to simplify. I have "started programming post SPA frameworks" disease, so I tend to overcomplicate everything :P
<FromGitter> <Blacksmoke16> oh so building a rest api?
<FromGitter> <anamba> yeah i'm trying to see if i can distill this down into something simpler. but when i simplify, it works :)
<FromGitter> <wwselleck> I mean I mostly just want to have a list of files like ⏎ ⏎ `some-blog-post.md` ⏎ `blog-post-2.md` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5d8c464234a7236bf5c163ba]
<FromGitter> <Blacksmoke16> ah
<FromGitter> <Blacksmoke16> should be doable
<FromGitter> <wwselleck> which I imagine involves creating a route like `/blog/:blogName`, and having to parse out that route and match it with a handler
<FromGitter> <wwselleck> Which is ezpz with like kemal or whatever, but I'm using this project to start learning crystal
<FromGitter> <wwselleck> woudl rather not reach for a shard
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <Blacksmoke16> if you're not going for pure speed woudl be pretty easy to just regex match the request path
<FromGitter> <Blacksmoke16> and parse out the required elements then use a case or something
<FromGitter> <wwselleck> I was just thinking that...I wish I was around pre-Angular so I was forced to write actual server websites instead of starting with SPA
rohitpaulk has joined #crystal-lang
ht_ has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 240 seconds]
<FromGitter> <wwselleck> I doubt this is a bug, buttttt this doesn't seem correct to me
<FromGitter> <wwselleck> someone mind explaining?
ht_ has quit [Remote host closed the connection]
<FromGitter> <wwselleck> Unlesssss maybe the Path type isn't appropriate for a URL path
<FromGitter> <anamba> it wouldn't be the first thing i would reach for, no :)
nowhereFast has joined #crystal-lang
devil_tux has joined #crystal-lang
nowhereFast has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 252 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
nowhereFast has joined #crystal-lang
nowhereFast has left #crystal-lang [#crystal-lang]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 246 seconds]
hightower2 has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <bararchy> Do we have some new issues with sockets?
<FromGitter> <bararchy> I see lot's of `Error sending datagram: Bad file descriptor (Errno)`
<FromGitter> <bararchy> @watzon This seems specifically around Marionette but I don't think it's 100% it
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
<FromGitter> <Daniel-Worrall> Crystal 0.27.2 Is what stands out to me :^)
hypercore has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
jokke is now known as repo
rohitpaulk has quit [Ping timeout: 268 seconds]
hypercore has quit [Quit: hypercore]
duane has joined #crystal-lang
<mps> jhass: j8r: 'crystal --version' => 'Crystal 0.31.0 [90af8c03ba] (2019-09-25)' or 'Crystal 0.31.0'
<FromGitter> <naqvis> anyway to pass run/build like `--link-flags` to `spec`?
<FromGitter> <naqvis> tried `crystal spec -h` but don't see any option for link flags
<jhass> mps: mmh, the date just depends on `date` (or SOURCE_DATE_EPOCH being set)
<mps> I removed it from there
<jhass> I guess it doesn't really matter, yeah
<mps> to me clean and simple version number looks best, without data and hash
<mps> btw, is there crystal mailing list for developers and/or users
<jhass> there is but it's kinda dead and abandoned in favor of https://forum.crystal-lang.org
<jhass> discourse has an excellent email interface if you prefer that
duane has quit [Ping timeout: 246 seconds]
<mps> ah, didn't know that it supports ML, will look at it
<jhass> in your settings there's a "Mailling list mode"
<mps> thanks
<FromGitter> <skota> 1) @Blacksmoke16 sorry just saw your reply fro, yesterday. Yes please, if you can share an example on how to use sleep that would be great
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d8cd53b462ada5123ff7725]
<FromGitter> <Blacksmoke16> something like that
duane has joined #crystal-lang
<FromGitter> <c-cube> there should be a `ppp` macro that also prints current wallclock, for concurrent stuff ;)
Yxhuvud has quit [Read error: Connection reset by peer]
<FromGitter> <Blacksmoke16> could define one
<FromGitter> <vlazar> setTimeout in JS exits immediately, maybe the question was how to achieve similar?
<FromGitter> <Blacksmoke16> hm, would prob have to do something with fibers
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <Blacksmoke16> might be easier with MT? as then a thread could be executing your timeout fibers while not blocking the main program
ht_ has joined #crystal-lang
<FromGitter> <asterite> you need to do: `spawn do sleep 2; action; end`. That's the equivalent
DTZUZO has joined #crystal-lang
<FromGitter> <skota> thanks @Blacksmoke16 your example worked , @vlazar - i meant setInterval not setTimeout, thanks for the link. @asterite - i will readup on concurrency and try again
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 268 seconds]
rohitpaulk has joined #crystal-lang
duane has quit [Ping timeout: 240 seconds]
rohitpaulk has quit [Ping timeout: 276 seconds]
<FromGitter> <confact> I am thinking of doing some reload functionality to the crystal HTTP server which I have built a handler in to update db that is loaded on start. Could someone point me in the right direction for that or have some tip? Would be very appreciated.
<FromGitter> <Blacksmoke16> reload functionality? like restart the server on change?
<FromGitter> <confact> restart without closing down the socket/exit the program.
<FromGitter> <j8r> that's the SIGHUP to catch
<FromGitter> <j8r> it is a signal
<FromGitter> <confact> the problem i solved a bit hacky now is to load the stuff from db in an array and then i send it all the way through handler as an argument. It is ugly. And i have to reset the http server somehow on the SIGHUP as you mention, don't know how.
<FromGitter> <j8r> with https://crystal-lang.org/api/0.31.0/Signal.html#trap(&handler:Signal-%3E):Nil-instance-method
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
Yxhuvud has joined #crystal-lang
<FromGitter> <r00ster91> is it possible to get the time that a fiber has left to sleep before it continues?
<jhass> mh, I doubt we track that
<FromGitter> <r00ster91> alright
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 265 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Quit: Ping timeout (120 seconds)]
<FromGitter> <kinxer> Can someone help me with how to properly call `.new` from within an instance method: https://play.crystal-lang.org/#/r/7n6v ?
<FromGitter> <zsxawerdu> IntWrapper.new (self.value + other.value)
<FromGitter> <kinxer> How about a harder one: https://play.crystal-lang.org/#/r/7n72/edit ?
<FromGitter> <kinxer> Maybe `.new` should just be `protected` instead of `private`, but it seems like I should be able to use a private `.new` from within a class definition...
<FromGitter> <kinxer> Ah... https://play.crystal-lang.org/#/r/7n7b
<FromGitter> <kinxer> It feels strange to call `#initialize`, though.
<FromGitter> <zsxawerdu> yeah
<mps> j8r: 0.31.0 is on alpine edge, you (and other ofc) can test it and if there are bugs report
duane has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<FromGitter> <j8r> thank you very much mps :)
ht_ has quit [Remote host closed the connection]
<FromGitter> <kinxer> Is this functioning properly: https://play.crystal-lang.org/#/r/7n7u ? (compare https://play.crystal-lang.org/#/r/7n7v)
<mps> j8r: you are welcome :)
<FromGitter> <Daniel-Worrall> @kinxer well std defines +'s with a T.new rather than calling an internal initialise so never runs into this kind of problem
<FromGitter> <Daniel-Worrall> I believe it's functioning as expected
fyber has joined #crystal-lang
<FromGitter> <kinxer> A'ight. Thank you.
<FromGitter> <jwoertink> Anyone here using asdf know if there's a way to tell it to build with a specific llvm version?
<FromGitter> <jwoertink> Or is there a way to tell crystal when building from source? I don't read Makefile very well, but I see `LLVM_CONFIG`
<FromGitter> <jwoertink> maybe something like `LLVM_CONFIG=8 make clean crystal`?
<mps> jwoertink: LLVM_CONFIG = /usr/lib/llvm$_llvmver/bin/llvm-config
<mps> or 'make crystal LLVM_CONFIG="llvm5-config" .... other configs'
<mps> that is how it is builds on Alpine Linux
<FromGitter> <nsuchy> I setup a fresh Debian VM, I can't figure out how to install crystal 0.30.0-1
<FromGitter> <nsuchy> 1) 31.0 breaks amberframework
<FromGitter> <jwoertink> ah awesome
<FromGitter> <jwoertink> @nsuchy lol I'm doing the same 😅
<FromGitter> <nsuchy> @jwoertink do you know the command?
<FromGitter> <nsuchy> Revert only works if you had crystal installed previously
<FromGitter> <nsuchy> This is a fresh VM so I don't have that
<FromGitter> <jwoertink> I'm using asdf
<FromGitter> <jwoertink> `asdf install crystal 0.30.1`
<FromGitter> <jwoertink> but my apps don't work when using llvm6, so I need to build it using 8
<FromGitter> <nsuchy> gez
<FromGitter> <nsuchy> snapcraft
<FromGitter> <nsuchy> removes all previous versions
<FromGitter> <nsuchy> so I can't use snapcraft to install an old version
<FromGitter> <jwoertink> Brew does the same
<FromGitter> <nsuchy> .deb files are here
<FromGitter> <nsuchy> you can't compile amber anymore
<FromGitter> <nsuchy> not even with the source from github and a supported crystal version
<FromGitter> <nsuchy> Crystal really needs better version management for its package ecosystem
<FromGitter> <bew> @kinxer not that in your examples, c is not a 3rd instance! Calling `initialize` does not create a new instance, it just initializes stuff.. If you want to create a new instance in your `+` method, call `new`
<FromGitter> <bew> note*
<FromGitter> <Daniel-Worrall> I use crenv
<FromGitter> <Daniel-Worrall> Manages all my crystal versions
<FromGitter> <bew> Look, if I print `a` at the end it has value `2` https://play.crystal-lang.org/#/r/7n8g
<FromGitter> <nsuchy> @Daniel-Worrall i'm running 0.30.1 but because certain dependencies were updated, the old version of crystal can't handle them
<FromGitter> <kinxer> @bew Oh, that's non-ideal. Is there no way to do this with a `private def`, then?
<FromGitter> <Daniel-Worrall> Might be able to do a private new that calls the private init
<FromGitter> <Daniel-Worrall> @nsuchy Are you not able to specify specific old commits that were built with 0.30.1 in mind?
<FromGitter> <kinxer> Won't the private new essentially overwrite the private initialize if it has the same signature?
<FromGitter> <Daniel-Worrall> No?
<FromGitter> <nsuchy> @Daniel-Worrall it's because shards is pulling a too new version of something
<FromGitter> <Daniel-Worrall> @nsuchy then specify an older version or even a specific commit in your shards file
<FromGitter> <bew> I think that a better way to do this is: https://play.crystal-lang.org/#/r/7n8q
<FromGitter> <nsuchy> just to be clear
<FromGitter> <nsuchy> downloaded from releases
<FromGitter> <kinxer> @bew Yeah, I've ended up using `protected`, but it seems weird that there's no way to do this without allowing access to the initializer from other classes in the module.
<FromGitter> <kinxer> Is there just no way to access private class methods from instance methods?
<FromGitter> <Daniel-Worrall> Yes, please update the shards file, nsuchy.
<FromGitter> <bew> @kinxer i don't know, it's not intuitive to say the least
<FromGitter> <nsuchy> I think Amber needs to update theirs
<FromGitter> <nsuchy> ideally projects don't need to worry about their framework's dependencies
<FromGitter> <kinxer> Hm. It just seems like this should be in-scope: https://play.crystal-lang.org/#/r/7n8w
<FromGitter> <Daniel-Worrall> You're using an outdated version of crystal, so you need to configure your framework's dependencies to work.
<FromGitter> <bew> @kinxer also with `private` it completely blocks the call using the type: `private def self.foo` you won't be able to do `Type.foo`
<FromGitter> <Daniel-Worrall> All new code is targetted at the latest release, which is 0.31.0
<FromGitter> <nsuchy> the shard version says -> greater than or equal to X version
<FromGitter> <nsuchy> so it'll pull whatever is newest as long as its greater than that version right?
<FromGitter> <nsuchy> shouldn't there be a BUT less than part of shards.yml
<FromGitter> <nsuchy> to avoid breaking changes every month until things get updated correctly?
<FromGitter> <Daniel-Worrall> Do you understand what ~> means?
<FromGitter> <nsuchy> not entirely
<FromGitter> <nsuchy> that's why I asked
<FromGitter> <Daniel-Worrall> `"equal to or greater than in the last digit"`
<FromGitter> <Daniel-Worrall> so ~> 0.3.0 will update to 0.3.X but not to 0.4
<FromGitter> <nsuchy> so those projects that pushed breaking changes, should of changed the number to let's say 0.4 rather than 0.3.x?
<FromGitter> <Daniel-Worrall> Depends on their versioning semantics, but probably
mps has left #crystal-lang [#crystal-lang]
<FromGitter> <nsuchy> so aside from forking amber, making a pr that'll probably rejected in favor of updates to the current one, or waiting until next week for someone else to fix it, is there anything I can do meanwhile?
<FromGitter> <Daniel-Worrall> Don't make a pr
<FromGitter> <Daniel-Worrall> Just point to a fork
<FromGitter> <Blacksmoke16> also cant stress it enough you should be locking to specific versions in your actual app so this doesnt happen
<FromGitter> <nsuchy> @Blacksmoke16 this is an issue
<FromGitter> <nsuchy> compiling amber
<FromGitter> <nsuchy> not my app
<FromGitter> <nsuchy> I can't compile amber
<FromGitter> <nsuchy> using the last release
<FromGitter> <nsuchy> unless amber itself isn't locked to specific versions, this is an issue with amber itself not my app
<FromGitter> <Daniel-Worrall> It's a problem with an old version of amber with an old version of crystal. If you want to make this work, fork and update to work
<FromGitter> <Blacksmoke16> micrate the issue i think
<FromGitter> <Blacksmoke16> it doesnt have a version lock on `crystal-db` so its using the latest release
<FromGitter> <nsuchy> @Daniel-Worrall until recently when dependencies changed, this release of amber worked on 0.30.0-1
<FromGitter> <nsuchy> @Blacksmoke16 if that's the case though amber needs to update micrate to add a lock
<FromGitter> <Blacksmoke16> it has one now
<FromGitter> <nsuchy> I see it depends on 0.7.0 now
<FromGitter> <nsuchy> so if 0.8.0 comes out, will amber be broken until an update is released on current versions of crystal?
<FromGitter> <Blacksmoke16> prob not because theres a tag that has it locked to 0.7.0
<FromGitter> <nsuchy> is micrate fixed now?
<FromGitter> <Blacksmoke16> IDK
duane has quit [Ping timeout: 240 seconds]
<FromGitter> <Daniel-Worrall> For your uses, no and it won't be. For future, yes.