<mps>
j8r: thanks for info, will look tomorrow, now I'm upgrading production server so don't have time for it
<FromGitter>
<asterite> @aarongodin well, the current fiber will block until the http request finishes. That means that other fibers (that you spawn with `spawn`) can execute while the request is prepared
<FromGitter>
<asterite> same with everything else: the fiber where the IO happens blocks, but in the meantime other fibers can run
<FromGitter>
<dscottboggs_gitlab> So, I take it then that the `HTTP::Client.get` overloads with a block don't spawn by default?
<FromGitter>
<dscottboggs_gitlab> might be something to consider doign
<FromGitter>
<dscottboggs_gitlab> So, on the vein of @aarongodin's comments: If you do ⏎ ⏎ ```after the request ⏎ after yielding the fiber``` ⏎ ⏎ ...is there any way to asynchronously perform an HTTP request?? That seems kinda essential... [https://gitter.im/crystal-lang/crystal?at=5c71e5ca1f146304210da40a]
<FromGitter>
<dscottboggs_gitlab> shit sorry for the wall of text I'll delete it and post it in the forum
<FromGitter>
<aarongodin> so as I understand it then, if I wanted to run two http requests simultaneously I would be responsible for spawning around each of them
<FromGitter>
<dscottboggs_gitlab> ...yeah, apparently even that does not work :(
<FromGitter>
<aarongodin> 👀
<FromGitter>
<aarongodin> nice write up
<FromGitter>
<dscottboggs_gitlab> thanks :)
<FromGitter>
<dscottboggs_gitlab> I'm curious, what is the forum built on? Is there a forum engine in crystal yet?
<FromGitter>
<dscottboggs_gitlab> "Managed forum hosting from $100/month" holy shit that's expensive
<FromGitter>
<dscottboggs_gitlab> it's ruby?? how is it not slow??
<FromGitter>
<dscottboggs_gitlab> it's rails!
<FromGitter>
<fernandes> hi everyone, a question... I'm trying to use HTTP::Client to make a request that accepts gzip... but it's always printing the binary body... I've tried to use `Gzip::Reader`, but no success.. I've looked on specs, and nothing related to requesting a gzip... any idea? ⏎ ⏎ here is a gist showing an example: ⏎ ⏎ https://gist.github.com/fernandes/96c0835d67e305f88b10d7c19c308e98
<FromGitter>
<dscottboggs_gitlab> @fernandes I was gonna say that you should do something like https://carc.in/#/r/6cjt but that doesn't seem to be working
<FromGitter>
<fernandes> thanks, let me test here
<FromGitter>
<fernandes> is retuning this error: body was nil!
<FromGitter>
<fernandes> @body="\u001F\u008 but actually it isn't
<FromGitter>
<fernandes> I'm just missing something here
<FromGitter>
<fernandes> damm I'm so lazy hahah this is your else message
<FromGitter>
<fernandes> so yeah, body is nil
<FromGitter>
<proyb6> @dscottboggs_gitlab well, the popular dev.to site for programmer and Kickstarter crowd funding also use Rails
<FromGitter>
<girng> @dscottboggs_gitlab Yeah, that pricing is nuts
<FromGitter>
<girng> Example: At the end of the error code: `with types Int64, Tuple(Int64, Int64 | String, Int32 | Int64)`. It should be `Tuple(Int64, String, Int32)`?
<FromGitter>
<yeqf911> when crystal publish the version 1.0
laaron has quit [Remote host closed the connection]
laaron has joined #crystal-lang
<FromGitter>
<jgaskins> @girng Depending on `index`, you're potentially setting all of those values. The compiler can't determine which `indexX` variable you're setting, so the tuple you're generating (`{ index0, index1, index2 }`) could potentially contains an `Int64` in all three places. I think what you want instead of a method is a macro to be able to enforce that at compile time.
<FromGitter>
<girng> > The compiler can't determine which indexX variable you're setting ⏎ I was thinking the `new_value : tuple[0]` would help for that, as it falls back to the default value of that tuple
<FromGitter>
<girng> But yeah, I think you are right, macro is prob a way to do it
<FromGitter>
<jgaskins> The `if` statement is executed at runtime, but it needs to know the type at compile time
<FromGitter>
<girng> Oh, that's cool so the %var is a "variable macro"?
<FromGitter>
<jgaskins> Yeah, it's to avoid generated variable names conflicting with your own variables since macros get inlined. I think it compiles to `__temp_var_#{some_number_that_autoincrements}`.
<FromGitter>
<jgaskins> If you called that macro but already had `string` as a variable name, it would overwrite your variable if you don't include the `%`.
<FromGitter>
<jgaskins> Macros are sharp knives but the Crystal team do try to give us some safety equipment around them. :-)
<FromGitter>
<girng> Am curious @jgaskins, thanks for that playground! What does `%i64, %string, %i32 = {{tuple}}` do though, if the variables get put into the Tuple literal (return value) already?
<FromGitter>
<girng> Is it because of the if statements?
<FromGitter>
<jgaskins> Yep. It breaks the tuple into its parts, overwrites the variable specified by the `index` macro variable, and then assembles a new tuple. If someone specified the wrong index, they'll get an error like you saw before where the type of the tuple is wrong.
<FromGitter>
<jgaskins> So to make the macro more robust, you could specify `ItemTuple.new(%i64, %string, %i32)` to cause the compiler error to happen on the line that calls that macro.
<FromGitter>
<girng> Going to fiddle around with your macro for a little bit
<FromGitter>
<jgaskins> 💯
<FromGitter>
<girng> Grrr. Can't wrap my head around this, need to fiddle some more
<FromGitter>
<girng> @jgaskins I'm trying to do it a different way just so I can feel like i'm learning it better. https://play.crystal-lang.org/#/r/6coq/edit Any idea why this errors out? {{new_value}} works, but it won't let me do {{tuple[0]}}
<FromGitter>
<jgaskins> @girng Try `{{tuple}}[0]`
<FromGitter>
<girng> Oh that gets rid of that error, but I'm doing it wrong. I can't use = operator
<FromGitter>
<girng> Wow, fail. Let me try again
<FromGitter>
<jgaskins> Yeah, I was going to say I didn't think tuples were mutable
<FromGitter>
<girng> I swear, I get arrays mixed up with them too much 😆
<FromGitter>
<jgaskins> If they *could* mutate them, you could probably get away with `{{tuple}}[{{index}}] = {{new_value}}` being the entire body of the macro.
<FromGitter>
<girng> Thanks for staying with me, this is quite fun. I think i'm getting closer
<FromGitter>
<girng> Alright, I thought I had this, but got another error XD
<FromGitter>
<jgaskins> Sweet, yeah, once you start to get your mind used to the transition between compile-time code and runtime code, macros start making a *lot* more sense.
<FromGitter>
<girng> That error message though literally displayed what the macro was, that was cool as hell!
<FromGitter>
<jgaskins> In this case, `tuple` was a `Call` type according to the compiler error you got
<FromGitter>
<girng> Yeah, a lot of that stuff might be out of my league for now, but def will be useful in the future
ua has quit [Ping timeout: 246 seconds]
<FromGitter>
<girng> Now, my next goal is to write this another way, just for learning purposes!
<FromGitter>
<mavu> It helps me to see macros like something that happens before the code gets compiled. ⏎ Execute macros, then compile result. ⏎ Theoretically you should be able to see your generated code after macros are run with 'crystal tool expand' (at least that is what 'crystal -h' says) ⏎ But I don't know how to make it do something. [https://gitter.im/crystal-lang/crystal?at=5c72539e00aa630d9a0233ec]
<FromGitter>
<jgaskins> Yeah, it's a little awkward to use because you have to put the filename in twice. If you want to see the result of the macro on line 15, column 11 of `src/file.cr` expanded: `crystal tool expand -c src/file.cr:15:11 src/file.cr`
<FromGitter>
<mavu> ahh. that could do with a better description :)
<FromGitter>
<mavu> is it possible to have it output the whole expaned file?
ua has joined #crystal-lang
<FromGitter>
<jgaskins> That's something I would really like. I have no idea what the core team has in mind for that tool or if anyone's even thought about it in a while. :-D
<FromGitter>
<mavu> I second that. should not even be that hard, because it needs to exist to compile anyway.
<FromGitter>
<girng> Hmm. I wonder why this is showing a union for the types. I'm not using any conditions or anything really
<FromGitter>
<jgaskins> @girng Since the types are different for each iteration through the tuple, the type of the variable is the union of all of them. It's not the type of the slot in the tuple, but the type of the variable that eventually holds each one.
<FromGitter>
<girng> Okay, so the local variable's union does not necessarily equate to the value's union tupes
<FromGitter>
<girng> So, it's fair to say the local variable kinda has its own union of types (as you said, for each iteration it uses whatever)
<FromGitter>
<jgaskins> Yep. If you iterate over any collection type, the block variable will have the union of all types the collection contains.
<FromGitter>
<girng> O_O, wow! TIL
<FromGitter>
<jgaskins> It happens even if you don't iterate through the full collection at runtime since the types are detected at compile time https://play.crystal-lang.org/#/r/6crw
<FromGitter>
<girng> I see
lunarkitty has left #crystal-lang ["WeeChat 1.9.1"]
<mps>
I think we should wait few days to see what will libxml2 devs do about it, and after that discuss and decide what is best option for crystal on alpine
<mps>
straight-shoota: thanks for the help with the issue
<FromGitter>
<vladfaust> Too bad, it's black on my device
<FromGitter>
<j8r> I've a dark theme
<FromGitter>
<vladfaust> What is that? I honestly don't know anything about "dark theme"
<FromGitter>
<vladfaust> An url, please
<FromGitter>
<j8r> so by default all unset `color` are white
<FromGitter>
<j8r> and background black
<FromGitter>
<vladfaust> Got it
<FromGitter>
<vladfaust> Unfortunately, Crystal Jobs is not in the immediate to-dos list right now, gonna update it later
<FromGitter>
<j8r> usually people use classic white them, so default color is black (in your case) and white background :)
<FromGitter>
<j8r> don't worry, I can still write
<FromGitter>
<j8r> the `Description` section isn't hopefully affected :D
<FromGitter>
<vladfaust> I don't have an admin interface for jobs yet. I generate an admin JWT on server via SSH and update a job status via Postman
<FromGitter>
<vladfaust> Improvise, adapt
<FromGitter>
<vladfaust> Btw, I realize that I'm quite poor at explaining what my framework really is. It's very powerful, and proper docs take tons of time to describe all the features. I'm planning to have a streaming session where I'd create another blog JSON API with authorization. I'd answer questions and then put the stream on YouTube. Anyone interested in viewing?
<FromGitter>
<j8r> I don't know for others, for me examples are incredibly useful docs (if commented). Having a demo-app shows what your product is truly capable for real-life use
<FromGitter>
<Blacksmoke16> but id advise looking how i did it in my shard, you could even make a macro to create a similar dsl to what you want if you didnt want to use the annotations
<FromGitter>
<Blacksmoke16> i.e. each assertion has its own struct that implements the validation logic
<FromGitter>
<PlayLights_twitter> yes, don't worry, let me show you something
<FromGitter>
<vladfaust> I've approved it, thanks. Gonna play with MailChimp templates now and try to send the email on the list
<FromGitter>
<PlayLights_twitter> @j8r yeah, maybe I should just use some lines instead of one, Im complicating too much on this
<FromGitter>
<j8r> you can also have something like https://carc.in/#/r/6cxf @PlayLights_twitter
Jenz has joined #crystal-lang
<FromGitter>
<j8r> @vladfaust snap I've forgotten an `of` in `Be passionate Open Source` :(
<FromGitter>
<vladfaust> You can edit your job with the link sent to your email
<FromGitter>
<j8r> oh yeah, awesome!
<FromGitter>
<vladfaust> Indeed =)
<FromGitter>
<j8r> how can i save?
<FromGitter>
<Jens0512> @vladfaust "Do you like the new site design" ⏎ Absolutely love it!
<FromGitter>
<Jens0512> I'm learning CSS at school ATM, and I'm curious, do you use a css framework?
<FromGitter>
<j8r> the button "save" was hidden in the mobile version :/
<FromGitter>
<Blacksmoke16> @PlayLights_twitter im working on something as well, give me a min
<FromGitter>
<vladfaust> @Jens0512 hey, thanks. I do not use any CSS frameworks. However, I use SASS. The code for the website is available at https://github.com/onyxframework/web
<FromGitter>
<Blacksmoke16> not *exactly* the same dsl but quite close
<FromGitter>
<PlayLights_twitter> It is great
<FromGitter>
<PlayLights_twitter> Take my money haha
<FromGitter>
<PlayLights_twitter> Thanks so much
<FromGitter>
<vladfaust> > There is a compliance issue with this campaign. ⏎ ⏎ Cant use MailChimp for now, sorry. Hope it will be solved tomorrow
<FromGitter>
<PlayLights_twitter> @Blacksmoke16
<FromGitter>
<Blacksmoke16> np
<FromGitter>
<Blacksmoke16> find any issues with it hmu, i didnt look too far into it
<FromGitter>
<vladfaust> Greate approach, @Blacksmoke16 , like the carc
<FromGitter>
<Blacksmoke16> is similar to what i used for my shard but adding that macro to build out the validations for each property vs annotating each property