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
<watzon> Yeah it's working in Fedora toolbox, but not in nsbox. They must not be running with the proper flag.
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
<FromGitter> <Blacksmoke16> :shrug: possibly
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
gangstacat has quit [Ping timeout: 272 seconds]
gangstacat has joined #crystal-lang
ur5us has joined #crystal-lang
_ht has joined #crystal-lang
ur5us has quit [Quit: Leaving]
ur5us has joined #crystal-lang
alexherbo2 has joined #crystal-lang
ur5us has quit [Ping timeout: 240 seconds]
alexherbo23 has joined #crystal-lang
alexherbo2 has quit [Read error: Connection reset by peer]
alexherbo2 has joined #crystal-lang
alexherbo23 has quit [Ping timeout: 256 seconds]
alexherbo2 has quit [Ping timeout: 265 seconds]
sagax has quit [Read error: Connection reset by peer]
sagax has joined #crystal-lang
<FromGitter> <j8r> It is great ot have exhaustive case
<FromGitter> <j8r> I'm thinking, what about the opposite?
<FromGitter> <j8r> For example: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7f45d7d7d8504dee70b9df]
<FromGitter> <stronny> so about that. What if I have a `MyEnum.new(123)`?
return0e_ has joined #crystal-lang
return0e has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #crystal-lang
<FromGitter> <paulcsmith> This is probably simple, but I cannot figure it out. I'm trying to add a type restriction for a Proc and say the return type can be *anything* but I can't figure out a way to do it 🤔
<FromGitter> <paulcsmith> Simplified example here of what I'm trying to do https://play.crystal-lang.org/#/r/8s9k
<FromGitter> <tenebrousedge> you probably need a block, not a proc
<FromGitter> <tenebrousedge> if you really need a proc, you might need generics
<FromGitter> <paulcsmith> Hmm, I don't see anything about type restrictions with blocks? How would that work
<FromGitter> <paulcsmith> Sorry, I mean with multiple arguments. But maybe I'm just being thick today :)
<FromGitter> <stronny> > The return type (R) is inferred from the proc's body.
<FromGitter> <stronny> as for blocks, take a look here https://crystal-lang.org/reference/syntax_and_semantics/capturing_blocks.html
<FromGitter> <paulcsmith> That makes sense, the problem is I want to have a Proc where it basically ignores the return type
<FromGitter> <stronny> > To have something returned, either specify the return type or use an underscore to allow any return type:
<FromGitter> <stronny> make it return Nil?
<FromGitter> <paulcsmith> Ohh, where is that? I didn't see that
<FromGitter> <paulcsmith> The `_` did not work :(
<FromGitter> <paulcsmith> I mean, yeah I could have it return nil but that is a bit awkware
<FromGitter> <paulcsmith> What I'm looking for is something like return type restrictions with regular methods. For example I can do this: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7f57274a4f8e0a100f1755]
<FromGitter> <paulcsmith> This is possible with methods, seems like it should be possible with Procs as well.
<FromGitter> <stronny> in your example you call proc from methods anyway
<FromGitter> <paulcsmith> I'm not sure what you mean...
<FromGitter> <paulcsmith> Here is another example. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7f57984a4f8e0a100f17e2]
<FromGitter> <paulcsmith> So with the class I'm writing I want to pass multiple procs to it. Run each of them. But I don't care about the return value of the Proc. I want someone to pass whatever proc they want, run it, and that's it
<FromGitter> <stronny> ```code paste, see link``` ⏎ ⏎ this works [https://gitter.im/crystal-lang/crystal?at=5e7f57e44a4f8e0a100f182e]
<FromGitter> <paulcsmith> Now I could do `-> { "hmm"; nil}` but that just looks super strange. I would expect to be able to set a return type of `Nil` and have the Proc always return nil, like it does with a method call
<FromGitter> <paulcsmith> Yes, but that only works with one proc
<FromGitter> <paulcsmith> Or is there a way to do that with multiple procs? My understanding was that syntax only works for one
<FromGitter> <paulcsmith> As far as I can tell I do need an explicit type restriction. I can do it with `Proc(Nil)`, but I'd like to not have to return `nil` explicitly in each proc I pass it.
<FromGitter> <stronny> there is a way to do it
<FromGitter> <paulcsmith> Sorry I didn't explain that earlier. I was trying to keep it simple but probably left out too much info
<FromGitter> <stronny> the question is why do you want it
<FromGitter> <paulcsmith> I didn't want to go deep into why I want to do it, but if you really want to know I can explain
<FromGitter> <paulcsmith> In Lucky you have class components for rendering html. I want to allow passing in procs to components so I can have a component that renders html in different slots. Return value does not matter. Will post example in a second
<FromGitter> <paulcsmith> So in this case I want to create a resuable description list component and pass blocks for the different slots. This is a very powerful pattern I'd like to just not have to explicitly return `nil` in those passed in procs because it's weird 😬
<FromGitter> <paulcsmith> So I really do want it, and I think it makes sense. However, if you have some others ideas, let me know :D
<FromGitter> <paulcsmith> The key here is that the HTML methods write directly to a IO::Memory. So we don't need the return values as they are not used at all
<FromGitter> <stronny> returning Nil is the best solution imo
<FromGitter> <paulcsmith> 🤷‍♂️
<FromGitter> <stronny> the problem here is that Proc is a template
<FromGitter> <stronny> you won't be able to store `Proc` anyway
<FromGitter> <stronny> you'll have to store `Proc(*T, R)`
<FromGitter> <stronny> better to get comfortable earlier than later
<FromGitter> <paulcsmith> Or modify the lang to do this. `Proc(Nil)` could be a special case to ignore return type. Just like with a method return type set to `Nil` does not retquire returning nil
<FromGitter> <stronny> modify how?
<FromGitter> <Blacksmoke16> It used to do that
<FromGitter> <paulcsmith> That is a really nice feature when you don't want people to use the return value of a method
<FromGitter> <paulcsmith> @stronny I do not know, but I assume it is possible
<FromGitter> <paulcsmith> @Blacksmoke16 Oh that's interesting. That's what I thought actually so I was surpised when it didn't work
<FromGitter> <stronny> there are conflicting interests here
<FromGitter> <paulcsmith> Could you explain? I don't get how wanting someone to explicitly return `nil` is helpful. Not sure i understand the use case
<FromGitter> <paulcsmith> The method return type precedent comes to mind. You don't need to retun `nil` for it to work
<FromGitter> <paulcsmith> I'll also check the GitHub issues to try to find some context
<FromGitter> <stronny> there is one method definition right in front of its body
<FromGitter> <stronny> with procs you have several defs all around the code and the actual block somewhere else
<FromGitter> <paulcsmith> According to this it is possible and was actually fixed, but introduced other bugs https://github.com/crystal-lang/crystal/issues/7698
<FromGitter> <paulcsmith> Oh yeah haha. Thanks @Blacksmoke16
<FromGitter> <paulcsmith> So I think it is still desirable to have a Proc with Nil return type. It just needs to not break other stuff :)
<FromGitter> <paulcsmith> Maybe I'll try resurrecting that issue and offer a bug bounty. Would really love to be able to do this and not mess up the other stuff
<FromGitter> <paulcsmith> Thanks for the info @Blacksmoke16. Very helpful to know it was reverted and why
<FromGitter> <Blacksmoke16> it wasnt reverted :p
<FromGitter> <Blacksmoke16> hence why the issue i created is still open
<FromGitter> <stronny> no but seriously what do you want to happen here? I have a block { 123 } that I should be able to put into Proc(Int32) and into Proc(Nil) both?
<FromGitter> <paulcsmith> @stronny Yes exactly
<FromGitter> <paulcsmith> Just liek with a method definition with return type of Nil
<FromGitter> <paulcsmith> There is precedent here and I gave an example of how it is useful a few times
<FromGitter> <stronny> what do you mean "just like"?
<FromGitter> <paulcsmith> I mean you can do this: ⏎ ⏎ `````` [https://gitter.im/crystal-lang/crystal?at=5e7f5d10fb12256c0984c7de]
<FromGitter> <paulcsmith> Both type restrictions work. The `Nil` one will make `other_method` always return `nil`
<FromGitter> <stronny> these are two different methods
<FromGitter> <paulcsmith> OMG
djuber has joined #crystal-lang
<FromGitter> <paulcsmith> Yes I know. It was to show that even though the method body is the same you can have a `Nil` type restriction
<FromGitter> <paulcsmith> In the same that I want `-> { 123 }` to work with `Proc(Int32)` and `Proc(Nil)`
<FromGitter> <paulcsmith> The concept is identical
<FromGitter> <stronny> these are two different method bodies
<FromGitter> <paulcsmith> ? The body is `123` in both of them
<FromGitter> <stronny> the proc is one and the same
<FromGitter> <stronny> it's literally the same memory address
<FromGitter> <paulcsmith> Ok fine here is an example if we want to get really pedantic
<FromGitter> <paulcsmith> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7f5ddcd71a6e7e8d7c2d7c]
<FromGitter> <paulcsmith> Same memory address. Nil restriction causes it to return nil
<FromGitter> <stronny> these are two different methods with two different bodies
<FromGitter> <stronny> notice you have to copy and paste your source
<FromGitter> <paulcsmith> It is just an example
<FromGitter> <stronny> with macros copy-paste would be done by compiler
<FromGitter> <paulcsmith> The point being you can restrict return type to nil and it'll return nil
<FromGitter> <stronny> with Proc you have a function pointer
<FromGitter> <stronny> a pointer without an attached type information
<FromGitter> <paulcsmith> Ok look I don't really care what the Proc is. I just want to ignore the return type of it if the type restriction is `Nil` 🤷‍♂️
<FromGitter> <stronny> do you not see the difference?
<FromGitter> <paulcsmith> I'm sure this is possible
<FromGitter> <stronny> I'm also sure it's possible
<FromGitter> <paulcsmith> Yes I see the difference I just don't care
<FromGitter> <stronny> I just don't think it's beneficial
<FromGitter> <paulcsmith> Ok, and I do.
<FromGitter> <stronny> well good luck
<FromGitter> <paulcsmith> We have difference of opinions but you can't convince me that my opinion is "wrong"
<FromGitter> <stronny> I have no such intention
<FromGitter> <paulcsmith> Ok then I think we can drop it. I want to be able to do it. If Crystal team doesn't add that, then that is ok :)
<FromGitter> <paulcsmith> I get that Procs are different. I just don't want to return an explicit `nil`. That's all it comes down to 🤷‍♂️
<FromGitter> <stronny> do you need the Procs at all?
<FromGitter> <stronny> maybe try doing that with methods?
<FromGitter> <paulcsmith> I think so. Can you think of another way to do what I'm trying to do in that example? https://gist.github.com/paulcsmith/ec853d33d1a0ef9b1eedd070e58136b9
<FromGitter> <paulcsmith> Where I have a generic component that accepts blocks so you can customize the different "slots" in the HTML
<FromGitter> <stronny> macros
<FromGitter> <Blacksmoke16> are all the procs of the same type?
<FromGitter> <stronny> no
<FromGitter> <Blacksmoke16> i.e. `Proc(Nil)`/
<FromGitter> <paulcsmith> @Blacksmoke16 No they are `Proc(Nil)` or `Proc(IO::Memory)`
<FromGitter> <paulcsmith> So I could do `Proc(Nil, IO::Memory)` but there could potentially be more return types.
<FromGitter> <Blacksmoke16> gotcha
<FromGitter> <paulcsmith> This is mostly an optimization to make it nicer. This is definitely not a blocker by any means. Just a nice thing I'd like :P
<FromGitter> <paulcsmith> Would rather avoid macros if it can be domne with functions. Much easier to reason about and debug IMO
<FromGitter> <stronny> my opinion that blocks and procs aren't well suited for usecases like yours
<FromGitter> <stronny> I would do that with macros
<FromGitter> <paulcsmith> How would you do it with macros?
<FromGitter> <paulcsmith> Curious what your solution would be. I tend to avoid macros if can be down with regular lang constructs since it is easier to reason about and debug
<FromGitter> <paulcsmith> Not sure how this would work with a macro actually 🤔
<FromGitter> <stronny> no, both are hard to reason about, just the levels of complexity are different
<FromGitter> <stronny> can't give you a working prototype atm
<FromGitter> <stronny> kinda busy sorry
<FromGitter> <paulcsmith> No prob
<FromGitter> <paulcsmith> I think the functions are quite simple. You pass it in. The component calls them 🤷‍♂️ but maybe just me 🤣
<FromGitter> <paulcsmith> Anyway, I'll open an issue or leave a comment on the Proc thing. I still would like to be able to do this and think it's a great solution
<FromGitter> <Blacksmoke16> you could do like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7f60d64a4f8e0a100f2e32]
<FromGitter> <paulcsmith> Oh that's interesting. That may work. A simple macro like that seems cool
<FromGitter> <stronny> the problem here is the block may come from somewhere else
<FromGitter> <stronny> don't get me wrong, that may be a good solution for a particular problem
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8s9u
<FromGitter> <Blacksmoke16> can do that as well
<FromGitter> <paulcsmith> Ok this is interesting https://play.crystal-lang.org/#/r/8s9v works...which seems like what I want to do. The Proc returns an Int32, but since return type is Nil it just returns nil
<FromGitter> <paulcsmith> So it seems like mine should work too but it doesn't...will have to play around with this a bit haha. Because that seems like what I'm doing
<FromGitter> <Blacksmoke16> right, just be aware of the bug
<FromGitter> <Blacksmoke16> only is when the procs are in an array i think tho
DTZUZU has joined #crystal-lang
<FromGitter> <paulcsmith> Ahhh this fails! Looks like something to do with setting the type restriction in the initializer *or* with setting the proc in the argument https://play.crystal-lang.org/#/r/8s9x
<FromGitter> <paulcsmith> @Blacksmoke16 Yes thanks for reminding me! I'm thinking since I'll use these for just Nil return type and no array it should be ok 🤞
<FromGitter> <paulcsmith> But I will keep that in mind for other stuff since I may run into that
<FromGitter> <stronny> idk, looks very fragile
<FromGitter> <paulcsmith> What looks fragile?
<FromGitter> <paulcsmith> The macro?
DTZUZU2 has quit [Ping timeout: 265 seconds]
<FromGitter> <stronny> no, getter proc : Proc(Nil) trick
<FromGitter> <paulcsmith> It is not a trick. It is how it is supposed to work
<FromGitter> <paulcsmith> It just doesn't work in this specific case for some reason: https://play.crystal-lang.org/#/r/8s9x
<FromGitter> <paulcsmith> Yes...as a fix for the issue @Blacksmoke16 mentioned
<FromGitter> <paulcsmith> With the intention to still add it back
<FromGitter> <stronny> let me quote
<FromGitter> <paulcsmith> > The following code is invalid in 0.27.2 but valid in 0.28.0 and we want to keep it that way.
<FromGitter> <stronny> > Hmm... it's a bit hard. I feel like I'm constantly monkey patching the type system to make things work. For now I'll stop touching the compiler.
<FromGitter> <paulcsmith> Doesn't mean it shouldn't work
<FromGitter> <paulcsmith> Can we please just drop this?
<FromGitter> <stronny> sure
Tungki has joined #crystal-lang
DTZUZU has quit [Ping timeout: 250 seconds]
DTZUZU has joined #crystal-lang
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
<FromGitter> <tenebrousedge> Oh cripes
<FromGitter> <tenebrousedge> Crystal is pretty much Ruby++, isn't it?
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
<FromGitter> <stronny> I don't think so
<FromGitter> <dscottboggs_gitlab> no not at all
<FromGitter> <dscottboggs_gitlab> TBH I feel like comparing ruby to crystal doesn't make a ton of sense beyond the syntax style (not even the syntax itself)
<FromGitter> <tenebrousedge> the stdlib is pretty similar, in addition to most of the syntax
<FromGitter> <stronny> similar yes
<FromGitter> <tenebrousedge> not comparing the two would seem to be an overreaction
<FromGitter> <dscottboggs_gitlab> idk I mean C++ is still C, just with a bunch extra. The way your code runs in Crystal is completely different
<FromGitter> <dscottboggs_gitlab> I used to think that crystal was a hard fork of ruby
<FromGitter> <tenebrousedge> oh, that is certainly not the case
<FromGitter> <tenebrousedge> But implementation aside, Crystal could be described as, "Ruby, plus a type system, plus other sensible changes", omitting certain divergences
<FromGitter> <tenebrousedge> personally I was deeply disappointed by the Ruby devs' response to the `&.` proposal
<FromGitter> <asterite> I think they rejected it because Ruby doesn't have syntax sugar
<FromGitter> <stronny> could you share a link? I think I've missed the drama
<FromGitter> <phykos> how do I remove a folder & it's content?
<FromGitter> <j8r> @phykos `FileUtils.rm_r`
alexherbo2 has quit [Ping timeout: 265 seconds]
<oprypin> *best* function name ever
<FromGitter> <tenebrousedge> Ruby doesn't have syntactic sugar, except when it does >_< like the new positional block arguments
<FromGitter> <tenebrousedge> https://bugs.ruby-lang.org/issues/9076 @stronny
<FromGitter> <j8r> oprypin agree, I remember having opened an issue about this module
<oprypin> tenebrousedge, wow that's painful to read
<FromGitter> <stronny> well that's ironic given that &. exists now with a different meaning
<FromGitter> <andrewc910> Hey guys, there are a couple shards i would like to make some PR's for. However, these shards utilize several techniques i am not too familiar with. I figured i should understand them better before even attempting to comprehend the code bases. I was hoping someone here can point me at some resources. ⏎ ⏎ The major topics i have identified are: ⏎ Enums, Struts, Macros & Generics ⏎ ...
<oprypin> andrewc910, i mean,... you even have a goal in mind, perfect for learning by doing
<oprypin> can't you see the context that the libraries use them in?
<FromGitter> <andrewc910> @oprypin Agreed but the code bases are at a level that makes comprehension almost impossible especially without proper debugging tools :/ ⏎ ⏎ Here is an example: https://github.com/imdrasil/jennifer.cr/blob/master/src/jennifer/query_builder/query.cr ⏎ ⏎ I can read the symbols, i can understand which variables are initialized, which classes are instantiated but some of those marcos i can't
<FromGitter> ... comprehend. I can't understand what code is actually put into the compiled binary. [https://gitter.im/crystal-lang/crystal?at=5e7f9a0d426d5b06bf91edaf]
<FromGitter> <stronny> `{{ debug }}`
<FromGitter> <Blacksmoke16> as a general rule of thumb, `{% xx %}` is control structures, like if statements, for loops etc
<FromGitter> <Blacksmoke16> `{{xx}}` is something "pasted" into the program
<FromGitter> <stronny> also `crystal tool expand`
<FromGitter> <phykos> @j8r I guess I have to install that shard, I can install it as in Ruby (sudo shards install filutils)?
<FromGitter> <Blacksmoke16> huh?
<FromGitter> <Blacksmoke16> you just need to require it
<FromGitter> <stronny> FileUtils is not a shard
<FromGitter> <Blacksmoke16> ```require "file_utils"```
<FromGitter> <stronny> also why sudo?
<FromGitter> <phykos> gem requires sudo
<FromGitter> <stronny> no it doesn't
<FromGitter> <phykos> also FileUtils has to be installed on Ruby AFAIK
<FromGitter> <stronny> no
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8sam
<FromGitter> <Blacksmoke16> would it make sense for the 2nd range `.end` to be 9?
<FromGitter> <Blacksmoke16> since it doesnt include the ending value due to `...`
<FromGitter> <stronny> idk, do you want 1..10 be == 1...11 ?
<FromGitter> <jwoertink> Anyone here running on a linux machine that can run `echo $OSTYPE` and let me know what it returns for you? Or windows linux subsystem
<FromGitter> <stronny> I think these are distinct with different qualities
<FromGitter> <Blacksmoke16> well `1...10` is essentially the same as `1..9` no?
<FromGitter> <stronny> I don't think so
<FromGitter> <Blacksmoke16> @jwoertink `linux-gnu`
<FromGitter> <Blacksmoke16> fair
<FromGitter> <stronny> man bash: ⏎ ⏎ > OSTYPE Automatically set to a string that describes the operating system on which ⏎ > bash is executing. The default is system-dependent. [https://gitter.im/crystal-lang/crystal?at=5e7f9c33f465c801f876d3cd]
<FromGitter> <jwoertink> awesome. What flavor are you running @Blacksmoke16 ?
<FromGitter> <stronny> this is shell specific
<FromGitter> <Blacksmoke16> manjaro
<FromGitter> <Blacksmoke16> on bash
<FromGitter> <jwoertink> thanks
<FromGitter> <stronny> ```declare -- OSTYPE="linux-gnu"``` ⏎ ⏎ as well [https://gitter.im/crystal-lang/crystal?at=5e7f9c564a4f8e0a100fbfe7]
<FromGitter> <stronny> debian stable
<FromGitter> <stronny> however
<FromGitter> <stronny> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7f9cf1fb12256c098566bf]
<FromGitter> <stronny> ```#!/usr/bin/env bash ⏎ echo ": $OSTYPE :" ⏎ ⏎ $ ./test.sh ⏎ : linux-gnu :``` ⏎ ⏎ note the difference in shebang [https://gitter.im/crystal-lang/crystal?at=5e7f9d1e59057617f04a3383]
<FromGitter> <stronny> @jwoertink why are you asking?
<FromGitter> <jwoertink> because I want to know
<FromGitter> <stronny> that's it?
<FromGitter> <jwoertink> yup
<FromGitter> <stronny> cool
<FromGitter> <andrewc910> @stronny i can't seem to get `{{debug}}` to work... ⏎ ⏎ example.cr: ⏎ ⏎ ```hi = "hello" ⏎ {{ debug }}``` ... [https://gitter.im/crystal-lang/crystal?at=5e7f9f48426d5b06bf91f95a]
<FromGitter> <Blacksmoke16> `{{ debug }}` is for viewing what macro code outputs
<FromGitter> <Blacksmoke16> your example doesnt have any macro code to debug
<FromGitter> <andrewc910> ```{% hello = "hi" %} ⏎ {{ hi = "hello" }} ⏎ {{ debug }}``` ⏎ ⏎ Is one of these right? I am still getting nothing :/ [https://gitter.im/crystal-lang/crystal?at=5e7f9fe2f95592102b31960d]
<FromGitter> <Blacksmoke16> wrap it in
<FromGitter> <Blacksmoke16> ```{% begin %} ⏎ ⏎ ⏎ {% end %}``` [https://gitter.im/crystal-lang/crystal?at=5e7f9ff2d71a6e7e8d7ccd0d]
<FromGitter> <Blacksmoke16> but also that macro code doesnt emit any code so there still is nothing to debug
<FromGitter> <andrewc910> emit is the act of inserting code?
<FromGitter> <andrewc910> Wrapping worked. the value for `hi` was printed out.
<FromGitter> <Blacksmoke16> https://play.crystal-lang.org/#/r/8sap
<FromGitter> <andrewc910> What is `{% begin %}` and end? I have never seen that before.
<FromGitter> <andrewc910> So anything in `{% %}` can access local variables but something in `{{ }}` is considered a macro variable, is this correct?
<FromGitter> <Blacksmoke16> er sorry not that
<FromGitter> <Blacksmoke16> essentially its just a way to "group" macro code so its in the same scope
<FromGitter> <Blacksmoke16> is my understanding of it
<FromGitter> <Blacksmoke16> macros cant access local variables, only other macro variables
<FromGitter> <andrewc910> `{% %}` isn't considered a macro than?
<FromGitter> <Blacksmoke16> it is
<FromGitter> <Blacksmoke16> like you could do
<FromGitter> <andrewc910> But in your example you access the local variable `v`. Or is v considered a macro variable before the`{% begin%}`
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7fa15a59057617f04a3df0]
<FromGitter> <Blacksmoke16> sorry, https://play.crystal-lang.org/#/r/8saq
<FromGitter> <Blacksmoke16> makes it more clear `v` and `{{v}}` are *NOT* the same thing
<FromGitter> <andrewc910> Oh got it! Yeah the first one had me a bit confused, thank you :)
<FromGitter> <Blacksmoke16> poor naming on my part
<FromGitter> <Blacksmoke16> also shows they have diff scopes, since you can reuse the same name at runtime and in a macro
<FromGitter> <andrewc910> Okay, so i can download a lib, add whatever debug statements, use that version in my demo app to help me understand macro sections. Is that the best way or do you recommend something else?
<FromGitter> <Blacksmoke16> that would show you what code ends up going into the program yes
<FromGitter> <andrewc910> Rereading the entire macro section today, will make sure to spend some time on that link :)
<FromGitter> <Blacksmoke16> 👍
travis-ci has joined #crystal-lang
<travis-ci> crystal-lang/crystal#f968856 (master - Add missing branches to make exhaustiveness check happy (#8962)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/668156873
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8962 (Add missing branches to make exhaustiveness check happy)
<travis-ci> crystal-lang/crystal#0b6277d (master - Add Time::Span#total_microseconds (#8966)): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/668157862
travis-ci has joined #crystal-lang
travis-ci has left #crystal-lang [#crystal-lang]
<DeBot> https://github.com/crystal-lang/crystal/pull/8966 (Add Time::Span#total_microseconds)
HumanG33k has joined #crystal-lang
alexherbo2 has joined #crystal-lang
djuber has quit [Ping timeout: 260 seconds]
Tungki has quit [Remote host closed the connection]
cloaked1 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
<FromGitter> <Blacksmoke16> @straight-shoota @bcardiff just a heads up it seems nightly images aren't being built, last one was 19 days ago
_ht has quit [Quit: _ht]
<FromGitter> <straight-shoota> Yeah, looks like that's because of using shards 0.8.1 which is not compatible with current stdlib
<FromGitter> <Blacksmoke16> Rip
alexherbo2 has quit [Ping timeout: 264 seconds]
ur5us has joined #crystal-lang
Seich has quit [Remote host closed the connection]
<oprypin> rip
<FromGitter> <Blacksmoke16> I suppose I should manually go check my stuff then...
Seich has joined #crystal-lang
<FromGitter> <drum445> In the crystal mysql library, how can I check my connection is still available - something like a ping method?
<FromGitter> <drum445> as when the mysql server is restarted, my app no longer works
ur5us has quit [Ping timeout: 240 seconds]
<FromGitter> <drum445> DB::Database doesn't have a closed? method :(
<FromGitter> <Blacksmoke16> I'm surprised it doesn't attempt to connect again
<FromGitter> <Blacksmoke16> There are some settings you can use in the connection string, maybe check those out
<FromGitter> <drum445> there's retry attempts and retry timeout
<FromGitter> <drum445> but ideally it would just reconnect if it can't, atm I've had to add ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5e7fe425d71a6e7e8d7d6797]
<FromGitter> <drum445> (if it's null, it creates a new DB.open)
<FromGitter> <Blacksmoke16> Did you try increasing those values to cover the time it takes to start up again?
<FromGitter> <Blacksmoke16> Db open should maintain a pool of connections