<raz>
hmm. i may be last to the part, but today i realized something. lucky is basically to crystal what rails is to ruby.
<raz>
i.e. it uses every dirty trick and language magic to make web dev less painful.
<raz>
coming from rails it's kinda like upgrading from an idea that didn't quite work out, to a new version of that idea on a much more solid foundation (albeit less mature)
<FromGitter>
<Daniel-Worrall> As kemal is to sinatra
<raz>
yeh but kemal leaves a bit of a bad aftertaste with the global stuff (i feel like it's likely gonna be superseded by one of the cleaner alternatives soon)
<FromGitter>
<Blacksmoke16> kemal is essentially just a fancy router
<raz>
on lucky i'm not really decided yet. so far it feels damn good. it's dirty macros galore, but the straightjacket that is crystal (errors at compile rather at runtime, yay!) realllllly helps.
<FromGitter>
<Daniel-Worrall> Removing the global pollution is in the works, but the developer has been quite irl busy
<FromGitter>
<Blacksmoke16> athena is also getting pretty slick, im a bit biased tho :P
<FromGitter>
<Blacksmoke16> not as mature as lucky/amber tho
<raz>
yeh, i'm def not hating on kemal (have used it in almost every crystal app). it's great - the global pollution is really the only wart for me.
<raz>
yea haven't looked a athena yet (ought to soon). dabbled with amber some, but it's kinda too railsy to me. not taking advantage of crystal the way lucky does.
<FromGitter>
<Blacksmoke16> (dont mind athena, is an old version that got broken when the repo migrated to docker containers since it doesnt have the right env var anymore so is writing logs to files and shit)
<FromGitter>
<Blacksmoke16> waiting on crystal `0.32.1` in alpine to update it
<raz>
as long it's not ruby-slow that isn't a big deal in practice
<FromGitter>
<Blacksmoke16> yea for sure, just has to be fast enough
<raz>
23k/s per server is unlikely to become a bottleneck ;)
<FromGitter>
<Blacksmoke16> ouch lol, rails is like 3k
<FromGitter>
<Blacksmoke16> didnt realize it was *that* bad
<raz>
yea, and that's still plenty for pretty much any app
<raz>
rails problem is less the performance and more the uncontrollable memory leakage
<raz>
i guess vanilla rails isn't to blame for that. but then you add gems and stuff. i have yet to see a real world rails app that doesn't leak like a sieve
<FromGitter>
<Blacksmoke16> i come from a non ruby background, so been taking a bit diff approach
<FromGitter>
<Blacksmoke16> has been nice, combining the things i like from each framework
<FromGitter>
<Blacksmoke16> that i worked with*
<raz>
yea, really interesting stuff coming up on crystal. also love the rate at which it happes
<raz>
still discovering new gems almost every week
<FromGitter>
<Blacksmoke16> have to see what is around a year from now
alex`` has quit [Ping timeout: 268 seconds]
<FromGitter>
<watzon> @straight-shoota where would you say marionette belongs in the shardbox catalog?
<FromGitter>
<watzon> I was thinking maybe testing, but while it can be used for testing it's not really testing related. I just can't think of a category that fits better.
mistergibson has joined #crystal-lang
<FromGitter>
<grkek> Wouldn't it be nice to have an auto resolver for the class name definitions to the stdlib of crystal / lib's found in the lib folder, What I mean is that it would be perfect for the vs code crystal plugin just to click on the class with Ctrl + Click which opens the local file which contains the class or just redirects you to the crystal API :^), might even open the local docs of the crystal api, that would be
<FromGitter>
... nice as well if not having internet is a problem there might already be a local version of the API but yeah you get the picture.
<FromGitter>
<watzon> So goto definition
<FromGitter>
<grkek> yeah
<FromGitter>
<grkek> goto definition
<FromGitter>
<grkek> for the extension would be nice ?
<FromGitter>
<watzon> Well yeah, and it's on the roadmap for Scry, but that project hardly gets any love
<FromGitter>
<grkek> Scry ?
<FromGitter>
<watzon> I wouldn't expect a good language server with that implemented until post v1
<FromGitter>
<grkek> Oh yeah I remember now how much pain it is to write a plugin for vscode
<FromGitter>
<watzon> It is a pain
<FromGitter>
<watzon> But less so than with Sublime at least
<FromGitter>
<grkek> Oh sublime is horrific
<FromGitter>
<watzon> Yes. Yes it is.
yukai has quit [Ping timeout: 240 seconds]
_ht has joined #crystal-lang
_ht has quit [Remote host closed the connection]
alex`` has joined #crystal-lang
<repo>
raz: i felt exactly the same way as you about lucky
<repo>
i've been a rails dev for a few years but also migrated away from it for almost every project. Usually built something on top of sinatra or hanami. With crystal i'm still looking for something that's modular enough and easy enough to set up. I have some issues with the way lucky presumes the directory structure. Which makes all their generators pretty much useless to me. Maybe more their
<repo>
namespacing than directory structure.
<repo>
but they're definitely going in the right direction
<repo>
currently i'm giving Athena a go. I really like it for it's modularity and that it doesn't care how i structure my project. I use it together with crecto.
sagax has quit [Ping timeout: 260 seconds]
<raz>
hmm yup, rails apps always get muddled and nasty in the end. and then you have to update to the next major version, stuff breaks in funny ways...
<raz>
haven't yet had a problem with lucky's dir structure. i generally try to not go against the grain with that type of "all-in" framework, that tends to be a recipe for headache ;)
HumanGeek has quit [Ping timeout: 240 seconds]
sagax has joined #crystal-lang
HumanGeek has joined #crystal-lang
<FromGitter>
<faustinoaq> @grkek Hi, I'm using crystal again, I was the author of crystal-vscode plugin. The current version has many workarounds, using two backends, the most sophisticated one is Scry, but we still need to fix some protocol mismatches to make it work flawlessly.
<FromGitter>
<faustinoaq> I'm testing crystal-vscode and incredibly the WSL tweak I did to make it work on windows, still works to check syntax error at least.
<FromGitter>
<faustinoaq> 😅
<repo>
raz: that's true. Idk it's just personal preference maybe but TopLevelNamespace::Controllers::Users is much cleaner to me than UsersController in global namespace
<repo>
especially since it mirrors the directory structure
<repo>
(yes, i always have src/top_level_namespace/)
<repo>
it's unnecessarily limiting the choices for your model names
<repo>
i ran into this once with lucky and i only used it in like two pet projects
<raz>
repo, yep i agree, not a fan of that either (same as with kemal)
<raz>
but ultimately i've learned to avoid wrestling with frameworks over largely cosmetic decisions like that
<raz>
that way lies madness.... you monkeypatch it or actively go against the grain in other ways, it comes back to bite you (none of the examples work anymore, updates break etc.)
<raz>
in practice i've found namespace conflicts to be exceedingly rare, so for a monster like lucky i'm even willing to tolerate it
<raz>
since for most apps where lucky is involved, lucky pretty much *is* the app ;)
<raz>
i think the namespace issue is a bigger one in kemal (as that one more of a webserver-mixin than an all-encompassing framework)
Andriamanitra has joined #crystal-lang
alex`` has quit [Ping timeout: 265 seconds]
alex`` has joined #crystal-lang
duane has joined #crystal-lang
_ht has joined #crystal-lang
alex`` has quit [Ping timeout: 268 seconds]
alex`` has joined #crystal-lang
_ht has quit [Remote host closed the connection]
_ht has joined #crystal-lang
sagax has quit [Remote host closed the connection]
duane has quit [Ping timeout: 265 seconds]
<FromGitter>
<grkek> @repo have you tried Grip :) ?
<FromGitter>
<grkek> @faustinoaq yeah I got it to work as well but go to definition would be really nice
<FromGitter>
<omidathari> Hi all ⏎ I am trying to write an event driven serial port program that listens on a read fiber while the main loop performs the transmitting asynchronously. ⏎ In the following program the Read Fiber blocks the main program loop and hence does not allow any transmission. The Read fiber receives data correctly. ⏎ If I set the blocking attribute to false and provide a timeout, then the main loop
<FromGitter>
<grkek> Try using psatebin or user ``` on both ends
duane has joined #crystal-lang
<FromGitter>
<christopherzimmerman> I've been trying to add Crystal's parallelism to my library, but I must be doing something very wrong, since my benchmarks are vastly slower when using fibers, and even slower when I compile with `-Dpreview_mt`. I based this code (https://gist.github.com/christopherzimmerman/d6ee39ae8665f4cf5735f467557d3e94) off the blog post on matrix multiplication, but I must be missing something.
<FromGitter>
<Blacksmoke16> building with release?
<FromGitter>
<christopherzimmerman> Yea
<FromGitter>
<Blacksmoke16> how many workers you using?
<FromGitter>
<christopherzimmerman> Usually just the default, but tried with 8 as well.
<FromGitter>
<Nicolab> `crystal spec` and `crystal docs` are really great tools!
<FromGitter>
<kinxer> @Nicolab Congrats on your first published shard! I'm not quite there yet, myself... Most of my Crystal is proprietary to my work right now.
<FromGitter>
<Nicolab> @kinxer Thanks! I'm doing the opposite :) Now that I've made my hand with a Shard. I'm going to do the backend of a project for the company I work for.
<FromGitter>
<Nicolab> In fact, I have a little started working the backend in Crystal. ^^
yukai has joined #crystal-lang
<FromGitter>
<elorest> Is it possible to make `gets` on File be blocking so that it yields and waits for more input?
<FromGitter>
<elorest> File inherits from FileDescriptor which has instance methods for #blocking and #blocking=(v)
<FromGitter>
<kinxer> What are you trying to do? Trying to emulate `tail -f`?
<FromGitter>
<elorest> That's similar to my goal as a proof of concept.
<FromGitter>
<kinxer> Hm... But you're just generally trying to continue to get data from the end of a file? And if the read position is already at the end of the file, you want it to wait until the file becomes larger?
<FromGitter>
<elorest> Yes.
<FromGitter>
<kinxer> How often should it check whether the read position is still at the end of the file?
<FromGitter>
<elorest> I'm actually trying to solve an issue I'm having with reading serial ports. With UDP/TCP and other file decriptor readers gets, read_byte etc, blocks until data is available which lets me switch fibers and wait for content.
<FromGitter>
<elorest> Opening a FD serial port as a file however doesn't block but just hangs and waits.
<FromGitter>
<kinxer> Can you `peek` and `sleep` if there's no data?
<FromGitter>
<elorest> I don't want to check every so often I just want it to block like stdlib gets or most other IO gets.
<FromGitter>
<elorest> @phortx Yeah. That's pretty much what I'm doing it just seems like a hack.
<FromGitter>
<Blacksmoke16> @Nicolab ⏎ ⏎ > Not exposed by default, must be imported
<FromGitter>
<kinxer> Hm... Why are you using `File` for reading file descriptors?
<FromGitter>
<Blacksmoke16> whats the reasoning? if you dont use it it wouldnt be included in the binary anyway
<FromGitter>
<Blacksmoke16> `name.id.chars[0] == ':' ? name[1..-1].id : name.id` im pretty sure `name.id` would work no?
<FromGitter>
<Blacksmoke16> > is is a macro, no overhead during the runtime ⏎ ⏎ I'm not sure that's entirely accurate, the macro just expands to the same `Valid.xx` logic so in the end would be exactly the same runtime performance at a cost of very slightly slower compile times
<FromGitter>
<Nicolab> @Blacksmoke16 "Not exposed by default, must be imported" Did I make a mistake in my English?
<FromGitter>
<Blacksmoke16> no it makes sense, but whats the reasoning for just now including it by default?
<FromGitter>
<Blacksmoke16> not*
<FromGitter>
<elorest> @kinxer How would you interact with a COM port? Opening it as a File seems pretty standard...
<FromGitter>
<Nicolab> Yes the same runtime performance, is not a wrapper or other
<FromGitter>
<Nicolab> @Blacksmoke16 to avoid polluting the scope when not in use.
<FromGitter>
<Blacksmoke16> fair enough
<FromGitter>
<kinxer> @elorest Let me take a sec to admit that I'm trying to help debug but have no experience with the kind of file descriptor communication you're doing (e.g. I just had to look up "COM port"). However, my point was that if you're opening file descriptors that aren't files, it seems to me that `IO::FileDescriptor` is more likely to match what you're looking for.
<FromGitter>
<Nicolab> @Blacksmoke16 "is" seem to me a little short for exposing it by default
<FromGitter>
<Nicolab> @Blacksmoke16 `name.id.chars[0] == ':' ? name[1..-1].id : name.id` If I remember correctly, it wrote down the symbol (with `:`) instead of the method name.
<FromGitter>
<Blacksmoke16> yea and putting in the `Valid` or `Validator` namespace would kinda defeat the purpose of having it short