RX14 changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.24.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
greengriminal has joined #crystal-lang
<robacarp> I'm thrashing here because I was sure crystal had the rubyish &. operator
<robacarp> where in the docs/book should I be looking for this
<FromGitter> <bew> In method calling I guess?
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #crystal-lang
<FromGitter> <watzon> robacarp: are you talking about for blocks?
<FromGitter> <watzon> In ruby you do `method(&:other_method)` in crystal you use a period in place of the colon, so `method(&.other_method)`
<FromGitter> <watzon> The crystal way makes more sense imo
greengriminal has quit [Quit: This computer has gone to sleep]
<robacarp> no, I couldn't find anything in the /docs or /api (nor in the compiler in syntax/parser.cr, but admittedly I'm unfamiliar with that file) which matches https://en.wikipedia.org/wiki/Safe_navigation_operator#Ruby
<robacarp> @bew I looked all throughout this section (and subsections) https://crystal-lang.org/docs/syntax_and_semantics/classes_and_methods.html before deciding it wasn't available
<FromGitter> <watzon> Oh I've actually never seen that before. Is that a special syntax for if something is nil?
<FromGitter> <watzon> There is an `Object#try` method http://devdocs.io/crystal/api/0.24.1/object#try(&block)-instance-method
<FromGitter> <watzon> Not the same, but similar
Disrecollection has joined #crystal-lang
<robacarp> yeah, it's a kind of shorthand for .try. Now that you bring that up, I think I remember reading some discussion on issues that "they" wanted to not implement a safe navigation op because it provides too much potential for abuse
<robacarp> I'm guessing here that "they" is manas
<FromGitter> <watzon> I see the potential for abuse, but I feel like the trade-off is worth it.
<FromGitter> <watzon> A safe navigation operator would be very nice
rohitpaulk has joined #crystal-lang
<FromGitter> <watzon> A dig method could also be very useful
rohitpaulk has quit [Ping timeout: 256 seconds]
DTZUZO has joined #crystal-lang
<FromGitter> <watzon> Something like this https://play.crystal-lang.org/#/r/3o0n
<FromGitter> <aisrael> I thought Crystal already have the safe navigation operator. Maybe I was just confused with `try`
<FromGitter> <aisrael> I think it’d might get confusing to use the same `&.` for safe navigation, given that it’s already used to… uhm… ‘capture’ a function (borrowing a term from Elixir), e.g. `array.map(&.size)` vs `array&.size`
<FromGitter> <aisrael> +1 for `Hash#dig`
<FromGitter> <watzon> I've got a bunch of snippets here that I feel should be added to Hash https://gist.github.com/watzon/acd7ac39be86a86ed5ea1c3340432c8d#file-hash-cr
<FromGitter> <aisrael> (Bah, Gitter OS X app will happily expand gists *way* past the window size, to the point where you can't see what you're typing anymore...)
<FromGitter> <aisrael> Anyway, maybe we all could just have, like, `active_support/core_ext` and place stuff there until it makes sense to merge them in to stdlib? :D
<FromGitter> <watzon> That might be a good idea
<FromGitter> <watzon> Something community controlled with a little more flexibility than the stdlib
<FromGitter> <aisrael> Personally, I would call the `map_keys` and `map_values` just for symmetry with `.map()`, though?
<FromGitter> <watzon> Also shorter, not a bad idea
<FromGitter> <watzon> Done
<FromGitter> <aisrael> Yeah. Naming, one of the *hard* problems in CS
<FromGitter> <watzon> One of the hard things in any language really
<FromGitter> <watzon> Oh wait, you said CS not CR
<FromGitter> <watzon> Lol
<FromGitter> <watzon> Yeah naming is hard
DTZUZO has quit [Ping timeout: 256 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Read error: Connection reset by peer]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
<robacarp> @watzon you're not likely to get far with the activesupport idea around here, there's lots of hate for it in the crystal community
<robacarp> just start submitting pulls to stdlib with the functions you've written
<FromGitter> <aisrael> Well, it’s either we PR to stdlib with no guarantee of getting merged, or we place them individually in each of our projects under e.g. `core_ext`, or we factor it out as a shard and invite others to use and contribute, right?
rohitpaulk has joined #crystal-lang
<crystal-gh> [crystal] CaDs opened pull request #5762: added documentation for IO#printf method (master...fix/added_documentation_for_printf_method) https://git.io/vA9vk
rohitpaulk has quit [Ping timeout: 256 seconds]
rohitpaulk has joined #crystal-lang
DTZUZO has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 245 seconds]
codenoid has joined #crystal-lang
<codenoid> hi, i awnt aks something, what this syntax mean, `@@after_fork_child_callbacks ||= [->Scheduler.after_fork,->Crystal::Signal.after_fork,->Crystal::SignalChildHandler.after_fork,->Random::DEFAULT.new_seed,] of -> Nil` , there is `->`, copied from src/kernel.cr:190
<FromGitter> <bew> what syntax? the `or -> Nil`? the `||=` ? the `->a_method` ?
<FromGitter> <bew> of*
<codenoid> the `->` in every array value
<FromGitter> <bew> it is one of the literal proc syntax, it creates a proc that will call the method, so for example, `->a_method` will create a proc with no argument, and when called, will calle `a_method`
<FromGitter> <bew> call*
<codenoid> okay,
<codenoid> to call a method
<FromGitter> <bew> it will not call the method
<codenoid> thanks
<codenoid> o yeah, nice example, i understand
codenoid has quit [Quit: i sleep in my keyboard]
DTZUZO has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
greengriminal has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
alex`` has joined #crystal-lang
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 248 seconds]
moei has quit [Read error: Connection reset by peer]
moei has joined #crystal-lang
<FromGitter> <watzon> @aisrael https://github.com/watzon/extensions
<FromGitter> <watzon> Or I had already started a port of activesupport... maybe I should just put everything there? https://github.com/watzon/active_support.cr
<FromGitter> <aisrael> 👍 I would’ve called it `core_ext` (see, naming!). I think the name `active_support` carries a lot of baggage :D
wojnar has joined #crystal-lang
<FromGitter> <watzon> True, but it does have a lot to offer as well
rohitpaulk has joined #crystal-lang
_whitelogger has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 260 seconds]
rohitpaulk has joined #crystal-lang
Papierkorb has joined #crystal-lang
ziprandom[m] has joined #crystal-lang
ziprandom[m] has left #crystal-lang [#crystal-lang]
wojnar has quit [Remote host closed the connection]
rohitpaulk has quit [Ping timeout: 256 seconds]
Papierkorb has left #crystal-lang ["Konversation terminated!"]
olbat__ has quit [Ping timeout: 240 seconds]
gazbit has joined #crystal-lang
alex`` has quit [Ping timeout: 240 seconds]
gazbit has quit [Quit: Leaving]
wojnar has joined #crystal-lang
Nik736 has joined #crystal-lang
Nik736 has quit [Client Quit]
greengriminal has joined #crystal-lang
andrewzah has quit [Quit: ""]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
andrewzah has quit [Quit: ""]
andrewzah has joined #crystal-lang
<FromGitter> <faustinoaq> Hi crystal community, some idea/comments about `crystal tool rename`? 😅 ⏎ ⏎ https://gist.github.com/asterite/3715161c55fa3f7322ada6fc4e2de86c
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
<FromGitter> <faustinoaq> > RX14: Personally, local variable renaming, and small refactors such as "extract this subexpression to a variable" would be my 99% usecase for a refactoring tool. ⏎ ⏎ Maybe some basic rename? 😅
thews has quit [Ping timeout: 255 seconds]
thews has joined #crystal-lang
thews has joined #crystal-lang
thews has quit [Changing host]
andrewzah has quit [Quit: ""]
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
ua has joined #crystal-lang
<FromGitter> <bew> I agree with rx14' comment
ua_ has quit [Ping timeout: 248 seconds]
<Yxhvd> oh, nice. more progress in crystal-mode for eacs. sweet stuff, too
cyberarm has quit [Read error: Connection reset by peer]
andrewzah has quit [Quit: ""]
cyberarm has joined #crystal-lang
andrewzah has joined #crystal-lang
andrewzah has quit [Client Quit]
andrewzah has joined #crystal-lang
<FromGitter> <bew> Scry is editor-agnostic, not specific to a specific one
alex`` has joined #crystal-lang
<crystal-gh> [crystal] luislavena opened pull request #5763: Refactor spec runner CLI for extensibility (master...refactor-spec-runner-cli) https://git.io/vA9wU
greengriminal has quit [Quit: This computer has gone to sleep]
<crystal-gh> [crystal] r00ster91 opened pull request #5764: Add WASD keys in 2048.cr (master...patch-4) https://git.io/vA9oJ
<FromGitter> <codenoid> hi, i need some advice, how to search hash data from another hash, ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a9af604e4d1c63604ba28e2]
<FromGitter> <codenoid> lol it's json
<FromGitter> <codenoid> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a9af6c8e4ff28713aed77b5]
<FromGitter> <codenoid> but I guess that's pretty convoluted
<FromGitter> <codenoid> or just each search hash, and check in dataa, aa i'm very confused
<FromGitter> <codenoid> but overthinking is the best learning method, it's can give you to another solution
DTZUZO has quit [Ping timeout: 252 seconds]
<crystal-gh> [crystal] r00ster91 closed pull request #5764: Add WASD keys in 2048.cr (master...patch-4) https://git.io/vA9oJ
<FromGitter> <codenoid> ok, i will use this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5a9b019ae4ff28713aeda27d]
<FromGitter> <bew> To build `sh` you can do `search.keys`
<FromGitter> <codenoid> okay, i''ll change
<FromGitter> <bew> And in english, or with example input/output, what are you trying to do?
wojnar has quit [Remote host closed the connection]
<FromGitter> <codenoid> it's for something like `WHERE` query
<FromGitter> <codenoid> *without `LIKE %%`
<FromGitter> <bew> I'm trying right now on neovim :)
<FromGitter> <faustinoaq> 😄 👏 ✨
stromwerk has joined #crystal-lang
<FromGitter> <bew> @faustinoaq how to get make scry have some loggings?
<FromGitter> <bew> ah nvm, found it
<FromGitter> <bew> the LSP client for neovim makes a `LanguageServer.log` which was always empty.. But you made your own logfile so it's fine for now :)
<FromGitter> <faustinoaq> Well, @kofno created it for vscode-crystal-ide first, so He put some settings for it. ⏎ ⏎ > ah nvm, found it ⏎ ⏎ I use `"crystal-lang.logLevel": "debug"` on VSCode, What settings are you using on NVIM? [https://gitter.im/crystal-lang/crystal?at=5a9b1793c3c5f8b90d2c9fa6]
<FromGitter> <faustinoaq> Oh, ok 👍
stromwerk has quit [Quit: Page closed]
<FromGitter> <bew> I have an error: ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ With a simple `io = IO::Memory.new; io.<completion-trigger>` [https://gitter.im/crystal-lang/crystal?at=5a9b17fce4ff28713aee0121]
DTZUZO has joined #crystal-lang
<FromGitter> <faustinoaq> Yeah, That happened to me as well, try putting your file inside a `src` folder 😅
<FromGitter> <bew> ah lol x) I'll try that
<FromGitter> <faustinoaq> Scry Auto-completion is very basic for now, there is some issues, but is a great init 👍
<FromGitter> <bew> yes sure, it's the beginning of a very useful tool
<FromGitter> <bew> I've put my file in `/tmp/src/bla.cr` still the same error
<FromGitter> <bew> I also tried to declare a Foo class, with a class method bar in another file, require it, and write `Foo.<completion-trigger>`, it gave me `Couldn't find type Foo.class`
DTZUZO has quit [Ping timeout: 248 seconds]
<FromGitter> <bew> @faustinoaq I can give you the logs, but I'm not sure it'll be useful
DTZUZO has joined #crystal-lang
<FromGitter> <laginha87> Hey @bew can you post the full logs in the pr in scry so I can take a look at them later? Like @faustinoaq its still in very early stages it doesn’t provide completion for all cases but I’d like it to at least not error.
<FromGitter> <bew> I can do that! for the IO::Memory ? or Foo ? or both?
<FromGitter> <laginha87> Both
<FromGitter> <laginha87> Thanks
<FromGitter> <bew> Looking at the logs, it seems that `Foo.<trigger>` worked, but the LSP failed to get it or sth, because the scry response looks good
<crystal-gh> [crystal] straight-shoota opened pull request #5765: Add MIME registry (master...jm/feature/mime) https://git.io/vA9yd
<FromGitter> <bew> @laginha87 I can't reproduce the errors I mentioned above, and it seems to work ;) I'm just having issues with the LSP' implementation plugin for neovim, either because scry does not support sth, or just because the plugin fails to register a new source to my completion engine plugin.. So I can't show anything for now
qard has joined #crystal-lang
qard has quit [Client Quit]
<FromGitter> <faustinoaq> > scry does not support sth, or just because the plugin fails to register a new source to my completion engine plugin ⏎ ⏎ LSP should be standard throughout editors and ides, I hope to see scry features being used on Visual Studio and Eclipse IDEs someday 😄 ⏎ ⏎ @bew Try disabling built-in features, like formatting, go-to definition, etc. I had to do it on sublime text to use scry features
hightower has joined #crystal-lang
<hightower> Hey what's a Crystal equivalent of Ruby's [1,2].pack("NN") ?