ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.33.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
ur5us has joined #crystal-lang
blackbeard420 has quit [Quit: ZNC 1.7.5 - https://znc.in]
blackbeard420 has joined #crystal-lang
darkstardevx has joined #crystal-lang
dwdv has quit [Ping timeout: 240 seconds]
<postmodern> Blacksmoke16, CRC81Wire = CRC8_1Wire within module Digest, then in a spec Spectator.describe Digest::CRC81Wire ... it { expect(described_class).to eq(Digest::CRC8_1Wire) }
<FromGitter> <Blacksmoke16> you know `alias` is a thing
<FromGitter> <Blacksmoke16> versus redefining the constant
ur5us has quit [Ping timeout: 240 seconds]
ur5us has joined #crystal-lang
Human_G33k has joined #crystal-lang
HumanG33k has quit [Ping timeout: 256 seconds]
<postmodern> ah that's right
wakatara has joined #crystal-lang
wakatara has quit [Quit: Using Circe, the loveliest of all IRC clients]
ur5us has quit [Ping timeout: 240 seconds]
<FromGitter> <grkek> @Blacksmoke16 Oh my I knew something was up with the compiler
_ht has joined #crystal-lang
_ht has quit [Quit: _ht]
alexherbo2 has joined #crystal-lang
Seich has quit [*.net *.split]
antoszka has quit [*.net *.split]
daemonwrangler has quit [*.net *.split]
justinmcp_ has quit [*.net *.split]
olbat has quit [*.net *.split]
f1refly has quit [*.net *.split]
hpyc9 has quit [*.net *.split]
Xeago has quit [*.net *.split]
lvmbdv has quit [*.net *.split]
go|dfish has quit [*.net *.split]
early has quit [*.net *.split]
woodruffw has quit [*.net *.split]
repo has quit [*.net *.split]
twistedpixels has quit [*.net *.split]
edr has quit [*.net *.split]
dom96 has quit [*.net *.split]
adam12 has quit [*.net *.split]
olbat[m] has quit [*.net *.split]
dannyAAM has quit [*.net *.split]
juanfra_ has quit [*.net *.split]
issyl0 has quit [*.net *.split]
oz has quit [*.net *.split]
raz has quit [*.net *.split]
bougyman has quit [*.net *.split]
snapcase has quit [*.net *.split]
Human_G33k has quit [*.net *.split]
_whitelogger has joined #crystal-lang
gangstacat has joined #crystal-lang
blackbeard420 has joined #crystal-lang
yxhuvud has joined #crystal-lang
maxpowa has joined #crystal-lang
commavir has joined #crystal-lang
FromGitter has joined #crystal-lang
dwdv has joined #crystal-lang
postmodern has quit [Quit: Leaving]
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
alexherbo25 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo25 is now known as alexherbo2
alexherbo21 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 258 seconds]
alexherbo21 is now known as alexherbo2
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#9e47629 (master - Update future.cr (#8860)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/658687956
travis-ci has left #crystal-lang [#crystal-lang]
Human_G33k has quit [Quit: Leaving]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
DTZUZU has quit [Quit: WeeChat 2.7]
DTZUZU has joined #crystal-lang
<FromGitter> <wout> I am having trouble with nilable types in a macro. Can anyone of you point me in the right direction? https://stackoverflow.com/questions/60541322/using-nilable-types-in-crystal-macros
<FromGitter> <Blacksmoke16> i think you're overthinking this
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e61232e53fa513e286f7f63]
<FromGitter> <Blacksmoke16> tada
<FromGitter> <Blacksmoke16> er
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e61238290a829582408c923]
<FromGitter> <Blacksmoke16> that
<FromGitter> <Blacksmoke16> @wout ^
<FromGitter> <wout> Thanks, that's better indeed. But that part works, it's the nilable type that's not working form some reason. :)
<FromGitter> <Blacksmoke16> what do you mean `not working`?
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8oi4 seems fine to me?
<FromGitter> <wout> Right... In the specs, when I change the annotated getter with `json_field(:field_name, Time?)` for example, the spec fails.
<FromGitter> <wout> But it might be something else, I'll have to check.
<FromGitter> <Blacksmoke16> fail how? whats the error?
<FromGitter> <Blacksmoke16> its prob something else not related to your macro
<FromGitter> <wout> Yeah, that's what I am thinking now.
<FromGitter> <wout> It's too much to explain. I'll dive into the code again. Thanks!
<FromGitter> <Blacksmoke16> 👍
Human_G33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
<FromGitter> <wout> @Blacksmoke16 Just did some more tests and I really can't find the issue. What I am talking about it this: https://github.com/wout/mollie.cr/blob/master/src/mollie/payment.cr#L25-L26
<FromGitter> <Blacksmoke16> what exactly isnt working?
<FromGitter> <Blacksmoke16> like what is the error you're getting?
DTZUZU2 has joined #crystal-lang
<FromGitter> <wout> The first dield (`amount`) works, as soon as I enable the line 25 instead of 26, the field returns `nil`.
<FromGitter> <wout> This is the part of the spec that fails: https://github.com/wout/mollie.cr/blob/master/spec/mollie/payment_spec.cr#L73
DTZUZU has quit [Ping timeout: 258 seconds]
<FromGitter> <wout> With the `getter`, I am getting a `Mollie::Amount`, with the `json_field` I get `nil`.
<FromGitter> <Blacksmoke16> what happens if you apply the annotation manually
<FromGitter> <wout> Found it, I have been overlooking a tiny mistake in the source json.
<FromGitter> <wout> Thought I was going crazy.
<FromGitter> <wout> In the source json, the key is already underscored, and it shouldn't be.
<FromGitter> <wout> Thanks again for your time.
<FromGitter> <Blacksmoke16> 👍 np
<FromGitter> <Blacksmoke16> did you try like `type.is_a? Time`?
<FromGitter> <wout> Much better, thanks! I have been struggling with that one as well . :D
<FromGitter> <Blacksmoke16> also you dont need the `{{debug}}` i just included that to show it was generating the correct thing
<FromGitter> <wout> Yes, that's already gone. Was just to see how the fields were mapped.
<FromGitter> <wout> `type.is_a?(Time)` does not seem to work.
<FromGitter> <Blacksmoke16> try `type.id == Time`?
<FromGitter> <Blacksmoke16> or `type <= Time?`
<FromGitter> <Blacksmoke16> something along those lines :S
<FromGitter> <wout> Yeah, I have been trying many things there, but those two don't work either.
<FromGitter> <wout> So far, the only thing that works for both `Time` and `Time?`, is `[Time.id, "::Union(Time, ::Nil)".id].includes?(type.id)`.
<FromGitter> <wout> It is ugly, though.
<FromGitter> <Blacksmoke16> `if type.resolve <= Time?`
<FromGitter> <Blacksmoke16> that'll work
<FromGitter> <wout> Getting another error
<FromGitter> <wout> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e6135c63ca0375cb3a1e1f5]
<FromGitter> <Blacksmoke16> that one's on you, just as it says
<FromGitter> <wout> Which is weird because HS2 is defined as an alias.
<FromGitter> <Blacksmoke16> is the file its defined in required?
<FromGitter> <wout> AFAIK aliasses can be defined globally, right?
<FromGitter> <wout> If I am using `[Time.id, "::Union(Time, ::Nil)".id].includes?(type.id)`, I am not getting the error.
<FromGitter> <wout> With `type.resolve <= Time?`, I do.
<FromGitter> <Blacksmoke16> possibly a fact that its working now? :p
<FromGitter> <wout> Well, all my specs clear with `[Time.id, "::Union(Time, ::Nil)".id].includes?(type.id)`.
<FromGitter> <Blacksmoke16> is there a spec testing both nilable and not nilable time?
<FromGitter> <wout> Let me see.
<FromGitter> <wout> No, but just added one and no issues.
_ht has joined #crystal-lang
<FromGitter> <Blacksmoke16> what is `HS2` an alias of?
<FromGitter> <Blacksmoke16> i dont see how that has anything to do with changing that macro
<FromGitter> <wout> Hash(String, String)
<FromGitter> <wout> No, me neither.
<FromGitter> <wout> Just did some testing by splitting out `Time` and the `Time | Nil` union, and that's all working correctly.
<FromGitter> <Blacksmoke16> the issue is `.resolve` goes out to resolve the alias's value
<FromGitter> <Blacksmoke16> however its defined *after* the file is required, so at the time of the macro expanding it pro doesnt exist?
<FromGitter> <wout> You're right. Just moved the aliasses to the top of the file and the error goes away. But then I'm getting another one which is harder to solve:
<FromGitter> <wout> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e613af853fa513e286fdea6]
<FromGitter> <Blacksmoke16> prob same idea
<FromGitter> <Blacksmoke16> try requiring all your other files before you require the macro
<FromGitter> <wout> Let's see if I can make that work..
<FromGitter> <oz> Is anyone working on matrix client or server libs [in crystal]?
<FromGitter> <j8r> `Error: class variables can only be annotated with ThreadLocal`...
<FromGitter> <j8r> How do I annotate a top level object?
<FromGitter> <Blacksmoke16> are you trying to annotate it as `ThreadLocal`?
<FromGitter> <wout> @Blacksmoke16 I think there is no way to that. The macro is part of the a `Base` struct from which most other structs inherit. So moving the `Base` to the end of the loading sequence, throws a `Error: undefined constant`. Extracting the macro into a separate file, same issue.
<FromGitter> <Blacksmoke16> each child struct would/should prob have to do `require "./base"`
<FromGitter> <Blacksmoke16> or something along those lines
<FromGitter> <wout> Aaaah, that might be it.
<FromGitter> <j8r> I don't understand the error:/
<FromGitter> <Blacksmoke16> got an example of what you're trying to do?
<FromGitter> <j8r> it was this
<FromGitter> <anykeyh> Hello, does anybody already experienced crashing app when issue occurs in (rescued) fiber?
<FromGitter> <anykeyh> Actually ignore the fiber part, it crashes the app even if I don't call `spawn` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e6141e62e398f46abe15e4b]
<FromGitter> <Blacksmoke16> @j8r ahh, i forgot that was a bug 😬
<FromGitter> <Blacksmoke16> is that a valid url?
<FromGitter> <anykeyh> nope, I'm just forcing failure
<FromGitter> <anykeyh> I've a live app going wild whenever mailgun reject my connection ;)
<FromGitter> <Blacksmoke16> got some example code? just seems like you would have to rescue that exception no?
<FromGitter> <anykeyh> I think it's more related to crystal-email shard, I'll continue to investigate, unless someone has experienced IO failure which eventually breaks everything 😃
<FromGitter> <Blacksmoke16> otherwise it would bubble up
<FromGitter> <anykeyh> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e6142c44eefc06dcf389822]
<FromGitter> <Blacksmoke16> yea that should do it
<FromGitter> <anykeyh> Awww
<FromGitter> <Blacksmoke16> figure it out?
<FromGitter> <anykeyh> Yeah
<FromGitter> <anykeyh> The owner of the shard
<FromGitter> <anykeyh> Catch the fatal error and there is this in the config
<FromGitter> <anykeyh> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e61450eca2f5a558d6a33b5]
<FromGitter> <Blacksmoke16> rip
<FromGitter> <Blacksmoke16> doesnt seem ideal...
<FromGitter> <anykeyh> that's a very dangerous handler hahaha
<FromGitter> <anykeyh> yep, I'll raise an issue, https://github.com/arcage/crystal-email, the shard is great tho
<FromGitter> <Blacksmoke16> 👍
alexherbo23 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 240 seconds]
alexherbo23 is now known as alexherbo2
<FromGitter> <anykeyh> Gosh, I just noticed someone mentioned me asking for help here in 2018... I'm lagging more than 56k connection.
<FromGitter> <Blacksmoke16> xD
postmodern has joined #crystal-lang
alexherbo2 has quit [Remote host closed the connection]
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#a33fdc4 (master - Wait for server to start listening on web socket specs (#8879)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/658835894
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8879 (Wait for server to start listening on web socket specs)
sz0 has quit [Quit: Connection closed for inactivity]
ur5us has joined #crystal-lang
teardown has joined #crystal-lang
_ht has quit [Quit: _ht]
sagax has quit [Read error: Connection reset by peer]
<FromGitter> <wontruefree> We are about to hear form Jason Malcolm about running Crystal in production if anyone wants to join https://zoom.us/j/3541015445