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> <mjfiano:matrix.org> @Blacksmoke16: Where did you hear about that a Crystal book is being written and should be released this year?
ur5us has quit [Ping timeout: 252 seconds]
ua_ has quit [Excess Flood]
ua_ has joined #crystal-lang
<FromGitter> <mjfiano:matrix.org> Well done testing vectors after a few thousand lines and the onset of RSI. now the more extensive quat and mat left...
ur5us has joined #crystal-lang
postmodern has joined #crystal-lang
ur5us has quit [Ping timeout: 256 seconds]
<FromGitter> <oprypin:matrix.org> mfiano (https://matrix.to/#/@mjfiano:matrix.org): i already shared some code and i don't really have more. well maybe a less cut-off example. but i don't have access to the code for the moment. ⏎ ⏎ loading shaders at runtime is the normal mode of operation. just a string value. then u can use runtime interpolation, not only ECR. ⏎ ⏎ and i didn't compose programs, I'm not big on shaders.
sorcus has quit [Ping timeout: 268 seconds]
sorcus has joined #crystal-lang
sorcus has quit [Client Quit]
sorcus has joined #crystal-lang
hightower3 has quit [Ping timeout: 252 seconds]
<FromGitter> <spencerwi> > @spencerwi do you know if you can write a tree-sitter implementation in Crystal rather than in C? ⏎ ⏎ @asterite I've done an initial cursory search, and haven't come up with anything promising. From what I can tell, the "normal" path with tree-sitter is a `grammar.js` file (that gets "processed" and generates a `parser.c` file), and an optional accompanying `scanner.c`file for cases where you need
<FromGitter> ... custom lexing. Presumably both of those eventually get compiled into a third artifact that tree-sitter uses, but I haven't yet found what that is. ⏎ ⏎ If we could "cut out the middle-man" and jump straight to producing that third artifact from the existing Crystal compiler, that'd be pretty sick -- we'd just have to "wrap" it in ... [https://gitter.im/crystal-lang/crystal?at=6103f02bc9f8852a97170062]
<FromGitter> <spencerwi> In the short term, it'd be unpleasant for tree-sitter tooling that expects a "continue to parse despite errors" behavior instead of the Crystal compiler's "fail fast on errors" behavior, but there may be potential to figure out a solution there too
postmodern has quit [Quit: Leaving]
hightower2 has joined #crystal-lang
<FromGitter> <jwaldrip> What is the best way to proxy an HTTP request to an outgoing server? ⏎ ⏎ ```HTTP::Client.new(target_host_uri).exec do |target_response|``` [https://gitter.im/crystal-lang/crystal?at=61041a4ee5d06f575be2ae3e]
<FromGitter> <jwaldrip> that doesnt seem to be doing what I want
<FromGitter> <jwaldrip> am I doing anything wrong there?
<FromGitter> <Blacksmoke16> what happens if you just do `.response` versus `.output`
<FromGitter> <jwaldrip> response wont get the the headers
<FromGitter> <Blacksmoke16> as the response is itself is anIO
<FromGitter> <jwaldrip> well it is, but it isnt
<FromGitter> <jwaldrip> the response io is the body io
<FromGitter> <jwaldrip> response.to_io will give me the full stream
<FromGitter> <jwaldrip> but im trying that now anyway
<FromGitter> <jwaldrip> that writes the headers to the body :-)
<FromGitter> <jwaldrip> not what I wanted
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <jwaldrip> I just want to do a straight copy of the incoming IO
<FromGitter> <eliasjpr> Hello Everyone, I want to share with you a small shard that I have been working on. The shard name is called JoobQ (https://github.com/azutoolkit/joobq) and is a job scheduler very much like Sidekiq, It has a nice set of features and a dashboard UI (https://github.com/azutoolkit/dashforge) https://dashforge.io/ ⏎ ⏎ Features: ⏎ ⏎ ```code paste, see link``` [h
<FromGitter> ... ttps://gitter.im/crystal-lang/crystal?at=61041e0a6ccf813819e746eb]
<FromGitter> <jwaldrip> whats the webm?
<FromGitter> <jwaldrip> video
<FromGitter> <jwaldrip> got it
<FromGitter> <jwaldrip> Vey nice
<FromGitter> <eliasjpr> this is a lengthier demo
<FromGitter> <eliasjpr> Thank you Json
<FromGitter> <eliasjpr> Jason 😓
<FromGitter> <jwaldrip> ill respond to either
<FromGitter> <eliasjpr> haha
<FromGitter> <Blacksmoke16> > I just want to do a straight copy of the incoming IO ⏎ ⏎ Maybe `IO.copy` then?
<FromGitter> <jwaldrip> looking at that as well... but have to do some hackyness on the server response side with `response.@io`
<FromGitter> <Blacksmoke16> hmm
<FromGitter> <jwaldrip> some patching required
<FromGitter> <jwaldrip> To gain access to the IO private method. ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=610424c5b251583903b1b6c1]
<FromGitter> <mjfiano:matrix.org> Hmm, lack of parallel assignment just caused me to debug for hours
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <mjfiano:matrix.org> Yeah, this is wrong, and not the assignment operator I want https://gist.github.com/mfiano/c3c3599f7ebb0b7c834526e8465cc669
<FromGitter> <Blacksmoke16> wew, that looks like a pita
<FromGitter> <mjfiano:matrix.org> This is known as parallel assignment, when all the rhs of the expressions are evaluated before the lhs, such that all assignments happen at the same time, unlike that, where assignments of earlier values are using the newer bindings in later assignment expressions
<FromGitter> <mjfiano:matrix.org> THe solution in Crystal seems to be make a bunch of temp vars, or wrap it up with a nice macro bow on top. not built in i guess
<FromGitter> <Blacksmoke16> super minor but you could do `def *(other a : self, *, into b : self) : self`, then you wont need the `a = self` etc
<FromGitter> <Blacksmoke16> but still support doing `into: obj`
<FromGitter> <jwaldrip> i believe you can also do paralell assignment with `into[0], into[1] = a[0, 0] * b[0, 0] + a[0, 1] * b[1, 0] + a[0, 2] * b[2, 0] + a[0, 3] * b[3, 0]`
<FromGitter> <mjfiano:matrix.org> Yeah I tried that first, but it doesn't give the expected results for an array lookup
<FromGitter> <mjfiano:matrix.org> It's still not parallel in this case
<FromGitter> <mjfiano:matrix.org> @Blacksmoke16: If I do that then I wouldn't be able to assign into `into`. I need all 3 variables.
<FromGitter> <Blacksmoke16> ohh `a` isn't the same as `other`
<FromGitter> <mjfiano:matrix.org> no it';s the receiver
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <mjfiano:matrix.org> so i can either allocate a copy of the array to work with, or i can hope LLVM's register allocator can fit 16 temp addresses in registers
<FromGitter> <mjfiano:matrix.org> no idea
<FromGitter> <mjfiano:matrix.org> Same thing in Nim. those a/b assignments are just to pass the structs by value
<FromGitter> <mjfiano:matrix.org> But using classes here
<FromGitter> <asterite> what's the problem? a, b, or into are the same ones so the data gets overwritten?
<FromGitter> <mjfiano:matrix.org> The latter. into can actually be the reciever, shared structure with A
<FromGitter> <mjfiano:matrix.org> So I need to do all the assignments at once, rather than serially
<FromGitter> <mjfiano:matrix.org> Which implies temporary storage and a mess of this already messy method
<FromGitter> <mjfiano:matrix.org> I wish there was something like `psetf` from Lisp :)
<FromGitter> <mjfiano:matrix.org> It's just a macro. Might be able to add it at some point
<FromGitter> <mjfiano:matrix.org> every one of my math functions has a `(...*, into: ...)` variant that can be used to mutate an existing variable, and usually this is the lhs of the operation to mutate it with such as `a.* b, into: a`
<FromGitter> <mjfiano:matrix.org> it's not a hard problem. i'm quite used to it. it's just coming up with a design in Crystal that looks nice to me :)
<FromGitter> <asterite> doing `into[0, 0], into[0, 1] = ...` should work because all the right-hand side expressions will be placed in temporaries first
<FromGitter> <asterite> I don't know what error you were getting
<FromGitter> <mjfiano:matrix.org> There is no error
<FromGitter> <mjfiano:matrix.org> It is mathematically wrong (matrix multiplication), because into[0,0] could be a[0,0], which is being read as a new value out of band
<FromGitter> <mjfiano:matrix.org> or any other of the 16
<FromGitter> <mjfiano:matrix.org> I tried that though, and got the same result
<FromGitter> <asterite> right, but if all values are computed before being assigned to `into`, then it should work, right?
<FromGitter> <asterite> I think there might be a bug in Crystal here, I'm checking
<FromGitter> <mjfiano:matrix.org> Right now I 'm trying to wrestle with the formatter to not put it on 2 lines into like column 500
<FromGitter> <asterite> yeah, the formatter didn't think you'd have such long expressions in a multi assign :-)
<FromGitter> <asterite> is there no way to generate that code with a macro?
<FromGitter> <mjfiano:matrix.org> I purposely didn't do codegen for this library, and also didn't in my Lisp port, because I want the math to read like it would in a math text.
<FromGitter> <mjfiano:matrix.org> I don't want anything hidden behind macros
<FromGitter> <asterite> I just tried the parallel assign, it works fine
<FromGitter> <asterite> still a problem for the formatter :-D
<FromGitter> <mjfiano:matrix.org> Hmm
<FromGitter> <mjfiano:matrix.org> Now I just have to fit it in 80 columns
<FromGitter> <jwaldrip> is there a way to make crystal use a local proxy for http requests?
<FromGitter> <jwaldrip> bummer, thats fine
<FromGitter> <mjfiano:matrix.org> I can't seem to decide if I want the separate mutable api for every method or not. i'm leaning back towards structs, just being cateful wrt chaining calls
<FromGitter> <mjfiano:matrix.org> i dont think stack allocating fresh objects all the time is going to be that much slower than jumping over heap memory and the toll on the GC
<FromGitter> <mjfiano:matrix.org> think i'll take my lunch now and think for a bit.
hightower2 has quit [Ping timeout: 240 seconds]
notzmv has quit [Ping timeout: 256 seconds]
Guest63 has joined #crystal-lang
Guest63 has quit [Client Quit]
<FromGitter> <jwaldrip:matrix.org> this is a new one `malloc(): unsorted double linked list corrupted` what causes this.
<FromGitter> <Blacksmoke16> nice
<FromGitter> <jwaldrip:matrix.org> lol... thanks?
<FromGitter> <Blacksmoke16> np :P
<FromGitter> <jwaldrip:matrix.org> How does one get a corrupted list?
<FromGitter> <Blacksmoke16> no idea, first i saw that one too. Crystal repo doesn't have any mention of it either
<FromGitter> <jwaldrip:matrix.org> anything to do with this...
<FromGitter> <jwaldrip:matrix.org> ``````
<FromGitter> <Blacksmoke16> does it work if you just do a normal `devices.size.times { arr << channel.receive }`?
<FromGitter> <Blacksmoke16> or what is `device.sessions` doing?
notzmv has joined #crystal-lang
<FromGitter> <jrei:matrix.org> Ho, @HertzDevil has been promoted to a crystal-lang member?
<FromGitter> <Blacksmoke16> i think he just has the `triage` role
<FromGitter> <jwaldrip:matrix.org> device sessions reaches out to an appium server to get the list of sessions. I am trying to hit hundreds at ones to async the list gen
<FromGitter> <jwaldrip:matrix.org> I could do a device times though
<FromGitter> <jwaldrip:matrix.org> thats a good suggestion
<FromGitter> <Blacksmoke16> I don't think it would matter but worth a shot
<FromGitter> <Blacksmoke16> Main issue is related to the http requests in the fiber if i had to guess
<FromGitter> <Blacksmoke16> Hard to say without reducing it tho
<FromGitter> <jwaldrip:matrix.org> zero issues on the alpine container
<FromGitter> <jwaldrip:matrix.org> which is interesting
<FromGitter> <jwaldrip:matrix.org> it really shouldnt be that much data tbh
<FromGitter> <Blacksmoke16> Oh interesting
<FromGitter> <Blacksmoke16> Hmm
sagax has quit [Ping timeout: 268 seconds]
<FromGitter> <jwaldrip:matrix.org> ``````
<FromGitter> <jwaldrip:matrix.org> whats the best way to limit the number of requests?
ur5us has joined #crystal-lang
ua_ has quit [Ping timeout: 256 seconds]
ua_ has joined #crystal-lang