<FromGitter>
<watzon> This is what happens when I have a `Tourmaline.md` and a `Tourmaline` directory, but if I have an `index.md` in the Tourmaline directory I end up with `Tourmaline/Index`
<FromGitter>
<watzon> Yeah I didn't set a custom nav. Is there anyway to make it auto populate directories like it does by default?
<FromGitter>
<watzon> You're the best dude. This is going to make for such better docs.
<oprypin>
aww ππ
<oprypin>
gimme some stars on github π₯Ί
<FromGitter>
<watzon> Can definitely do that
<oprypin>
π
<FromGitter>
<Daniel-Worrall> I'd love to see some support for hosting docs for multiple platforms and even feature flags. docs.rs does this
<FromGitter>
<Daniel-Worrall> supplied by shard.yml or on the cli
deavmi has joined #crystal-lang
<FromGitter>
<watzon> @oprypin have you tried using literate-nav and section-index together with multiple nested directories?
<FromGitter>
<watzon> For instance, I have β β 1) api_reference/String/index.md β 2) api_reference/Tourmaline/index.md β and a whole bunch of other files and directories being generated inside of `api_reference/Tourmaline` [https://gitter.im/crystal-lang/crystal?at=5ff670bd14cec811ec81e2f4]
<FromGitter>
<watzon> I'd love to see if you can figure it out. Likely I'm just doing something wronf.
<oprypin>
thanks
<oprypin>
ok first thing i see is that it works. and i think i have my guess
<oprypin>
yes
<oprypin>
watzon, https://github.com/oprypin/mkdocs-literate-nav/tags you have v0.2.0 which apparently i forgot that it's too shitty. need v0.3.0b1 . which is pip install -U --pre but i think you have your other way
<FromGitter>
<watzon> Ahhh ok. Just need to figure out how to do that with pipenv.
<FromGitter>
<watzon> You're the real MVP my friend
<FromGitter>
<watzon> It's working as expected now
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter>
<erdnaxeli:cervoi.se> Hi, how can IΒ access from a macro to the type where the macro was called?
<FromGitter>
<erdnaxeli:cervoi.se> or should I juste include a module and use the "included" macro?
<FromGitter>
<anapsix> greetings! β some time ago, I've noticed Time::MonthSpan was not comparable, and made a PR (https://github.com/crystal-lang/crystal/pull/10072) β any chance I could any feedback on it?
<straight-shoota>
anapsix, seems I have missed that one. The general idea is to drop MonthSpan for a more generic, more granular calendrical duration type.
<straight-shoota>
might still be worth merging that short term
<FromGitter>
<erdnaxeli:cervoi.se> what IΒ am missing about instance_vars? https://carc.in/#/r/a8ea
<straight-shoota>
Instance vars are only resolved after *finished* hook
<straight-shoota>
this is a chicken and egg problem
<straight-shoota>
you would expect the hook to have ivars available but also be able to add new ones, but that would disrupt the already resolved ones
<FromGitter>
<erdnaxeli:cervoi.se> hmm ok, thanks
<straight-shoota>
you can work around that by delegating to a method because at the time methods are instantiated, ivars need to be resolved
<FromGitter>
<erdnaxeli:cervoi.se> it does, thanks!
<FromGitter>
<erdnaxeli:cervoi.se> and when including a module, @type in the method refers to the including type, so everything is cool π
<FromGitter>
<anapsix> I helped?
<FromGitter>
<erdnaxeli:cervoi.se> you did, thx @anapsix and @straight-shoota
<FromGitter>
<anapsix> π π π
<FromGitter>
<anapsix> that's it, 2021 is good.. the end.. please.. no more
<FromGitter>
<erdnaxeli:cervoi.se> ^^
ua_ has quit [Quit: Leaving]
Volk has joined #crystal-lang
ua has joined #crystal-lang
ua has quit [Ping timeout: 246 seconds]
ua has joined #crystal-lang
hmmm has joined #crystal-lang
hmmm has quit [Client Quit]
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<domgetter> Is there a way to have custom error messages using YAML::Serializable ?
<FromGitter>
<Blacksmoke16> error messages in regards to what?
<FromGitter>
<domgetter> Like if a yaml file doesn't include a key that is expected or a list is empty or something like this
<FromGitter>
<Blacksmoke16> hmm, not without reimplementing the parsing
<FromGitter>
<Blacksmoke16> an empty list sounds more like validation after deserialization tho
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<FromGitter>
<domgetter> Okay if that's where the logic is intended to go, then that's fine. Thank you
<FromGitter>
<Blacksmoke16> because en empty array is valid even if it may not be according to your domain logic
<FromGitter>
<Blacksmoke16> possibly could use a custom converter to include some stuff in but :shrug:
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
HumanG33k has quit [Remote host closed the connection]
HumanG33k has joined #crystal-lang
<oprypin>
[09:50:51] <3176b3@watzon> Hey @oprypin, for some reason I'm not getting constant values in my docs, just the name of the constant. Is that intentional?
<oprypin>
yes. not sure about that decision but rest assured it's not a problem to implement
<oprypin>
also not even a problem to make it configurable. do you have any reason that it should be there? there have been past debates
<straight-shoota>
why would you *not* show the value?
<straight-shoota>
for some constants the actual value may be irrelevant, but more often than not it has semantic meaning and you would want to document the value anyways
<FromGitter>
<watzon> @oprypin just makes sense to have the value in my opinion. Why even mention the constant otherwise?
Volk has quit [Quit: See you next time!]
HumanG33k has quit [Ping timeout: 256 seconds]
sampope has joined #crystal-lang
<sampope>
Hi, i have a question about fibers/channels and if my understanding is correct. I want to make 10+ sql queries concurrently, like this https://dpaste.com/BBY35UPJ3 am I correct in understanding that the variable = channel.receive will be in the correct assignment and not whichever fiber finishes first? meaning in that code sample, total_ip_by_month and unique_ip_by_month won't be mixed up/crossed?
<sampope>
some queries are going to take far longer than others, but my current code executes everything serially
<FromGitter>
<watzon> So channel.receive will always get the first thing to come into the channel, so if you're executing 10 queries concurrently and then sending the result through the channel they most likely won't be in order. You can always send the result with an index though, that way you can put things back into order.
<FromGitter>
<watzon> So your channel would look like `Channel(Tuple(Int32, DB::ResultSet)).new(10)` or something.
<sampope>
i thought it was too simple to just channel.send and channel.receive and it would all work out
<FromGitter>
<watzon> Yessir lol. A wee bit too simple.
HumanG33k has joined #crystal-lang
<sampope>
channel.receive doesn't take arguments, which was my first thought, just channel.receive(total_ip) or something
<Andriamanitra>
then total_ip.receive and unique_ip.receive
<FromGitter>
<watzon> That you can as well, if you wanted to pair each query up with a channel and then receive them in order.
<FromGitter>
<watzon> Really depends on if you want to be able to process each result as soon as it's available or not
<sampope>
i didn't even think of multiple channels
<sampope>
i'm so used to using ruby's parallel gem that having to do concurrency myself is new
<FromGitter>
<watzon> Yeah I'm working on recreating some of that. Actually this might be of use to you: https://github.com/protoncr/async
<Andriamanitra>
also couldn't you do that with a single query `SELECT COUNT(ipaddr), COUNT(DISTINCT(ipaddr))`?
<FromGitter>
<watzon> I don't believe the `Future.all` method returns things in order right now, but I should be able to make that possible.
<sampope>
@Andriamanitra yes, i could, but for learning purposes, i'm trying to keep it simple so i can watch the db and see the queries executing concurrently
<sampope>
watzon: looks interesting
hightower2 has joined #crystal-lang
_ht has quit [Remote host closed the connection]
<FromGitter>
<watzon> @sampope `Future.any` now returns futures in the order they're given
<FromGitter>
<watzon> Of course you could always do something like this yourself as well
<sampope>
cool, i'll get there eventually
<FromGitter>
<watzon> @oprypin is there a syntax for easily linking to a namespace within a markdown file? For instance if I wanted to link to the page for `Tourmaline::Client` or something?
<FromGitter>
<watzon> I just realized that the `section-index` plugin isn't doing anything. Any idea why @oprypin? I just pushed a new version of https://github.com/protoncr/tourmaline
<oprypin>
what the heck :s
<oprypin>
no everything's correct
<oprypin>
watzon, forget about section-index, you have bigger problems
<FromGitter>
<watzon> The value does, but a view source link doesn't
<FromGitter>
<watzon> For whatever reason. Probably because the value itself is close enough.
<FromGitter>
<Blacksmoke16> hm?
<FromGitter>
<watzon> In the Crystal docs we get a value, but there isn't a "view source" link like with methods. Probably because the constant's value is the same as the source 98% of the time.
<oprypin>
Blacksmoke16, there's no [View source] link under `TAG =`
<oprypin>
there is the "defined in" for the whole type, though. i dont have that, yes.
<oprypin>
watzon, crystal nightly will get you better docs btw. method parameter types will be linkified
<oprypin>
i really should stop procrastianting on writing all of this down
<FromGitter>
<watzon> @oprypin yeah that seems about right to me. Is there a setting for having method definitions appear as anchors like in the official docs?
<FromGitter>
<watzon> So in the official docs there are `#` next to method definitions which anchor to that specific method on the page, that way I can easily copy a link directly to that method
<FromGitter>
<watzon> Ahh nice, so I just need to upgrade it seems
<FromGitter>
<watzon> I'm at 0.14.0 currently, is there a newer version that I'm missing?
<FromGitter>
<watzon> Ahh nvm, I messed up the formatting
<FromGitter>
<watzon> I'll be waiting on that update btw, I want to change the size of the [View Source] link without changing the size of the rest of the comment content
<FromGitter>
<watzon> :D
<oprypin>
watzon, fine then :> released an update with both of the changes u wanted
<FromGitter>
<watzon> Haha you're the best man. This is really exciting stuff for me. I like nice looking docs, and the default generator was not delivering.
<oprypin>
up until the last moment i was like "what if everyone hates it"
<FromGitter>
<watzon> Yeah no, it's great. Might be better if it was a "pure crystal" implementation so that we don't have to mix languages, but I really couldn't ask for much better right now.
<FromGitter>
<watzon> Also there are definitely some benefits to using something that has already been in development for a while
<FromGitter>
<Blacksmoke16> imo at some point you just have to accept the defacto standard might be in a diff lang
<FromGitter>
<Blacksmoke16> e.g. i dont see benefit in putting effort into an E2E testing framework when Cypress is already really good :shrug:
<oprypin>
`def foo(x, y, z); use x; end; foo(**namedtuple)` is a way to destructure all in all
<FromGitter>
<watzon> Ooh good idea @oprypin
<oprypin>
watzon, i dont know if you plan to migrate your main site to mkdocs, but in any case, i think another tab could just be a plain link to your main site
<FromGitter>
<domgetter> Ah I was hoping there would be something like this for block parameter lists. So for example `shapes.each do {|(name, area)| ...}` or something like that
<oprypin>
domgetter, no. and these should be structs
<oprypin>
`shapes.each do {|s| use s.name, s.area}`
<FromGitter>
<domgetter> I don't necessarily want these on the stack
<FromGitter>
<Blacksmoke16> if you're using a named tuple they're already on the stack :p
<oprypin>
domgetter, namedtuple and struct are exactly the same in terms of stackiness
<FromGitter>
<domgetter> then why change it to a struct?
<oprypin>
because namedtupls are not designed for this
<oprypin>
the question is why use namedtuple
<FromGitter>
<domgetter> because that's what the type of the literal is
<FromGitter>
<domgetter> Unless there's a struct literal I don't know about
<oprypin>
Shape.new(name, area)
<oprypin>
???????????????
<FromGitter>
<domgetter> That's not a literal
<FromGitter>
<Blacksmoke16> i think hes saying just dont use the literal and use that instead
<FromGitter>
<Blacksmoke16> named tuples aren't something you should be using like you would a hash in ruby
<oprypin>
can you not use a feature if it's not a literal? i dont get it
<FromGitter>
<jrei:matrix.org> Namedtuples are a pain for types
<FromGitter>
<jrei:matrix.org> How do you use it?
<FromGitter>
<domgetter> How do I use a NamedTuple?