deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
oddp has quit [Ping timeout: 256 seconds]
f1refly has quit [Ping timeout: 244 seconds]
f1refly has joined #crystal-lang
sagax has joined #crystal-lang
rocx has quit [Ping timeout: 260 seconds]
<FromGitter>
<galvertez> do you guys think it's bad style to have something like ⏎ ⏎ ```require "custom-lib" ⏎ # your code here ⏎ require "custom-lib/finalize"``` ⏎ ⏎ i am writing something that would be much more efficient if there were some things that would only be considered *after* the user of my lib's code has been read and parsed, but i can't think of any other way to guarantee that
<FromGitter>
<galvertez> and for what i'm writing, i'd prefer if this library got the heck out of the way of the rest of the user's code and let it do its thing, so i want to to be as tight as possible
go|dfish has quit [Ping timeout: 256 seconds]
<FromGitter>
<naqvis> afaik, everything will be merged inside single file and then proceed with compilation, so don't think placement of `require` going to make any difference, other than scope.
<raz>
it can make a difference for macros tho
<raz>
more than once i've wished for a "require_after". once i even needed an {% after_compile %} (which doesn't exist, so had to do it outside of crystal :D)
<raz>
my use-case for the "require_after" usually is: user may inherit some of my classes and i need to patch them up in some way after that happened.
<FromGitter>
<naqvis> raz your usecase isn't already solved via `inherited` ?
<FromGitter>
<naqvis> but yeah, that's black world of *macrosssssss*
<raz>
nope, in some cases that's not enough. they are rare tho and i may not have described it well. the times i bump into it usually a 3rd party shard is involved that i don't want (or can't) patch up. e.g. "require ORM" -> create classes using that ORM -> then i want to add more to these classes or reflect on them
<raz>
in that specific case the classes may depend on one another, so asking the user to add an "include" to each is neither nice, nor really practical
<raz>
anyway, i'll admit a use-cases are fairly exotic, so haven't bothered nagging for such to be added to crystal (yet :p)
<raz>
these*
<FromGitter>
<Austaras> Is vscode extension currently broken?
<FromGitter>
<naqvis> raz, sounds like you are after RTTI
<FromGitter>
<naqvis> @Austaras how should we understand the `broken`?
<FromGitter>
<Austaras> It just keeps emitting can't find file 'prelude' while I can still compile from terminal
<FromGitter>
<naqvis> if you turn off `crystal-ameba` extension, that shouldn't be the case
<raz>
yep, runtime reflection would _also_ be nice, but prob much harder to add. whereas a "require_after" should be very easy i think (basically just prepend to a file that then gets required last)
<FromGitter>
<naqvis> try to change settings and change prblems settings to build `"crystal-lang.problems": "build"`
<FromGitter>
<naqvis> see if it still give you that issue?
<FromGitter>
<naqvis> my understanding was that, it was caused by `ameba extension`, seems I might be wrong in my understanding :P
<FromGitter>
<Austaras> It's currently set to build. After I change it to syntax error goes away
<FromGitter>
<Austaras> But that's quite useless
<raz>
i haven't had much luck with the crystal vscode extensions. i only use the auto-formatting (alt+shift+f) and ignore the rest
<raz>
(been a while since i last tried tho, and tbh also don't really have a need for any more than that)
<FromGitter>
<naqvis> yeah true, I like `crystal-ameba` extension, as that shows the small squiggles and give you some better hints
<FromGitter>
<naqvis> other than that, things aren't that good from language-plugin level
<raz>
yup i think i wouldn't mind the squiggles either, but last i tried it would only cause vscode to freeze up randomly and i didn't bother looking further into it
<raz>
i just use entr to amea & auto-compile on change, which works fine for me
<raz>
ameba*
<raz>
vscode handily lets me click the file/line in the error message to jump to it, that helps too :)
<FromGitter>
<naqvis> huh, never tried that functionality of jump to line :)
<FromGitter>
<naqvis> did you had to do some customized setup of tasks/runner for that output parsing?
<FromGitter>
<naqvis> or that works out of the box? raz?
<raz>
just out of the box in the vscode terminal
<raz>
you have to apple-click tho
<raz>
(not sure how it is on other OS'es)
<FromGitter>
<naqvis> gotcha
<FromGitter>
<naqvis> i'm on mac as well
<raz>
yup, it just looks for $filename:$line_no i think
<FromGitter>
<naqvis> look like that way
<FromGitter>
<naqvis> but definitely good enough
<FromGitter>
<naqvis> as so far when running ameba on external terminal, i had to manually find the lines in source code
<FromGitter>
<naqvis> will try vscode terminal
<raz>
yea, it's pretty good. can just be a bit annoying to find a spot for it where it doesn't take up too much screen space ;)
<FromGitter>
<naqvis> true
<FromGitter>
<evvo> Hello!
<FromGitter>
<evvo> Does anyone had any problem with bigger responses with Kemal ?
<FromGitter>
<evvo> From what I see, the response is chunked when is bigger than certain amount and that is when it brakes for some reason. ⏎ Using Chrome, Firefox and Insomnia, the request is simply in "pending" state. I was able to get the response from VS Code's HTTP client, but it might be missing some parts
<FromGitter>
<scriptmaster> Kemal is buggy, it is returning 500 error after stress testing with 200k+ requests. crystal http server ran fine and still running. but that is just crystal. I am new to crystal - only a few days. I am looking into luckyframework - seems robust
<FromGitter>
<scriptmaster> I haven't tested grip. I could spin an instance and have it run for 1-2 days and see its stability. Seeing that it is a fork of kemal, it may have its caveat. Again, I am new to crystal, so my evaluation is specific to kemal and crystal versions.
<FromGitter>
<scriptmaster> I have had problems with latest version of crystal and kemal too. especially >= 0.35.0
<FromGitter>
<scriptmaster> My version Crystal 0.34.0 [4401e90f0] (2020-04-06)
<FromGitter>
<galvertez> that is exactly what i'm dealing with :D
<FromGitter>
<galvertez> i.e. it's the difference between looking something up as a member of a hash during runtime, or having a macro write a bunch of if/else statements that i can't know about beforehand because the 3rd party is defining the classes
<FromGitter>
<galvertez> i think most usecases are handled with `inherited`, but constants are defined after that macro runs, so it doesn't work for what i'm working on (i am all but certain that a constant is the correct thing to use for this)
<FromGitter>
<galvertez> and before you suggest `finished` - i tried that too lol. constants get concretely defined after all class hooks, but i have a need to define a method for a parent class based on the definition of its children, using a macro
<FromGitter>
<galvertez> well, not a *need*, but it would certainly make this easier and faster
<raz>
yup in the cases where i've needed it, i've just resorted to "require before; do stuff; require after"
<raz>
it's not super terrible, but wouldn't like to ask users to do that in a public shard
<FromGitter>
<naqvis> yeah, but personally I will suggest against such implementations, as things become *magic* where the magic happening on some derived classes.
<FromGitter>
<naqvis> I would have gone with different contract for different purposes, thus making things very clear and easy to reason about
<FromGitter>
<naqvis> but yeah, this is just my own way of working :P
<raz>
yea when that's possible, it's clearly a better choice. in some cases it just isn't feasible. (e.g. it can be the difference between 30 lines of magic or a highly intricated >300 line patch on a 3rd party shard that has to be maintained etc.)
<raz>
i love crystal for enabling that kind of white magic. unlike e.g. Golang, where any type of reflection is a nightmare. but yea, with great power comes great responsibility. :D
<FromGitter>
<naqvis> true, monkey patching is good but can be abused as well. So agree "with great power comes great responsibility" :P
<FromGitter>
<s0kil> Would also need to set the absolute path to scry in vscode settings.
postmodern has quit [Quit: Leaving]
rocx has joined #crystal-lang
Welog has joined #crystal-lang
<FromGitter>
<Blacksmoke16> @scriptmaster should check out Athena 😉
MasterdonX has quit [Ping timeout: 240 seconds]
MasterdonX has joined #crystal-lang
<raz>
my money is on grip, but yes athena is definitely also worth a look (i think it's mostly a matter-of-taste decision between the two)
<FromGitter>
<rishavs> personally, I love sticking to the std lib even for webdev. I think crystal by default has everything I need, without me having to get a framework into the picture. Crystal is almost like go in that respect
deavmi has quit [Ping timeout: 240 seconds]
<FromGitter>
<Blacksmoke16> if what you're doing is simple, otherwise you end up just making your own framework
deavmi has joined #crystal-lang
<FromGitter>
<Blacksmoke16> main area of the http server is missing is routing
<FromGitter>
<rishavs> yeah, not gonna deny that.
<FromGitter>
<Blacksmoke16> not using one for sake of not using one might just cost you in the long run
<FromGitter>
<Blacksmoke16> in productivity and maintainability
<FromGitter>
<rishavs> routing is easy, when you need to do it naively. but, boy o boy, it gets complex when you really want to optimize it
<FromGitter>
<Blacksmoke16> mhm
<FromGitter>
<j8r> @Blacksmoke16 @wyhaines JS has so much improved this last years :D
<FromGitter>
<Blacksmoke16> @phykos what llvm version are you on?
<FromGitter>
<phykos> 10
<FromGitter>
<wyhaines> @j8r A Slice is just a bucket of bytes, and you can slice it up yourself into smaller buckets. ⏎ ⏎ ```code paste, see link``` ⏎ ⏎ You can use each of those smaller slices of your main buffer with ByteFormat, and you will get a 5 byte buffer with the first being UInt8, and then next 4 being your Float32. [https://gitter.im/crystal-lang/crystal?at=5eff6648d65a3b0292c746c5]
<jhass>
yeah, I'd suggest what Blacksmoke16 says too
<sorcus>
Blacksmoke16: Hmm... Looks good.
<FromGitter>
<Blacksmoke16> 👍
<FromGitter>
<Blacksmoke16> might even be better to abstract the setting to a private method that you could call in `after_initialize` and within `foo_raw=`
<sorcus>
Blacksmoke16: Sorry, i don't fully understand. What does you mean? X-)