bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
<FromGitter>
<cjgajard> I want to know what you think about this because I can't find enough arguments to have a strong opinion about it by myself. Is `for` macro an "anti-pattern" for similar methods definition? (check this example: https://gist.github.com/cjgajard/dff3b9dae6aa4874e1b7b6ca4e4b2c83)
hako has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
kulelu88 has joined #crystal-lang
<FromGitter>
<jwoertink> @cjgajard If you only have those 3 properties, you could do `getter x, y, z`. It would only be one line instead of the 3 with the `for` loop
<FromGitter>
<jwoertink> I think the for macro works nicely for the other ones though because there's so many interpolations
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
soveran has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
<FromGitter>
<phoffer> How do I create a hash with a default value of an empty array? i.e. ⏎ ⏎ ```FEEDS = Hash(String, Array(String)).new ⏎ FEEDS[“crystal”] << “string”``` ⏎ ⏎ doing that errors with `missing hash key` [https://gitter.im/crystal-lang/crystal?at=581d5a12aa8f8c4b328f0763]
<FromGitter>
<jwoertink> initialize the has where each value will automatically be an array of strings
<FromGitter>
<phoffer> Oh that’s the missing piece there. I think I’m going to explicitly initialize the arrays, I’m just a little annoyed I couldn’t get the first thing working
<FromGitter>
<phoffer> btw, that second one does suffer the same issue that Ruby has with a default value of an array for a hash
<FromGitter>
<jwoertink> yeah
<FromGitter>
<luislavena> @phoffer you can use the block form of `Hash.new`
<FromGitter>
<phoffer> I knew I should have tried that @luislavena. It seems like every time I get stuck, I don’t try the Ruby way, and usually it’s an instance where they are the same :smile:
<FromGitter>
<phoffer> thanks gentlemen!
<FromGitter>
<jwoertink> :thumbsup:
kulelu88 has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
lacour has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
pawnbox_ has quit [Ping timeout: 244 seconds]
pawnbox has joined #crystal-lang
matp_ has joined #crystal-lang
matp has quit [Ping timeout: 260 seconds]
pawnbox has quit [Remote host closed the connection]
hako has quit [Ping timeout: 250 seconds]
_whitelogger has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<FromGitter>
<zatherz> is there any macros like `getter`, `setter` and `property` for class variables?
<BlaXpirit>
zatherz, no
<FromGitter>
<zatherz> should I contribute it?
<BlaXpirit>
zatherz, it's about the design, not about writing the 10 easy lines of code
<FromGitter>
<zatherz> which is exactly why I asked if I should contribute it
<FromGitter>
<zatherz> reading comprehension
<BlaXpirit>
this has been brought up before. there was no design that everyone was happy with, so this got indefinitely postponed. it's not certain where this should even be present at all
<BlaXpirit>
hm jhass has been bringing up class_property since almost 2 years ago
<Papierkorb>
No idea yet how I could minimize either cases to something shorter
Philpax has quit [Ping timeout: 260 seconds]
<BlaXpirit>
Papierkorb, because of all these corner cases that spec2 causes i consider it not worth using
<BlaXpirit>
and the atrocious traceback outputs, of course
<Papierkorb>
BlaXpirit: Well, a compiler crash is always a compiler bug
<Papierkorb>
Also, to me, `spec` is just not that good. let and subject alone make tests so easier to write.
<BlaXpirit>
spec is very bad
<BlaXpirit>
then again, can't expect too much from a compiled language
kulelu88 has joined #crystal-lang
<Papierkorb>
Why not? spec2 shows what's possible, aside from the awful error traces (though I don't know how to improve them), it does most of what I come to love of RSpec
<BlaXpirit>
spec2 is only a slight improvement, but with the mentioned significant disadvantages
<Papierkorb>
To me it's not. And regardless of opinion, a compiler crash is always a bug
<Papierkorb>
Ah. Looks like an issue with the `mock` shard
<BlaXpirit>
Papierkorb, wait, where does that one come in?
<BlaXpirit>
i dont see it referenced in your torrent code
<Papierkorb>
shard.yml, spec_helper.cr, but not used anywhere, only commented code in the transfer_spec.cr
<Papierkorb>
Ah it's not commented in the version online. Well, I commented it out and the issue was the same
<Papierkorb>
I removed the require for it too and I suddenly was able to run specs again. Not what I expected (it ran fine with the require before), but ... hey I can continue for now.
<BlaXpirit>
Papierkorb, i still don't see anything in shard.yml, have you possibly forgotten to update it?
<BlaXpirit>
anyhow, yes, your tests and their usage of spec2 look very nice
<Papierkorb>
Thanks :3
<Papierkorb>
Aaand now I'm getting "instance variable '@buckets' of Torrent::PiecePicker::RarestFirst must be Array(Array(UInt32)), not Array(Array(UInt32))" again. Fascinating.
<Papierkorb>
If I even knew how to begin debugging that issue
<BlaXpirit>
now without mock?
<Papierkorb>
Outside of spec2 RarestFirst runs fine as expected
<BlaXpirit>
maxpowa, I think there is no way at all to have a method_missing for class methods
<maxpowa>
hmm ok
<maxpowa>
thanks
<Papierkorb>
maxpowa: Although more tedious, you could iterate over a list of method to forward and then create the forwarders in the macro
<Papierkorb>
{% for name in [ :foo, :bar ] %}def self.{{ name.id }}(*args, **kwargs); INSTANCE.@forgot.{{ name.id }}(*args, **kwargs); end {% end %}
<Papierkorb>
Something like that maxpowa
<maxpowa>
yeah i guess that's possible but not really sure it's that important, the alternative is just Bot.instance.<method>
<BlaXpirit>
maxpowa, the best alternative is to not use a singleton
<maxpowa>
Singletons make reference from modules though
<maxpowa>
makes reference easy*
<Papierkorb>
maxpowa: It depends. Avoid singletons if possible, instead pass an instance of the class around
<Papierkorb>
maxpowa: More often than not a "property foo : Bar" already makes that less tedious
lacour has joined #crystal-lang
<crystal-gh>
[crystal] joshrickard opened pull request #3505: fix readme link to contribution guide (master...fix-contributing-link) https://git.io/vX8QX
jeromegn_ has quit [Ping timeout: 260 seconds]
jeromegn_ has joined #crystal-lang
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
kulelu88 has quit [Ping timeout: 252 seconds]
<Papierkorb>
Does someone have a rough estimate of when to expect the next release?
<FromGitter>
<sdogruyol> i expect 0.20.0 to be released next week
<Papierkorb>
Great, then I won't bother with the error `Random::DEFAULT.next_u` not being defined.
<Papierkorb>
Why was it renamed btw? isn't #next_u32 clearer?