ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <jrei:matrix.org> typo: `__crystal_sigfault_handler`
<FromGitter> <jrei:matrix.org> I was starting to say sigfault instead of segfault šŸ˜…
<FromGitter> <jrei:matrix.org> there are other mentions around, too
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): seems wrong yes. it's either "segfault" or `SIGSEGV` not a hybrid of the two šŸ™ƒ
<FromGitter> <oprypin:matrix.org> haha it'd be a good quiz question. āŽ which of these signals doesn't exist āŽ āŽ * āŽ ... [https://gitter.im/crystal-lang/crystal?at=603af19b823b6654d272047b]
<FromGitter> <jrei:matrix.org> Haha šŸ˜ƒ
<FromGitter> <jrei:matrix.org> I've done a `grep -rnI sigfault crystal`
<FromGitter> <jrei:matrix.org> Will do a PR to change to rename that.
<FromGitter> <rnice01> Nice!
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #crystal-lang
<watzon> straight-shoota: unfortunately it's the only way I can think to handle this particular issue. This code was auto generated from this Type Language schema https://core.telegram.org/schema. The problem is that there are a lot of constructors which return a constructor that isn't defined in the document, making it more of an abstract constructor. Then there are some types which return a constructor that has been defined,
<watzon> but unlike in Crystal where you would say that `class B` is a subclass of `class B`, the two actually don't share any common functionality, just a common interface.
<watzon> So I decided to just treat empty abstract classes like interfaces for the purpose of appeasing the type system
postmodern has joined #crystal-lang
hendursa1 has joined #crystal-lang
hendursaga has quit [Ping timeout: 268 seconds]
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
_ht has joined #crystal-lang
deavmi has quit [Ping timeout: 272 seconds]
deavmi has joined #crystal-lang
deavmi has quit [Ping timeout: 265 seconds]
deavmi has joined #crystal-lang
postmodern has quit [Quit: Leaving]
<FromGitter> <jrei:matrix.org> oprypin (https://matrix.to/#/@oprypin:matrix.org): maybe it is a short-band for "segmentation fault signal"? šŸ¤·
<FromGitter> <oprypin:matrix.org> j8r (https://matrix.to/#/@jrei:matrix.org): yes thats the main thing i thought so it's not so clear. but it's too misleading this way
_whitelogger has joined #crystal-lang
<FromGitter> <Luj8n> Hi! Is it possible to draw (graphics api or like library idk) in Crystal like in javacript canvas or with c# graphics? Thanks
<FromGitter> <oprypin:matrix.org> you can create SVG files lol āŽ https://github.com/celestinecr/celestine
deavmi has quit [Ping timeout: 272 seconds]
<FromGitter> <oprypin:matrix.org> otherwise, i think the closest thing would be āŽ https://github.com/oprypin/crsfml
deavmi has joined #crystal-lang
<FromGitter> <Luj8n> Hm, thanks
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #crystal-lang
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #crystal-lang
<FromGitter> <Blacksmoke16> @watzon could you use modules instead? Not sure if that would be any different tho
<FromGitter> <wyhaines> Ruby has a Find class that implements a Filesystem search function, similar to the `find` command in unixes. Crystal does not appear to have adopted Find into its stdlib. Does anyone know of a shard that implements similar functionality, or will I need to roll my own (or shell out to `find`) to get it?
<FromGitter> <wyhaines> I am just going to roll one into a new Shard.
<straight-shoota> Is `Dir.glob` not sufficient?
<straight-shoota> maybe that finder shard is what you're looking for
<FromGitter> <wyhaines> Huh. I spent a while looking for exactly that kind of thing, and failed. Ha! Well, thanks. That's basically what I am looking for.
<straight-shoota> well, "find" is hard to search for :D
andremedeiros has quit [Read error: Connection reset by peer]
andremedeiros has joined #crystal-lang
<watzon> @BlackSmoke16 technically I could, but it would end up being about the same. More lines though since Iā€™d need an extra line for an include statement.
<FromGitter> <Blacksmoke16> Yea pretty much
<watzon> Overall it's just kind of a shitty situation. The other option would be to not use class inheritance at all, but then I'd miss out on some of the niceties of OOP.
<FromGitter> <Blacksmoke16> id be curious to see if the compiler treats modules differently than parent types
<FromGitter> <Blacksmoke16> id doubt it tho, given you pretty much end up with the same result
_ht has quit [Remote host closed the connection]
<watzon> What I'm curious about is how slow compilation is going to be once all generated objects are being referenced. For instance, if I compile a class which has a property with the type `TLObject`.
<watzon> The last iteration of the generated types made compilation of a very simple program take 30+ seconds
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <jrei:matrix.org> in your opinion, what should I do to add GC to object pool for https://github.com/j8r/pool.cr/blob/master/src/pool.cr
<FromGitter> <jrei:matrix.org> Having a new object like `GarbageCollectedPool(T) < Pool(T)`, or have an object which holds pool.
<FromGitter> <jrei:matrix.org> I think maybe having an independent object would be better. Generally inheritance with generics is a bad idea
<straight-shoota> hm, but you probably want to use GC pool and non-GC pool interchangably
<straight-shoota> alternatively, you could make GC completely external to the pool implementation. but then you'd need to provide an API for the GC to hook in
<FromGitter> <jrei:matrix.org> yes good idea, I was also thinking to that
<straight-shoota> I wouldn't expect GC to be very complex for that... so maybe you could also just implement a GC method on regular pool
<straight-shoota> so GC comes included (but inactive by default probably)
<FromGitter> <jrei:matrix.org> hum, it can become complex: https://github.com/crystal-lang/crystal-db/blob/master/src/db/pool.cr
<straight-shoota> kay, I'm just throwing options.
<straight-shoota> Dunno what exactly is your plan
<FromGitter> <jrei:matrix.org> it is a good idea to have an external GC. I won't even need callbacks if there is no max connections
<FromGitter> <jrei:matrix.org> evaluating options :) Thanks straight-shoota.
<FromGitter> <jrei:matrix.org> I aims to have a simple base, easy to use/understand, but provide additional features for those needing them
<FromGitter> <jrei:matrix.org> max_pool_size... I got why it is needed. It is mainly for Databases, not to exhaust its limited connections. Makes less sense for others objects
<straight-shoota> err, I'd say it makes sense for everything that uses a pool
<straight-shoota> if you don't have a limitation on resources, you don't need a pool
<straight-shoota> more or less
<FromGitter> <jrei:matrix.org> unless creating this very resource is expensive
<straight-shoota> yeah, but then you still need to have a way to release resources in long running processes
<straight-shoota> the pool makes it impossible to release directly after use
<straight-shoota> so you need a different mechanism
<FromGitter> <jrei:matrix.org> yep, that's the GC i'm building ;)
<FromGitter> <jrei:matrix.org> it will handle bursts, and progressively release resources - at least I would like to handle like this
<straight-shoota> and a pool size limit is a good indicator for triggering GC
<FromGitter> <jrei:matrix.org> maybe, I think a memory limit would be better
<FromGitter> <jrei:matrix.org> because at the end that's the memory we want to save
<straight-shoota> if memory use varies, yes probably
<straight-shoota> but if we're talking about resources that are costly to create but cheap to keep around, variable memory use shouldn't be a factor
<FromGitter> <jrei:matrix.org> yeah. I think I won't have a problem with no more memory, unless I'm DDOS
<straight-shoota> totally depends on the kind of resource
<FromGitter> <jrei:matrix.org> of course, yeah
<straight-shoota> I'm just saying if the memory per item varies, it probably doesn't fit the criterium "cheap to keep around"
<FromGitter> <jrei:matrix.org> per item in the pool?
<straight-shoota> yes
<FromGitter> <jrei:matrix.org> yes, you're right
<FromGitter> <jrei:matrix.org> at any rate: on one side, I want to prevent incident in production, but on another side, it can be premature optimization :/
<FromGitter> <jrei:matrix.org> *potential incidents
<straight-shoota> yeah, cache invalidation is one of the two hardest problems in computer science...
_whitelogger has joined #crystal-lang
<FromGitter> <oprypin:matrix.org> straight-shoota, @bcardiff , how are these redirects being made? https://github.com/crystal-lang/crystal-db/commit/dfae44d5affa8a3d2a50b64202e3bd1ac460fe5d
<straight-shoota> no idea
<FromGitter> <bcardiff> @oprypin https://github.com/bcardiff/ghshard
<FromGitter> <oprypin:matrix.org> mhmm interesting. thanks.
<FromGitter> <oprypin:matrix.org> straight-shoota, and i forgot, is there any tool managing additions to https://crystal-lang.org/api/versions.json ?
<FromGitter> <oprypin:matrix.org> oh it's possible to find via search https://github.com/crystal-lang/crystal-dist/blob/01822b18179ada9727bcf8ffde49fcad99e374ea/dist.sh#L105
<straight-shoota> oprypin do perhaps have any plans on making a convenient configurator for mkdocstrings-crystal like the one for install-crystal? =)
<FromGitter> <oprypin:matrix.org> straight-shoota, mm no
<FromGitter> <oprypin:matrix.org> i have 2 quickstart guides, u just copypaste everything and you're good
<FromGitter> <oprypin:matrix.org> straight-shoota, i also provide personal onboarding services, just ping me if you want to port anything over
<straight-shoota> yeah, I'll probably try the quickstart guide and see how far it leads me
<FromGitter> <oprypin:matrix.org> straight-shoota, whats the project in question?
<straight-shoota> I though I'd start with two new shards I'm about to publish
<straight-shoota> https://github.com/straight-shoota/http-session is already on GH
oprypin has quit [Quit: Bye]
oprypin has joined #crystal-lang
<straight-shoota> opyrpin, so I have gen_doc_stubs.py in place but mkdocs build doesn't generate API docs
<straight-shoota> verbose logs Running `crystal docs --format=json --project-name= --project-version=`
<straight-shoota> so I assume that fails because empty name and version would be invalid
<straight-shoota> oh no, it doesn't fail
<straight-shoota> running gen_doc_stubs.py directly I get `AttributeError: module 'mkdocs.structure' has no attribute 'pages'`
<FromGitter> <jrei:matrix.org> Damn, monkey patching HTTP::Server::Context :(
<FromGitter> <jrei:matrix.org> Other than that looks nice
<straight-shoota> there's no other option really
<straight-shoota> unless you want ugly lookup by context (like `session = sessions[context]`) and then every handler needs access to `sessions`
<straight-shoota> so this is already minimal invasive
<FromGitter> <jrei:matrix.org> It reminds me how Kemal do things...
<FromGitter> <jrei:matrix.org> But you have already a retrieve_session(context) āŽ method
<FromGitter> <jrei:matrix.org> So that's just a OOP layer over that
<FromGitter> <oprypin:matrix.org> straight-shoota, oops you mistyped my name so i didnt see
<straight-shoota> yes, but it only works because `session_manager` is also a property on HTTP::Server::Context
<straight-shoota> oops
<FromGitter> <jrei:matrix.org> In fact, there is even no need to make it a HTTP::Handler
<straight-shoota> yes, it could be static
<straight-shoota> but then you have to use the same session manager for every handler chain
<FromGitter> <636f7374> The YAML.use_yaml_discriminator enumeration cannot use types other than Int32 #10458
<DeBot> https://github.com/crystal-lang/crystal/issues/10458 (The YAML.use_yaml_discriminator enumeration cannot use types other than Int32)
<FromGitter> <oprypin:matrix.org> straight-shoota, ok so the fact that it breaks when running directly seems to be a bug. i'll fix that
<FromGitter> <oprypin:matrix.org> but you shouldn't need to run it directly, and i can't tell you why nothing is generated
<straight-shoota> running it directly was just a debugging step
<straight-shoota> and the comment said it should work :P
<FromGitter> <jrei:matrix.org> straight-shoota that's here we are reaching the limit of the stdlib
<straight-shoota> yep
<FromGitter> <jrei:matrix.org> There are frameworks that make it easy to put paths behind authentication, a use case for sessions
<FromGitter> <oprypin:matrix.org> straight-shoota, right, it should work. if you update to version 0.3.1 of "mkdocs-gen-files" :s
<FromGitter> <oprypin:matrix.org> (just published)
<straight-shoota> okay, that works but doesn't print anything
<FromGitter> <oprypin:matrix.org> straight-shoota, do you have it configured?? https://mkdocstrings.github.io/crystal/quickstart/migrate.html#__code_2 `gen_doc_stubs.py` is not a special filename to it
<FromGitter> <oprypin:matrix.org> straight-shoota, then i'd say it's not finding any types
<FromGitter> <jrei:matrix.org> I don't know... we could change the handler interface to make it possible to pass a third party mutable object?
<FromGitter> <jrei:matrix.org> Like, a `call(context, object)` overload
<straight-shoota> oprypin, looks like it. I'm running `.venv/bin/python3 docs/gen_doc_stubs.py`, crystal source files are in src/
<FromGitter> <oprypin:matrix.org> straight-shoota, does `crystal docs --format=json --project-name= --project-version=` produce anything, then?
<straight-shoota> jrei, why? what would that object be? Who defines what it is and where is it initalized? doesn't make any more sense than reopening HTTP::Server::Context
<straight-shoota> oh no, it does not
<straight-shoota> hm
<FromGitter> <oprypin:matrix.org> straight-shoota, what about `crystal docs --format=json --project-name= --source-refname=master`, does that work?
<straight-shoota> weird. `crystal docs --format=json --project-name= --project-version= src/http-session.cr` works
* FromGitter * Blacksmoke16 this is why I like the listener/service based approach
<straight-shoota> refname should be irrelevant for lookup
<FromGitter> <636f7374> The YAML.use_yaml_discriminator enumeration cannot use types other than Int32 #10458
<DeBot> https://github.com/crystal-lang/crystal/issues/10458 (The YAML.use_yaml_discriminator enumeration cannot use types other than Int32)
<FromGitter> <636f7374> The YAML.use_yaml_discriminator enumeration cannot use types other than Int32. āŽ For example, enumerating UInt8 does not work. āŽ JSON.use_json_discriminator will not cause any problems.
<FromGitter> <636f7374> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=603c2aace5f1d949d46e8a8c]
<FromGitter> <636f7374> Unhandled exception: Unknown 'type' discriminator value: "0" at line 2, column 1 (YAML::ParseException)
<FromGitter> <oprypin:matrix.org> straight-shoota, ok i can reproduce that it's not producing any docs
<FromGitter> <oprypin:matrix.org> straight-shoota, no idea why, but if passing `src/http-session.cr` works, then just do that
<FromGitter> <oprypin:matrix.org> `crystal: \ crystal_docs_flags: ['src/http-session.cr']
<straight-shoota> na, have to investigate that compiler error :D
<FromGitter> <636f7374> Sorry, I resent it again. My browser is malfunctioning and gitter.im redirects infinitely.
<straight-shoota> yeah generating docs for a file with `require "./src/**"` doesn't produce anything either
<straight-shoota> maybe it's because everything lives under a stdlib namespace?
<FromGitter> <oprypin:matrix.org> oh what O_o
<straight-shoota> that doesn't seem to be it
<FromGitter> <oprypin:matrix.org> `crystal docs` (not only json) doesnt work
<straight-shoota> yes lookup is exactly the same for both
<FromGitter> <oprypin:matrix.org> @636f7374: i think people will just reply to the issue on github
<FromGitter> <636f7374> @oprypin:matrix.org Okay :)
<straight-shoota> oh no, the namespace is actually at fault
<FromGitter> <oprypin:matrix.org> meanwhile... āŽ https://oprypin.github.io/crystal-db/ āŽ *a wild version selector appeared*
<FromGitter> <oprypin:matrix.org> https://github.com/oprypin/crystal-db/compare/mkd
<FromGitter> <oprypin:matrix.org> i wish the Python dependency management didnt get in the way of making the diff *actually* that small :D