ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.32.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
<FromGitter> <manveru> or you can just statically compile it anyway, if you want to distribute it without nix
<FromGitter> <manveru> i really love that about crystal
<FromGitter> <j8r> except it is a bit broken :(
<FromGitter> <j8r> (no stack traces)
<FromGitter> <manveru> true that...
<FromGitter> <manveru> just never write a program that can crash :D
<FromGitter> <tenebrousedge> this is an excellent idea
<FromGitter> <manveru> (I really wish crystal had no exceptions and only option types...)
<FromGitter> <tenebrousedge> \>_<
<FromGitter> <tenebrousedge> this is a less excellent idea
<FromGitter> <manveru> lol
<FromGitter> <Blacksmoke16> anyone else think its kinda strange to have the response of an http request always exist?
<FromGitter> <Blacksmoke16> versus like, newing up an `Event` yourself
<FromGitter> <Blacksmoke16> er
<FromGitter> <Blacksmoke16> `Response`
<FromGitter> <manveru> i also find it strange that requests with multipart files always make tempfiles...
<FromGitter> <manveru> but well, i guess it's written to be super convenient for the most usual use-cases
<FromGitter> <Blacksmoke16> guess the solution for me would be to just close the response when its done
<FromGitter> <Blacksmoke16> and key off that if i should return early
<FromGitter> <Blacksmoke16> but the downside is there it would return the response immediately, maybe i should add a new property to it, like `finished : Bool = false`?
<FromGitter> <manveru> omg, i just noticed firefox finally has websocket inspector again
<FromGitter> <manveru> that only took a decade...
<FromGitter> <bew> @manveru how to use `buildCrystalPackage`? ⏎ Tried to do a minimal one: ⏎ ⏎ ```code paste, see link``` ⏎ ... [https://gitter.im/crystal-lang/crystal?at=5df81e357d382b523f8d8171]
<FromGitter> <manveru> yeah, you can use the same `src = lib.sourceFilesBySuffices ./. [".cr"];`
<FromGitter> <manveru> otherwise it won't know where to find the `hello.cr`
<FromGitter> <bew> but in crystal2nix how does it do it? https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/crystal/crystal2nix.nix there is no `src` attr
<FromGitter> <manveru> it sets the `unpackPhase`
<FromGitter> <manveru> that's the one usually complaining about missing `src`, since it tries to unpack it :)
<FromGitter> <bew> aah ok, I get it
<FromGitter> <bew> aaand I don't have gcc as a dep.... what is this magic... x)
<FromGitter> <manveru> gonna get some sleep now, cya :)
<FromGitter> <bew> 👋
ur5us has quit [Ping timeout: 248 seconds]
ur5us has joined #crystal-lang
<FromGitter> <Blacksmoke16> is there no way to tell if a request was sent via http or https?
<FromGitter> <tenebrousedge> I would assume that you could do that. Via the port if nothing else
<FromGitter> <christopherzimmerman> Look at the protocol on the request if it’s anything like node.
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df832640dc628523e4b0d09]
<FromGitter> <Blacksmoke16> dont really have any of that
<FromGitter> <tenebrousedge> why is `uri` nil?
<FromGitter> <Blacksmoke16> looks like its lazily evaluated and not exposed anyway
<FromGitter> <tenebrousedge> that seems like a malformed request then?
<FromGitter> <Blacksmoke16> shouldnt be
<FromGitter> <tenebrousedge> well, that or the remote address should have `http` or `https` in there. It doesn't look like it stores the protocol separately
<FromGitter> <Blacksmoke16> would be nice to have the scheme in there
<FromGitter> <tenebrousedge> probably. Why do you need it?
<FromGitter> <Blacksmoke16> refactoring my cors listener
<FromGitter> <Blacksmoke16> if the origin header is present and it matches the scheme/host of the request cors isnt needed
<FromGitter> <tenebrousedge> can't you just assume http if not present?
<FromGitter> <Blacksmoke16> possibly
<FromGitter> <Blacksmoke16> still wouldnt know if its https or not tho
<FromGitter> <tenebrousedge> well, if it's not in the request, then I don't see how it could be https
<FromGitter> <Blacksmoke16> probably more of a server thing
<FromGitter> <tenebrousedge> but shouldn't it fail either way if it doesn't match?
<FromGitter> <Blacksmoke16> if they dont match then it should do the CORs stuff
<FromGitter> <Blacksmoke16> just is a little optimization
<FromGitter> <tenebrousedge> the server definitely knows what port it's listening on
<FromGitter> <Blacksmoke16> yea ill prob have to get it off there
<FromGitter> <Blacksmoke16> ill worry about it later
<FromGitter> <nsuchy> @Blacksmoke16 You could run your app behind nginx and pass an X-Schema header and include http or https from the proxy
<FromGitter> <nsuchy> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df842f6e47fb31eb7c60f82]
<FromGitter> <nsuchy> We do like this at ulayer
<FromGitter> <nsuchy> where app is a docker container named app running amber on 8080
<FromGitter> <nsuchy> we can check X-Forwarded-Proto easily
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 248 seconds]
DTZUZO has quit [Ping timeout: 246 seconds]
DTZUZO has joined #crystal-lang
ur5us has quit [Ping timeout: 265 seconds]
ur5us has joined #crystal-lang
ht_ has joined #crystal-lang
ht_ has quit [Quit: ht_]
ur5us has quit [Ping timeout: 248 seconds]
<FromGitter> <kefahi> Hello, is there a way to delegate a method invocation to the subclass? (the exact opposite of "super")
Flipez2 has joined #crystal-lang
confact_ has joined #crystal-lang
Nekka_ has joined #crystal-lang
masterdonx2 has joined #crystal-lang
chachasmooth_ has joined #crystal-lang
snapcase_ has joined #crystal-lang
cpt_yossarian has joined #crystal-lang
davic_ has joined #crystal-lang
bougyman_ has joined #crystal-lang
gangstacat has quit [*.net *.split]
Nekka has quit [*.net *.split]
chachasmooth has quit [*.net *.split]
DeBot has quit [*.net *.split]
woodruffw has quit [*.net *.split]
MasterdonX has quit [*.net *.split]
livcd has quit [*.net *.split]
commavir has quit [*.net *.split]
Flipez has quit [*.net *.split]
davic has quit [*.net *.split]
adam12 has quit [*.net *.split]
bougyman has quit [*.net *.split]
confact has quit [*.net *.split]
snapcase has quit [*.net *.split]
t1|Mike has quit [*.net *.split]
Nekka_ is now known as Nekka
confact_ is now known as confact
davic_ is now known as davic
gangstacat has joined #crystal-lang
gangstacat has quit [Remote host closed the connection]
gangstacat has joined #crystal-lang
ur5us has joined #crystal-lang
livcd_ has joined #crystal-lang
ur5us has quit [Ping timeout: 248 seconds]
bougyman_ has quit [Ping timeout: 250 seconds]
bougyman has joined #crystal-lang
<FromGitter> <dscottboggs> @Blacksmoke16 `request.url.scheme` doesn't work?
bougyman has quit [Ping timeout: 246 seconds]
bougyman has joined #crystal-lang
<FromGitter> <Blacksmoke16> `undefined method 'url' for HTTP::Request`
<FromGitter> <Blacksmoke16> `uri` is private method if that was a typo
<FromGitter> <Blacksmoke16> @dscottboggs
<FromGitter> <Blacksmoke16> @nsuchy not a bad idea
<FromGitter> <Blacksmoke16> either way the uri wouldnt have the scheme since its being parsed from the resource, which in this cast is just the path
Flipez2 is now known as Flipez
DTZUZO has quit [Read error: Connection reset by peer]
DTZUZO has joined #crystal-lang
return0__ has joined #crystal-lang
return0e has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> looks like symfony either grabs it from the Proto header if the request was from a valid configured proxy, otherwise defaults to some server level config value
<FromGitter> <Blacksmoke16> will make that a future optimization as id need to support some configuration around trusted proxies and stuff
<FromGitter> <Daniel-Worrall> Hmm is there a way I can take a certain amount of steps in an iterator block? `next` will only go once, and I'd like to skip over some things without having to test them
<FromGitter> <Daniel-Worrall> for example ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df8ee620616d6515e55d53a]
<FromGitter> <Daniel-Worrall> I can come up with a way how to do this with an iterator without the block
<FromGitter> <Daniel-Worrall> but this reads a lot better
<FromGitter> <Blacksmoke16> `next if num >= 10 && num <= 19`
<FromGitter> <Daniel-Worrall> but that involves testing those cases
<FromGitter> <Blacksmoke16> maybe just remove those numbers before iterating then
<FromGitter> <Daniel-Worrall> I won't know what to remove without iterating with the guard clause
<FromGitter> <Daniel-Worrall> I just want to be able to skip over x amount of times in an iterator, since I'll know in advance they'll fail the check
<FromGitter> <Daniel-Worrall> but only once reaching the one before it
<FromGitter> <Daniel-Worrall> I don't think there's a way
<FromGitter> <alehander92> is the problem in performance
<FromGitter> <alehander92> or just in code elegance
<FromGitter> <Daniel-Worrall> both?
<FromGitter> <Daniel-Worrall> in my limited case, performance doesn't matter, but it'd be a nice thing to have in my toolkit for when performance does matter
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/87q4
<FromGitter> <Daniel-Worrall> like this... is ugly
<FromGitter> <kinxer> @Daniel-Worrall https://carc.in/#/r/87qc ?
<FromGitter> <Daniel-Worrall> that's still testing the cases
<FromGitter> <Daniel-Worrall> and iterating twice
<FromGitter> <Daniel-Worrall> Does any lang even have the feature I'm thinking of lol
<FromGitter> <kinxer> Is it iterating twice? I thought iterators evaluated lazily.
<FromGitter> <kinxer> They seem much less useful if they don't.
<FromGitter> <Daniel-Worrall> well it's iterating once to know what to reject, then iterating again to print
<FromGitter> <kinxer> I had assumed it was rejecting as it iterated in `#each`, which is what I expect and want from an iterator.
<FromGitter> <Daniel-Worrall> you gave it 2 blocks
<FromGitter> <Daniel-Worrall> so I *think* it's twice
<FromGitter> <kinxer> ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df8fe63f1cc6c27ea66848a]
<FromGitter> <Daniel-Worrall> the important part is that it's still testing those elements
<FromGitter> <kinxer> Calling `Iterator#reject` wraps the iterator in this struct.
<FromGitter> <kinxer> So it does check as it iterates.
<FromGitter> <Daniel-Worrall> ah, okay
<FromGitter> <Daniel-Worrall> but it would still check
<FromGitter> <kinxer> Yeah, it's going to do the check on every element, but that's true in https://carc.in/#/r/87q4, too.
<FromGitter> <Daniel-Worrall> I don't think so, it'll call next 10 times without making the conditional check
<FromGitter> <Daniel-Worrall> What I'm thinking is if the conditional is an expensive calculation, I want to skip over as many as I can
<FromGitter> <kinxer> Ah, that's true.
<FromGitter> <kinxer> So there could be a performance penalty if you're skipping a ton of elements and/or the check is really expensive.
<FromGitter> <Daniel-Worrall> `next` gets the next element, which I'd prefer to avoid too.
<FromGitter> <Daniel-Worrall> I could probably write a function on iterator that does what I want actually
<FromGitter> <kinxer> I mean, it seems like a reasonable use case for`Enumerable` to skip the `n`th element to the `m`th element.
<FromGitter> <kinxer> In an ideal world, it would never be necessary because all inputs would be well-formed and useful, but that's not the world we live in.
<FromGitter> <alehander92> but you can always do something like each_with_index and do a cheap check
<FromGitter> <alehander92> probably possible to make more elegant with some abstraction
DTZUZO has quit [Ping timeout: 268 seconds]
DTZUZO has joined #crystal-lang
ht_ has joined #crystal-lang
cpt_yossarian has quit [Ping timeout: 248 seconds]
woodruffw has joined #crystal-lang
<FromGitter> <johnpyp> Is there a way to manage decimal unicode encoding/decoding?
<FromGitter> <johnpyp> i.e `ord()` and `chr()` in python
<FromGitter> <Blacksmoke16> pretty sure they're already a thing
<FromGitter> <johnpyp> Oh man, I completely missed those
<FromGitter> <johnpyp> thanks
<FromGitter> <Blacksmoke16> np
<FromGitter> <christopherzimmerman> My brain feels like mush after porting all of this over, `Num.cr` now has `einsum`: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5df91e11e47fb31eb7cc069a]
Yxhuvud has quit [Read error: Connection reset by peer]
<FromGitter> <watzon> From numpy?
<FromGitter> <watzon> Damn you had to do a whole parser for that huh?
<FromGitter> <christopherzimmerman> I couldn't really use numpy as inspiration since they have a bunch of macro stuff done in C that adds a ton of overhead I don't need.
<FromGitter> <christopherzimmerman> Plus they don't really optimize any of the contraction paths, so I think I can do a lot better with that as well.
<FromGitter> <randiaz95> guys, god bless Crystal
<FromGitter> <randiaz95> <3
<FromGitter> <randiaz95> i can't believe you guys are working on einsum in crystal
<FromGitter> <randiaz95> Are you guys good at tensor algebra?
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
ur5us has joined #crystal-lang
watzon has quit [Quit: WeeChat 2.7]
Yxhuvud has joined #crystal-lang
<FromGitter> <watzon> I'm sure now
<FromGitter> <watzon> But @christopherzimmerman seems to be ok at it
ht_ has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 246 seconds]
DTZUZO has joined #crystal-lang
ur5us_ has joined #crystal-lang
ur5us has quit [Read error: Connection reset by peer]