ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.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
_whitelogger has joined #crystal-lang
<FromGitter> <whidbey> bad need a smart ide for crystal
<FromGitter> <wontruefree> which features are you looking for
<FromGitter> <wontruefree> I would love an auto complete
<FromGitter> <whidbey> a.cr has module X and method y; b.cr require "./a", and couldn't get X.y automate
<FromGitter> <wontruefree> I hope this project will bring some of that https://github.com/crystal-lang-tools/scry
<FromGitter> <tenebrousedge> @wontruefree please actually post a reminder here before that starts, I'd hate to miss it
<FromGitter> <wontruefree> @tenebrousedge I will do that
<FromGitter> <wontruefree> never know how much I can big this chat
<FromGitter> <whidbey> and when we have hundres of .cr file? its a nightmare when we type and rolling files bettwen files to seeking a method and paramters ,its pain..
<FromGitter> <whidbey> scry wont works when using vscode .
<FromGitter> <tenebrousedge> @wontruefree I think you get extra allowances when it's Ary doing the presentation
<FromGitter> <whidbey> @wontruefree do you have solution yet?
<FromGitter> <whidbey> i dont' care new features of language itself...but IDE feature is bad need i thought...for most people.
<FromGitter> <wontruefree> I do not have a solution
<FromGitter> <wontruefree> good to know :)
<FromGitter> <whidbey> :)
f1refly has joined #crystal-lang
f1reflyylmao has quit [Ping timeout: 245 seconds]
DTZUZO has quit [Ping timeout: 265 seconds]
<FromGitter> <firejox> @christopherzimmerman this `(->self.itself).closure_data.as(Pointer(typeof(self)))` will work after initiate it ⏎ https://play.crystal-lang.org/#/r/84n4
ht_ has joined #crystal-lang
<FromGitter> <leighmcculloch> Hi, how do folks access multi-dimension arrays in Crystal? I was just trying to make a two dimensional boolean array for a script and discovered that while I could create it with `Array.new(2000, Array.new(2000, Bool))`, when I tried to access it with `arr[i][j] = true` I get the following error: ⏎ `Error: no overload matches 'Array(Bool.class)#[]=' with types Int32, Bool`
raz has quit [Ping timeout: 268 seconds]
raz has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
<Yxhuvud> You are creating an array that contains 2000 copies of one other array, that in turn has 2000 copies of the Bool class. Try `Array.new(20) { Array.new(20) {false}}`
<Yxhuvud> and by "copies", I mean "references to"
<FromGitter> <igor-alexandrov> Hello. I am finishing plugin interface for Shrine and all seems to work well, except one thing. I am trying to pass a Proc as an argument to plugin configuration and if I pass it directly – everything works fine, but if I save it to variable and then pass this variable, it brakes. You can check it here: https://gist.github.com/igor-alexandrov/b80c1af4f786a4215a0ce331f765d796. Try to compile this code.
<FromGitter> ... To make it work, comment line 134 and uncomment line 135. Do you have any thoughts? Thank you!
alexherbo2877135 has joined #crystal-lang
Xeago_ has joined #crystal-lang
repo has quit [Ping timeout: 240 seconds]
coderobe8 has joined #crystal-lang
Xeago has quit [Ping timeout: 240 seconds]
coderobe has quit [Ping timeout: 240 seconds]
Xeago_ is now known as Xeago
repo has joined #crystal-lang
yukai has quit [Ping timeout: 268 seconds]
<FromGitter> <watzon> Holy crap that's a lot of classes https://github.com/watzon/proton/tree/master/src/proton/types
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 276 seconds]
dwdv has joined #crystal-lang
<livcd> watzon: how long does it take to compile ?
<FromGitter> <watzon> Not terribly long. About 10 seconds.
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
Flipez has quit [Ping timeout: 240 seconds]
dostoyevsky has quit [Ping timeout: 240 seconds]
dostoyevsky has joined #crystal-lang
Flipez has joined #crystal-lang
alexherbo2877135 has quit [Ping timeout: 268 seconds]
alexherbo2 has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <ndbroadbent> hello, I thought it would be really useful to start working on a mapping from some Ruby gems => Crystal shards: https://github.com/crystal-lang/crystal/wiki/Crystal-Shards-for-Ruby-Gems
<FromGitter> <j8r> It really should have a repo like `awesome-crystal-for-rubyists` :)
<FromGitter> <igor-alexandrov> Great job!
DTZUZO has quit [Ping timeout: 268 seconds]
<FromGitter> <j8r> where there are the idioms, gems mapping, tools, tips and tricks
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
<FromGitter> <ndbroadbent> ooh yeah, I just saw @Blacksmoke16's comment on this PR: https://github.com/veelenga/awesome-crystal/pull/457#issuecomment-552223501 ⏎ that's a really great idea to ensure that libraries have regular CI builds and are maintained to work with the latest version of crystal (especially before the 1.0 release)
<FromGitter> <ndbroadbent> would it make more sense to add a README.rubyists.md to awesome-crystal?
<FromGitter> <ndbroadbent> I don't know if I want to start a brand new project because I think there's already a bit too much fragmentation, but this PR / CI workflow seems a lot better than maintaining a wiki page
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 246 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 268 seconds]
duane has quit [Ping timeout: 265 seconds]
DTZUZO has joined #crystal-lang
DTZUZO has quit [Ping timeout: 265 seconds]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
DTZUZO has joined #crystal-lang
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
DTZUZO has quit [Ping timeout: 250 seconds]
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
<FromGitter> <j8r> Not really @ndbroadbent , awesome crystal is a curated list of crystal libraries
blassin has quit [Read error: Connection reset by peer]
<FromGitter> <j8r> what do you mean by fragmentation?
blassin has joined #crystal-lang
DTZUZO has joined #crystal-lang
<FromGitter> <ndbroadbent> lots of people working on things independently instead of under a shared organization
<FromGitter> <ndbroadbent> which can cause problems if they lose interest and stop maintaining a library / resource
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Client Quit]
<FromGitter> <ndbroadbent> but I think that's normal for an open source community, and I've noticed the same issues with unmaintained ruby gems
DTZUZO has quit [Ping timeout: 240 seconds]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
<FromGitter> <christopherzimmerman> @leighmcculloch shameless plug for bottle. It provides a convenient interface for ndarrays. What you’re asking for is as simple as: Tensor.new([2000,2000]) { |_| false }
<FromGitter> <christopherzimmerman> Tensor works for numeric and Boolean data, but you can extend the base array to support anything.
blassin has quit [Client Quit]
blassin has joined #crystal-lang
blassin has quit [Client Quit]
blassin has joined #crystal-lang
blassin has quit [Read error: Connection reset by peer]
blassin has joined #crystal-lang
blassin has quit [Client Quit]
<FromGitter> <j8r> @ndbroadbent it's better to have this rather than having a big project, and parts inside that are not maintained anymore but still bundled
<FromGitter> <j8r> Too bad that they are lots of tools unrelated to the very core language in the compiler
<FromGitter> <j8r> Like the playground, init tool
coderobe8 is now known as coderobe
<FromGitter> <ndbroadbent> I guess so, but I think it's even better to have regular CI builds that test everything and prevent anything from being unmaintained
<FromGitter> <j8r> even the doc generator
<FromGitter> <j8r> You can still have this in separate repos
<FromGitter> <j8r> the problem: it is harder to delegate maintainer when you are in a big monorepo
<FromGitter> <j8r> because rights are done per repo, not per path :/
<FromGitter> <ndbroadbent> right
<FromGitter> <j8r> But you're right on a point, packaging is more complicated
<FromGitter> <ndbroadbent> I really like the crystal-lang-tools organization on GitHub
<FromGitter> <ndbroadbent> https://github.com/crystal-lang-tools
<FromGitter> <ndbroadbent> but I think there just needs to be 2-3 people who are actively using the main extensions
<FromGitter> <ndbroadbent> (I think I spent about an hour researching and tracking down this issue: https://github.com/crystal-lang-tools/vscode-crystal-lang/issues/84, and right now I'm using someone's fork to fix the problem: jgillich.crystal-lang-fixed)
<FromGitter> <ndbroadbent> I was thinking about adding another $50 to the bounty, but I don't know if that will help
<FromGitter> <j8r> there is also https://github.com/crystal-community, which is really nice too
DTZUZO has joined #crystal-lang
<FromGitter> <ndbroadbent> oh awesome!
duane has joined #crystal-lang
DTZUZO has quit [Ping timeout: 276 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <Blacksmoke16> github has a feature to give permissions based on dir and file type etc
<repo> Xeago: you can do AoC in crystal :)
<repo> good way to learn a new language
<FromGitter> <j8r> @Blacksmoke16 ha, didn't know. ⏎ ⏎ > The people you choose as code owners must have write permissions for the repository
flaviodesousa has quit [Quit: KVIrc 4.9.3 Aria http://www.kvirc.net/]
<FromGitter> <kinxer> Do we have a private Crystal leaderboard for AoC 2019?
<FromGitter> <tenebrousedge> oh, I suppose that has started, hasn't it?
DTZUZO has quit [Ping timeout: 250 seconds]
<FromGitter> <yxhuvud> @kinxer not that I know of, but you can find my solutions on my github :)
<hightower4> Blacksmoke16 wanted to ask you, why you chose not to use builting http handlers? Didn't like their pipeline-like structure or?
<hightower4> builtin*
<FromGitter> <Blacksmoke16> the main thought is that the event architecture would be more flexible
<FromGitter> <Blacksmoke16> shards could define their own listeners that just get registered when its installed, so you dont have to add `MyHandler.new` to the handlers array when running the server
ht_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> priority allows the order the listeners get executed in to be controlled, i.e. a security listener should run before anything else etc
<hightower4> cool
<FromGitter> <Blacksmoke16> also allows each listener to have access to more information from the event obj, versus having to monkey patch things into the request context obj
<FromGitter> <Blacksmoke16> just a better design imo
DTZUZO has joined #crystal-lang
<FromGitter> <Blacksmoke16> @j8r is that static linking with libxml still an issue?
<hightower4> Ok great, another finished shard as a side-effect of working on https://github.com/crystallabs/crysterm is this one: https://github.com/crystallabs/term_colors
baweaver has joined #crystal-lang
HumanG33k has quit [Ping timeout: 268 seconds]
HumanG33k has joined #crystal-lang
<FromGitter> <Blacksmoke16> 👍 gotcha, thanks
<FromGitter> <j8r> you can manually pass `--link-flags '-lzma -lxml2'`
HumanG33k has quit [Ping timeout: 276 seconds]
<FromGitter> <j8r> @ndbroadbent oh, there is already https://github.com/sdogruyol/crystal_for_rubyists
<FromGitter> <Blacksmoke16> ☝️ December 1, 2019 2:03 PM (https://gitter.im/crystal-lang/crystal?at=5de40e9d5ac7f22fb54205ed) @christopherzimmerman @asterite some thread/blog post on how to use that might be helpful
<FromGitter> <Blacksmoke16> i imagine its quite simple?
<FromGitter> <j8r> on macOS they use Instruments, which is based on DTrace
<FromGitter> <watzon> Ok I don't get it ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ How can I make it so that an Array of `UpdateHandler(Types::Base)` accepts UpdateHandlers with types that inherit from `Types::Base`? [https://gitter.im/crystal-lang/crystal?at=5de6c2ac1659720ca8f2a459]
<FromGitter> <watzon> Here's the actual code https://github.com/watzon/proton/blob/master/src/proton/client.cr
ur5us has joined #crystal-lang
<FromGitter> <watzon> It would be nice if I could just do this ⏎ ⏎ ```@event_handlers : Hash(Types::Base.class, Array(UpdateHandler))``` ⏎ ⏎ But I can't use UpdateHandler that generically [https://gitter.im/crystal-lang/crystal?at=5de6c39e05eec2433dcab24c]
<FromGitter> <kinxer> I don't remember who was asking about iterating over multiple ranges with early exit (I think they were working on AoC 2019 day 2), but would this be useful to anyone, either in a shard or in a stdlib PR: https://carc.in/#/r/84rj ?
<FromGitter> <tenebrousedge> interesting
<FromGitter> <tenebrousedge> there already is a `product` for `Iterable` though
<FromGitter> <kinxer> This one? https://crystal-lang.org/api/0.31.1/Enumerable.html#product(initial:Number,&block)-instance-method
<FromGitter> <kinxer> I'm trying to do something more like `Array.product`.
<FromGitter> <tenebrousedge> yes, there's that. I thought there was one for `Iterable` as well. But either way, you have a name collision
<FromGitter> <kinxer> No. I'm defining it on `Iterator`.
<FromGitter> <kinxer> With different parameters.
* FromGitter * tenebrousedge ponders this
<FromGitter> <kinxer> I added `Iterator#product(other : Iterator) : Iterator`, which shouldn't collide with `Enumerable#product()`, `Enumerable#product(initial : Number, &block)`, `Enumerable#product(initial : Number)`, or `Enumerable#product(&block)`
<FromGitter> <kinxer> So my defining it on `Iterator` isn't relevant, I guess. But the parameter types are.
<FromGitter> <watzon> @Blacksmoke16 any idea? ☝️ December 3, 2019 1:16 PM (https://gitter.im/crystal-lang/crystal?at=5de6c2ac1659720ca8f2a459)
<FromGitter> <watzon> I know you've dealt with similar stuff with Athena
<FromGitter> <kinxer> @watzon That looks like https://carc.in/#/r/84rm
<FromGitter> <kinxer> Is that accurate?
<FromGitter> <watzon> Hmm carc.in is giving me issues
<FromGitter> <Blacksmoke16> @j8r right, more so meant like how to use it to profile a program. prob not specific to crystal tho?
<FromGitter> <kinxer> @watzon Does Crystal play work? I can copy it over.
<FromGitter> <watzon> They both seem to not be working. Seems like DNS issues.
<FromGitter> <kinxer> Huh. Weird.
<FromGitter> <watzon> I tried my VPN as well :/
<FromGitter> <kinxer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5de6c8b06a85195b9ef152cf]
<FromGitter> <watzon> Yeah that's basically it, but with the added bonus of having `Super` be `Array(Super)`
<FromGitter> <kinxer> Yeah. I'm having trouble reproducing the `Hash::Entry` part of the message.
<FromGitter> <Blacksmoke16> @watzon got an example of that issue?
<FromGitter> <watzon> Also `Super` should be abstract in this case
<FromGitter> <kinxer> Got it.
<FromGitter> <watzon> @Blacksmoke16 I'll see if I can come up with a reproducable example. Kinda hard without carc.in working thouhg.
<FromGitter> <kinxer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5de6c945c3d6795b9f19b9e7]
<FromGitter> <kinxer> Code here if anyone with access to carc.in wants to take a stab at fixing it: https://carc.in/#/r/84rt
<FromGitter> <kinxer> Actually, this seems to work (specifying that the array is of the supertype): ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5de6c9911659720ca8f2dd85]
<FromGitter> <Blacksmoke16> https://carc.in/#/r/84rx
<FromGitter> <Blacksmoke16> `of Super`
<FromGitter> <Blacksmoke16> https://carc.in/#/r/84ry is only an issue when the array is of a single child type
<FromGitter> <Blacksmoke16> https://carc.in/#/r/84ry
<FromGitter> <kinxer> I'm not sure who ninja'd who there. :P But that solution should work, @watzon.
<FromGitter> <watzon> If only I could see it lol
<FromGitter> <kinxer> Can you see my code block above?
<FromGitter> <j8r> @Blacksmoke16 yep, not specific
<FromGitter> <watzon> Yeah I see that
<FromGitter> <kinxer> Blacksmoke's first carc.in link is the same code as the last code block I sent.
<FromGitter> <watzon> Ahh ok
<FromGitter> <watzon> Idk how that would work with my case though... Guess it's time to do some more experimenting
<FromGitter> <watzon> For me it seems to be more of a problem with the genric
<FromGitter> <watzon> Because I have `Hash(Types::Base.class, Array(UpdateHandler(Types::Base)))`
<FromGitter> <watzon> But the array doesn't accept `UpdateHandlers` with subclasses of `Types::Base`
<FromGitter> <Blacksmoke16> `of Type::Base.class => Array(Types::Base)`
<FromGitter> <Blacksmoke16> ?
<FromGitter> <Blacksmoke16> er you get the idea, seems i got that wrong
<FromGitter> <watzon> This is how I'm initializing it `@event_handlers = {} of Types::Base.class => Array(UpdateHandler(Types::Base))`
<FromGitter> <Blacksmoke16> yea if possible get an example going, that'll be easier
<FromGitter> <watzon> Yeah hopefully carc.in will decide to start working for me
<FromGitter> <watzon> Finally got it working
<FromGitter> <Blacksmoke16> \o/
<FromGitter> <kinxer> Anyone have any pointers for making this benchmark more realistic/useful? https://carc.in/#/r/84rz ⏎ No, I'm not trying to run it on carc.in. Yes, I'm running it with `--release`.
<FromGitter> <watzon> Best minimal example I can come up with @Blacksmoke16 @kinxer
<FromGitter> <kinxer> @watzon Do you have a link?
<FromGitter> <watzon> Oops forgot it lol
<FromGitter> <watzon> https://carc.in/#/r/84s1
<FromGitter> <kinxer> How about `@handlers[klass] ||= [] of UpdateHandler(Types::Base)`?
<FromGitter> <kinxer> https://carc.in/#/r/84s3
<FromGitter> <watzon> Lol well that seems to work
<FromGitter> <watzon> Thanks rubber duck
<FromGitter> <kinxer> Np. :)
duane has quit [Ping timeout: 240 seconds]
commavir has quit [Remote host closed the connection]
teardown has quit [Ping timeout: 268 seconds]
ht_ has quit [Remote host closed the connection]
teardown has joined #crystal-lang
commavir has joined #crystal-lang
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter> <watzon> Dealing with Procs and generic types is annoying af
<FromGitter> <tenebrousedge> yes
<FromGitter> <tenebrousedge> @kinxer why did you choose to write that `Iterator#product` code?
<FromGitter> <kinxer> @tenebrousedge Someone asked on Gitter recently (in the last two weeks) essentially about a compact way to do a find on two `Enumerable`s. I don't remember who it was, though, and I couldn't find it when I looked earlier today. They first asked about `break`ing from nested loops, like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5de6e9df08d0c961b7e6b470]
yukai has joined #crystal-lang
<FromGitter> <tenebrousedge> I was involved in that conversation, yes
<FromGitter> <kinxer> Ah, right. So I was trying to find a good, compact way to do that (the above, with the added requirement of returning the `i` and `j`), and I couldn't find one I was satisfied with without writing a custom iterator.
<FromGitter> <tenebrousedge> well, neither could I, and I did start to write an iterator myself, but it was obnoxiously verbose
<FromGitter> <tenebrousedge> and having just solved that particular problem, it seems like the effort was disproportionate to the task at hand
<FromGitter> <tenebrousedge> I just did `(0..99).to_a.product((0..99).to_a).find`
<FromGitter> <kinxer> Yeah, I agree. I used nested loops, which isn't as pretty but is still pretty simple.
<FromGitter> <tenebrousedge> well, fair enough
<FromGitter> <kinxer> I might try for performance and readability rather than concision.
<FromGitter> <tenebrousedge> I feel like I don't name things correctly :/
<FromGitter> <kinxer> Your computer looks much more complete than mine (https://github.com/kinxer/aoc2019/blob/master/2.cr). I suspect I'll need to restructure it when more operations are added.
<FromGitter> <kinxer> Your naming looks pretty much fine to me.
<FromGitter> <tenebrousedge> 😓
<FromGitter> <tenebrousedge> sometimes I worry about not having taken a compilers course
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Client Quit]