<FromGitter>
<watzon> I wish you could say that you want a splat argument to be of a certain type, but still allow it to be nilable
<FromGitter>
<tenebrousedge> why? example?
<FromGitter>
<watzon> For example: `def foo(*bar : String)` should allow you to call `foo` without any arguments, but it doesn't
<FromGitter>
<watzon> Whereas `def foo(*bar)` does allow you to call it without arguments
<FromGitter>
<tenebrousedge> and `String?` doesn't work?
<FromGitter>
<watzon> That would make it an Array of nilable strings
<FromGitter>
<watzon> But the argument is still required
<FromGitter>
<tenebrousedge> could you do `String | Nil` ?
<FromGitter>
<watzon> That's the same thing
<FromGitter>
<tenebrousedge> :(
<FromGitter>
<tenebrousedge> what if you poke it with a stick?
<FromGitter>
<watzon> Lol given my current feelings I may hit it instead
<FromGitter>
<watzon> I would just do a standard splat and then cast to an array, but it casts an empty one as `Array(NoReturn)` which causes its own problems
<FromGitter>
<Blacksmoke16> define another overload with no args?
<FromGitter>
<watzon> That is a workaround
<FromGitter>
<watzon> Didn't think of it haha
<FromGitter>
<denolfe> Are there any kind of generally accepted shard/repo naming conventions? my-shard-name, my_shard_name, etc. I'm seeing it both ways looks like
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter>
<tenebrousedge> considering the esolangs that have Wikipedia entries, I have no idea what might qualify a programming language as non-notable, unless it only exists on someone's personal github page
<FromGitter>
<tenebrousedge> I think there might be a few of those on Wikipedia too
<FromGitter>
<girng> i don't think crystal is an esolang though
<FromGitter>
<meltheadorable> I think crystal is probably a casualty of somebody being mad about esoteric languages having entries and going on a reporting spree
<FromGitter>
<girng> that's what i think too
<FromGitter>
<meltheadorable> or mad that esoteric languages are on the chopping block and reporting crystal to make a point about notability
<FromGitter>
<girng> but i couldn't express it in words, so thank you
<FromGitter>
<watzon> There was a guy that got banned from editing on Wikipedia recently because he was going through requesting a ton of pages be deleted
<FromGitter>
<watzon> I think he's the same one that requested Crystal for deletion
<FromGitter>
<meltheadorable> the one person saying crystal isnt notable because nobody is defending it on the page apparently didnt consider that maybe crystal programmers are too busy trying to enjoy their lives to deal with the absurd annoying politics of wikipedia editing
<FromGitter>
<tenebrousedge> well, I think I have a Wikipedia account, I can probably yell at them :/
<FromGitter>
<meltheadorable> oh btw @tenebrousedge i’d implement a new/custom protocol rather than matrix or XMPP personally, matrix is a mess and its clients aren’t good enough to be worth picking up its client ecosystem, XMPP is aging poorly, and groups were an afterthought for both
<FromGitter>
<tenebrousedge> @meltheadorable that sounds like a lot of work if a chat program/protocol wasn't your main goal, and you would presumably trade off compatibility with any existing code
<FromGitter>
<meltheadorable> In my case, a chat program would be my main goal, but obviously if you were just trying to bolt a chat server onto something else there’s no reason to go to the trouble
<FromGitter>
<meltheadorable> but yeah, trading off compatibility would be a possible downside
<FromGitter>
<girng> @watzon wait really? is there an article about that anywhere? seems like something like those trolls last year did on github
<FromGitter>
<watzon> @girng I heard about it in one of the groups I'm in on Telegram. I believe they had linked to an article, but I don't remember
<FromGitter>
<girng> Is Telegram phone only?
<FromGitter>
<girng> nvm i'm dumb
<FromGitter>
<girng> is this app shipped on electron for their pc version?
<FromGitter>
<meltheadorable> personally im not too overconcerned about compatibility because i don’t think f/oss chat protocols are “there” yet — theres a particular intersection of contemporary needs/wants from real time chat software that aren’t met by current solutions so if something can land those im pretty willing to break with older solutions to provide it
<FromGitter>
<watzon> I don't think so, but it might be
<FromGitter>
<watzon> @meltheadorable I tend to agree
<FromGitter>
<meltheadorable> id have to look into whether zulip’s underlying protocol can handle it actually before i ran off the deep end, i haven’t spent enough time with it because the client sucks
<FromGitter>
<watzon> Well if anyone decides to invent their own chat protocol I'd love to contribute to the project
<FromGitter>
<meltheadorable> its near the bottom of a long to-do list for me, currently busy inventing a social networking protocol
<FromGitter>
<watzon> That's pretty cool
<FromGitter>
<meltheadorable> “Inventing” is maybe a strong word — more like revising/extending, trying to fix a lot of problems with ActivityPub
<FromGitter>
<meltheadorable> but it’d be a compatibility-breaking revision
<FromGitter>
<meltheadorable> by necessity
<FromGitter>
<meltheadorable> so there’s some invention there
<FromGitter>
<tenebrousedge> anything I should mention in defense of the Crystal wikipedia article?
<FromGitter>
<watzon> Maybe scour the web for articles and list them to show that there are plenty of non-devs working with Crystal, list crystalshards.org and https://github.com/search?q=language%3Acrystal to show that there are planty of packages
<FromGitter>
<watzon> I have some articles here (https://medium.com/@watzon), although I need to write some more
<FromGitter>
<tenebrousedge> web articles are probably less relevant than print, to this crowd
<FromGitter>
<meltheadorable> medium is not considered a reliable source for wiki guidelines, package availability is not proof of notability
<FromGitter>
<watzon> Idk what they want, just giving resources that I know of
<FromGitter>
<meltheadorable> i think the best notability argument is probably the programming crystal book — a reputable programming book publisher put out an entire book on the language — its also supposedly in the TIOBE index but i couldn’t find where — most esoteric languages don’t have books
<FromGitter>
<watzon> It is in the index, but it's not among the top languages anywhere
<FromGitter>
<tenebrousedge> I sent the TIOBE guys a message suggesting they add it
<FromGitter>
<tenebrousedge> well, then we need to start writing more articles I think :/
<FromGitter>
<watzon> That is definitely needed
<FromGitter>
<watzon> I was mentioning earlier that I'm going to start a video series on YouTube
<FromGitter>
<meltheadorable> i think time would be better spent building more notable stuff with crystal than writing more blog posts about crystal
<FromGitter>
<meltheadorable> writing notable stuff will generate material to talk about
<FromGitter>
<meltheadorable> and putting notable stuff in the world will motivate people to talk about it
<FromGitter>
<meltheadorable> which is not to say the learning materials can’t use work
<FromGitter>
<tenebrousedge> writing code that's amazing enough to get other people to write articles is probably harder and more time consuming than writing articles
<FromGitter>
<tenebrousedge> and writing articles gets more people interested, who can then help develop amazing things
<FromGitter>
<meltheadorable> ¯\_(ツ)_/¯
<FromGitter>
<meltheadorable> Re: documentation — has anyone found a good way to document properties short of manually writing the getters and setters so that you can put the documentation blocks in front of them?
<FromGitter>
<watzon> Documentation generation is one of my biggest beefs with Crystal currently
<FromGitter>
<watzon> Pretty sure it's not possible @meltheadorable
<FromGitter>
<meltheadorable> a shame
<FromGitter>
<watzon> I agree
<FromGitter>
<watzon> We need the functionality that YARD has
<FromGitter>
<meltheadorable> i’ve not used YARD heavily so i’m not sure what it would do here that crystal isn’t, or how you would do it
<FromGitter>
<meltheadorable> i write a lot less reusable/libraryish code when i’m in ruby just because i’m usually using stuff that already exists, there’s a less profound need for extensive machine-readable doc generation for most of the stuff i work on
<FromGitter>
<meltheadorable> crystal has less ecosystem so im more interested in getting into the habit here if im gonna be contributing to it
<FromGitter>
<meltheadorable> but the best practices are pretty unclear
_whitelogger has joined #crystal-lang
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 248 seconds]
flaviodesousa has joined #crystal-lang
ht_ has joined #crystal-lang
alex``` has joined #crystal-lang
<FromGitter>
<watzon> YARD has a lot that Crystal's docs don't have, like templates, the ability to organize documentation into groups, the ability to document methods that are dynamically generated, etc etc
ht_ has quit [Remote host closed the connection]
ht__ has joined #crystal-lang
return0e_ has joined #crystal-lang
ht__ is now known as ht_
return0e has quit [Ping timeout: 245 seconds]
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 258 seconds]
alex``` has quit [Ping timeout: 268 seconds]
alex``` has joined #crystal-lang
<FromGitter>
<mwlang> @rishavs If you want to evangelize Crystal within MS, I would think the best place to start is with The MS groups for Ruby and get to know the MS folks hanging out there and go from that group to finding more like-minded. Building an ORM for MS SQL Server strikes me as a good way to raise awareness. There's an activerecord-sqlserver-adapter Ruby gitter channel.
sorcus has joined #crystal-lang
<FromGitter>
<asterite> @watzon we made `def foo(*bar : String)` not match an empty arguments list so that you can also have `def foo(*bar : Int32)` and avoid a confusion (which one is called on empty?). Then you can define a separate `def foo` overload for the empty case
<FromGitter>
<asterite> Maybe we can make the docs smarter regarding properties. The doc generate could see if there's `def foo()`, `def foo=(value)` and relate document then as a single property instead of two methods. Same for `getter` and `setter` (when only one of them is available). Also for `def foo?` to show it as `property?`. It would appear in a different section (maybe avoid instance methods). But I still can't see how you
<FromGitter>
... would document getter and setter separately (different doc comments) without manually writing them separately
<FromGitter>
<absolutejam_gitlab> I can't get scry to build
<FromGitter>
<absolutejam_gitlab> on either my Linux machine or my Mac
<FromGitter>
<absolutejam_gitlab> I have llvm installed
<FromGitter>
<absolutejam_gitlab> Anyone had the same issue?
<FromGitter>
<rishavs> generic question; how does regex works? if I want to search for a string "abc" in a superstring, will all regex implementations still check every single character and then use look-ahead/behind to check for the exact query string? or is it something more complex than that?
<FromGitter>
<tenebrousedge> Hmm. I would think it would use lookahead
<FromGitter>
<rishavs> would they still check every character ? I understand that stuff like memoization and such will be involved, but in general are there approaches which will not require me to iterate over every character?
<FromGitter>
<tenebrousedge> regexes are probably not the right tool for that, then
<FromGitter>
<tenebrousedge> what are you trying to solve?
<FromGitter>
<rishavs> simply stripping the code part from a markdown file. my 3 options are; use stringutils like split, use a regex or iterate over the entire file checking each file. I know I will use split but just wanted to understand how bad would it be if I went with option 3
<FromGitter>
<rishavs> if all 3 approaches iterate over the file character by character anyway, i assume that for 1 pass parser, perf will be similar for all 3 approaches
<FromGitter>
<tenebrousedge> probably similar for all three, especially if you're not working with multiple-GB files
<FromGitter>
<rishavs> thanks! thats inline with my assumption
lucasb has joined #crystal-lang
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 245 seconds]
<FromGitter>
<absolutejam_gitlab> I feel like the Crystal docs need to display what args the block takes
<FromGitter>
<Blacksmoke16> its something that has to be added
<FromGitter>
<Blacksmoke16> like `def reduce(memo : Number, &block Number -> Number)`
<FromGitter>
<absolutejam_gitlab> yeah
<FromGitter>
<Blacksmoke16> if you dont add the restrictions it cant know what they should be
DTZUZO has quit [Ping timeout: 245 seconds]
<FromGitter>
<absolutejam_gitlab> Oh yeah, i guess it can be anything in that case
<FromGitter>
<absolutejam_gitlab> so, my bad
<FromGitter>
<absolutejam_gitlab> But the number of arguments would still be helpful
<FromGitter>
<absolutejam_gitlab> I need to find some time to contribute to the docs at least
<FromGitter>
<girng> they do, just not all methods i think
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 246 seconds]
sorcus has quit [Quit: WeeChat 2.5]
sorcus has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @asterite do you know off hand how reading yaml with `YAML::PullParser` would work with aliases and anchors?
absolutejam4 has joined #crystal-lang
<FromGitter>
<asterite> it won't work because you'd have to go back
<FromGitter>
<asterite> so yaml pull parsing is kind of broken... or, well, it won't work if there are aliases
<FromGitter>
<Blacksmoke16> yea..i noticed that when writing tests for the streaming stuff
<FromGitter>
<asterite> I think yaml is a really bad data format because of that (you can't stream all documents)
<FromGitter>
<Blacksmoke16> less than idea L/
<FromGitter>
<asterite> i also forget that
<FromGitter>
<asterite> actually, if you find an alias then you could theoretically remember it and when you find an anchor you would stream that... somehow...
<FromGitter>
<asterite> so you would stream to the output but also to some intermediate builder (for an alias). When you find an anchor you would stream from the other builder (which you would first turn into a string and then read back and stream)
<FromGitter>
<asterite> super complex, hehe :-(
absolutejam4 has quit [Ping timeout: 245 seconds]
return0e_ has quit [Read error: Connection reset by peer]
<FromGitter>
<Blacksmoke16> oh boy
<FromGitter>
<Blacksmoke16> yea deff have to look into something before i can release it
return0e has joined #crystal-lang
<FromGitter>
<asterite> what is it?
laaron has quit [Remote host closed the connection]
<FromGitter>
<Blacksmoke16> well currently oq wouldnt be able to parse yaml files with anchors
<FromGitter>
<asterite> you mean, review the PR?
<FromGitter>
<Blacksmoke16> id be ok with merging the streaming PR in, but would need to allow for parsing yaml anchors before releasing it
<FromGitter>
<Blacksmoke16> since it currently works with that
<FromGitter>
<asterite> ooooh... yeah, I don't think I can make that work
<FromGitter>
<asterite> so maybe drop the streaming? sorry :-*
<FromGitter>
<asterite> :-(
<FromGitter>
<Blacksmoke16> ill play around with it and see if i can get something to work
<FromGitter>
<Blacksmoke16> rather not scrap the streaming stuff :/
<FromGitter>
<Blacksmoke16> worst case is just load in memory for yaml? :shrug:
<FromGitter>
<Blacksmoke16> but others can still stream
<FromGitter>
<denolfe> Is there a way to get all classes that "include" a particular module? I've done similar to get all classes that have implemented a base class via macros, but I'm not coming up with anything for the modules.
<FromGitter>
<Blacksmoke16> needs implemented
<FromGitter>
<Blacksmoke16> not currently a thing
<FromGitter>
<denolfe> Alright thanks 👍
<FromGitter>
<asterite> also that probably breaks with generic types (how would you list all instantiations?)
<FromGitter>
<asterite> so in general I'd like to remove that "feature" from the language
<FromGitter>
<denolfe> I may just be trying to do a "poor man's" dependency injection. I'd ideally just want to tie functionality of a class via something other than inheritance. I come from C#, so there may be another construct that I'm not familiar with that is better suited.
<FromGitter>
<denolfe> I'm very used to just abstracting out to an Interface
<FromGitter>
<Blacksmoke16> there are a few DI shards out there as well
<FromGitter>
<Blacksmoke16> @denolfe ^
<FromGitter>
<Blacksmoke16> which would allow just that
gangstacat has quit [Quit: Ĝis!]
duane has joined #crystal-lang
absolutejam has joined #crystal-lang
absolutejam has quit [Ping timeout: 258 seconds]
ht_ has quit [Remote host closed the connection]
sorcus has quit [Ping timeout: 252 seconds]
<FromGitter>
<denolfe> @Blacksmoke16 Do you think you could link any of them? I wasn't able to turn anything up in the shards search or github.
<FromGitter>
<denolfe> Awesome, I'll check them out. Not really sure why they didn't show up in my searches
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> i used the first one for a bit, it worked quite well
<FromGitter>
<Blacksmoke16> however the issue i had with it was the container is a class variable, so separate fibers (requests in my case) would share the same members
<FromGitter>
<Blacksmoke16> vs each unique request having its own container
absolutejam has quit [Ping timeout: 272 seconds]
<FromGitter>
<j8r> What does Dependency Ingection bring in a compiled language?
<FromGitter>
<Blacksmoke16> has some concepts that are still helpful
<FromGitter>
<Blacksmoke16> mainly how dependencies can be injected into a class so that any instance that implements a given interface would work
<FromGitter>
<Blacksmoke16> which also aids testing, as you could inject a mock object so you dont have to test everything at once
<FromGitter>
<Blacksmoke16> also allows to share logic between classes
<FromGitter>
<Blacksmoke16> data*
<FromGitter>
<Blacksmoke16> i.e. say you want to generate an uuid on each request, could create some http middleware handler to do that, inject some `UuidStore` class and generate/set the uuid
<FromGitter>
<Blacksmoke16> then you could also inject that `UuidStore`object into other things, say like a logging middleware or something that builds async messages
<FromGitter>
<Blacksmoke16> Not sure how else you could do that
<FromGitter>
<j8r> But we already `require`
<FromGitter>
<Blacksmoke16> But how does that help sharing objects?
<FromGitter>
<tenebrousedge> or mocking out things
<FromGitter>
<j8r> Excluding tests and mocks
<FromGitter>
<j8r> Why not only use `require`
<FromGitter>
<tenebrousedge> DI is mostly about handling `new` in clean ways
<FromGitter>
<Blacksmoke16> right, otherwise there isnt a good way (that i can think of at least) to pass around the same instance of an object between classes
<FromGitter>
<Blacksmoke16> not sure how using require would help there?
<FromGitter>
<j8r> If you need to inherit from `my_class`, we use `require "./my_class"`
<FromGitter>
<j8r> This file has all the dependencies
<FromGitter>
<Blacksmoke16> use my uuid example, how would you set that up?
<FromGitter>
<watzon> I believe @Blacksmoke16 is talking about passing an initialized object between classes, kind of like what you might want to do with a logger or any other class that you don't need to create multiple instances of
<FromGitter>
<watzon> Correct?
<FromGitter>
<Blacksmoke16> yea sec i can give an exampel
<FromGitter>
<tenebrousedge> yeah, the focus is runtime behavior, not compile-time behavior
<FromGitter>
<j8r> So `require "uuid_store"` I guess, else it would be an error
<FromGitter>
<Blacksmoke16> so in this case DI allows the same instance of `UuidStore` to be injected into both classes
<FromGitter>
<Blacksmoke16> so you can share data between various classes
<FromGitter>
<Blacksmoke16> i.e. a request happens and sets the uuid value via the http handler, something gets logged in the controller, same uuid gets added to logged messages
<FromGitter>
<j8r> Looks like to be powerful, but I bet harder to debug due to complexity added to trace calls
<FromGitter>
<Blacksmoke16> not much more than just understanding how your system works
<FromGitter>
<asterite> @j8r DI is super popular in C#. They use it everywhere. I think it's pretty convenient and powerful.
<FromGitter>
<watzon> It's a powerful pattern
<FromGitter>
<watzon> I love how they use it in Angular
<FromGitter>
<asterite> I wonder how this can be accomplished in Crystal... maybe registering things isn't hard, you'd have one instance variable per registered type
<FromGitter>
<asterite> but for creating classes and injecting stuff to constructors it's a bit harder without runtime reflection, I think
<FromGitter>
<Blacksmoke16> yes :)
<FromGitter>
<watzon> That does complicate things
<FromGitter>
<Blacksmoke16> hardest things i came across were resolving dependencies
<FromGitter>
<Blacksmoke16> and doing the injection, esp since how i have it setup where a container is on a fiber
<FromGitter>
<Blacksmoke16> currently its done mostly by just overriding the `self.new` method