ChanServ changed the topic of #crystal-lang to: The Crystal programming language | | Fund Crystal's development: | GH: | Docs: | Gitter:
<FromGitter> <> @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> <> 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> <> mfiano ( 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 ... []
<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? ⏎ ⏎ ``` do |target_response|``` []
<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 ( and is a job scheduler very much like Sidekiq, It has a nice set of features and a dashboard UI ( ⏎ ⏎ Features: ⏎ ⏎ ```code paste, see link``` [h
<FromGitter> ... ttps://]
<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``` []
<FromGitter> <> Hmm, lack of parallel assignment just caused me to debug for hours
<FromGitter> <Blacksmoke16> oh?
<FromGitter> <> Yeah, this is wrong, and not the assignment operator I want
<FromGitter> <Blacksmoke16> wew, that looks like a pita
<FromGitter> <> 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> <> 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> <> Yeah I tried that first, but it doesn't give the expected results for an array lookup
<FromGitter> <> It's still not parallel in this case
<FromGitter> <> @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> <> no it';s the receiver
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <> 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> <> no idea
<FromGitter> <> Same thing in Nim. those a/b assignments are just to pass the structs by value
<FromGitter> <> But using classes here
<FromGitter> <asterite> what's the problem? a, b, or into are the same ones so the data gets overwritten?
<FromGitter> <> The latter. into can actually be the reciever, shared structure with A
<FromGitter> <> So I need to do all the assignments at once, rather than serially
<FromGitter> <> Which implies temporary storage and a mess of this already messy method
<FromGitter> <> I wish there was something like `psetf` from Lisp :)
<FromGitter> <> It's just a macro. Might be able to add it at some point
<FromGitter> <> 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> <> 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> <> There is no error
<FromGitter> <> 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> <> or any other of the 16
<FromGitter> <> 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> <> 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> <> 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> <> 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> <> Hmm
<FromGitter> <> 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> <> 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> <> 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> <> 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> <> this is a new one `malloc(): unsorted double linked list corrupted` what causes this.
<FromGitter> <Blacksmoke16> nice
<FromGitter> <> lol... thanks?
<FromGitter> <Blacksmoke16> np :P
<FromGitter> <> 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> <> anything to do with this...
<FromGitter> <> ``````
<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> <> Ho, @HertzDevil has been promoted to a crystal-lang member?
<FromGitter> <Blacksmoke16> i think he just has the `triage` role
<FromGitter> <> 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> <> I could do a device times though
<FromGitter> <> 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> <> zero issues on the alpine container
<FromGitter> <> which is interesting
<FromGitter> <> it really shouldnt be that much data tbh
<FromGitter> <Blacksmoke16> Oh interesting
<FromGitter> <Blacksmoke16> Hmm
sagax has quit [Ping timeout: 268 seconds]
<FromGitter> <> ``````
<FromGitter> <> 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