ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.30.1 | 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> <Blacksmoke16> https://crystal-lang.org/api/master/HTTP/Client.html#connect_timeout=(connect_timeout:Number)-instance-method
<ukd1> Blacksmoke16, no - i'm deliberatly holding it open; I need to know when the other end (client) disconnects from the server
<FromGitter> <Blacksmoke16> hm im not sure
_whitelogger has joined #crystal-lang
<FromGitter> <asterite> named tuple has a limit to avoid that infinite recursion. There's no real limit I think for defining a named tuple with more than 300 elements, but I can't see a use case for that. Named tuple represent argument methods and should be used like that. And I can't imagine passing 300 arguments to a method. Plus Hash will work equally fine, or the performance will be probably be negligible
ukd1_ has joined #crystal-lang
ukd1 has quit [Ping timeout: 246 seconds]
early has quit [Quit: Leaving]
early has joined #crystal-lang
early has quit [Ping timeout: 246 seconds]
early has joined #crystal-lang
<FromGitter> <rmarronnier> Thanks @asterite for the detailed answer. ⏎ ⏎ > Named tuple represent argument methods and should be used like that ⏎ ⏎ Ok, this makes sense now. [https://gitter.im/crystal-lang/crystal?at=5d785a98d5c7bd57946f6d3b]
<companion_cube> asterite: why not have a recursion limit on the specializer instead?
<companion_cube> or syntactic criteria (ie uniform or ground specialization)
alex`` has quit [Ping timeout: 245 seconds]
chemist69_ has joined #crystal-lang
chemist69 has quit [Ping timeout: 246 seconds]
<companion_cube> did anyone consider enabling github sponsors for crystal
<companion_cube> ?
<FromGitter> <galvertez> anybody know if `@[AlwaysInline]` works if the method yields? it seems like something that would be ignored if a method yields but i'm not sure and i'm curious
<FromGitter> <galvertez> i don't figure there's any way to tell (easily)
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
absolutejam4 has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 240 seconds]
absolutejam4 has joined #crystal-lang
gangstacat has joined #crystal-lang
<FromGitter> <Daniel-Worrall> You've been able to sponsor Crystal on Github since its release.
absolutejam4 has quit [Ping timeout: 240 seconds]
absolutejam4 has joined #crystal-lang
gangstacat has quit [Quit: Ĝis!]
gangstacat has joined #crystal-lang
sorcus has joined #crystal-lang
absolutejam4 has quit [Ping timeout: 246 seconds]
absolutejam4 has joined #crystal-lang
<FromGitter> <bew> @galvertez i think it should work too
alex`` has joined #crystal-lang
hightower2 has joined #crystal-lang
coderobe has joined #crystal-lang
coderobe has quit [Client Quit]
coderobe has joined #crystal-lang
<FromGitter> <asterite> galvertez a method that yields is always inlined, that annotation has no effect in that case
DTZUZO has quit [Ping timeout: 258 seconds]
<FromGitter> <mavu> If I want (read: have to) do HTTPS with crystal, what should be my first choice?
<FromGitter> <mavu> Add a server in front of my software? (i.e. nginx handles ssl)
<FromGitter> <mavu> or do it in cryatal "natively"?
<FromGitter> <mavu> Or in other words: Is HTTPS in crystal nice, easy and secure enough, or is it something you use when you have no other options?
<FromGitter> <straight-shoota> Crystal's `HTTP::Server` can do HTTPS but, it's not a very sophisticated webserver overall. It's designed to provide a framework for building an application server. For production apps, I'd recommend to always put it behind a reverse proxy like nginx . It offer way more features and greatly improves the performance and safety of your HTTP application.
<FromGitter> <Daniel-Worrall> You
<FromGitter> <Daniel-Worrall> Best practice is to build it behind a reverse proxy like nginx and if you need the security from the app passing it to
<FromGitter> <Daniel-Worrall> (My thumb hates me)
<FromGitter> <Daniel-Worrall> And if you need the security from app to proxy you can use https on the app too as Johannes said
<FromGitter> <mavu> ok, thanks. ⏎ my webserver is just a tiny configuration UI tacked on a service, so thats why i'm undecided which way to go.
<FromGitter> <mavu> nginx is not a problem, but an additional package to install and configure. ⏎ on the other hand that would require no rebuilding/new release of hte main serrvice.
<FromGitter> <mavu> I think I'll toss a coin.
<FromGitter> <mavu> Hmm. could someone point me to an example of a HTTPS server in crystal? ⏎ the documentation only lists the TCPServer variant, and I'm not sure how I start a HTTPserver on a existing TCPServer?
<FromGitter> <Daniel-Worrall> pass the tls: true option
<FromGitter> <Daniel-Worrall> I know Kemal uses http server and it just has the certs passed in from launch args but idk about Stalin
<FromGitter> <Daniel-Worrall> Stdlib
<FromGitter> <mavu> Ahhh. found it, I was looking in the wrong place. thankd
<FromGitter> <bew> @asterite about inlining for methods that yields, I know the block is inlined in the method, but the method is always inlined too??
<companion_cube> Daniel-Worrall: hmm it only redirects to external sites, I was thinking of the new sponsorship within github
<FromGitter> <Daniel-Worrall> External sites are linked up with things and github sponsor handles providing the external links. /shrug
Raimondi has quit [Quit: WeeChat 2.5: ¡Chau!]
alex`` has quit [Ping timeout: 258 seconds]
alex`` has joined #crystal-lang
Raimondi has joined #crystal-lang
<FromGitter> <asterite> @bew I'm not sure I understand the question. If you have a method that does `a = 1; yield a; puts a + 2` and you call that passing the block, that entire code, including the block, is inlined in the parent method
<FromGitter> <asterite> that's why `5.times { ... }` is exactly equivalent to `i = 0; while i < 5; ...; i += 1; end`
<FromGitter> <asterite> I guess you asked whether `i = 0; i < 5; etc.` isn't inlined, but it is. The block can `return` so the entire method that yields must be inlined in the caller
<FromGitter> <Daniel-Worrall> Is there any way I can cast a custom class? ⏎ ⏎ ```class Foo(T) ⏎ @bar : T? ⏎ end ⏎ Foo(String).new.as(Foo(Int32))``` [https://gitter.im/crystal-lang/crystal?at=5d790cd4ae44a84124bd2d8c]
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/7jlj
<FromGitter> <Blacksmoke16> whats the use case?
<FromGitter> <Daniel-Worrall> Casting an Event(AllTypes) to Event(Specific) or the other way around, so I can integrate with EDA to emit an "all events" signal
<FromGitter> <Daniel-Worrall> so AllTypes would be an alias union
<FromGitter> <Blacksmoke16> what if you include a module into each and listen on that module
<FromGitter> <Blacksmoke16> otherwise afaik no you cant since `Foo(Int32)` isnt the same thing as `Foo(String)`
<FromGitter> <Daniel-Worrall> Well
<FromGitter> <Daniel-Worrall> `Foo(String | Int32) to Foo(String)`
<FromGitter> <Daniel-Worrall> or backwards
<FromGitter> <Daniel-Worrall> is my use case
<FromGitter> <Blacksmoke16> still dont think you could
<FromGitter> <Daniel-Worrall> I don't think I *should* do including on each since then I'm registering on every specific class and removing it will be harder
<FromGitter> <Daniel-Worrall> or impossible
<FromGitter> <Blacksmoke16> im not sure i follow
<FromGitter> <Blacksmoke16> if the goal is to emit something that all "children" will react to that would be idea no?
<FromGitter> <Blacksmoke16> ideal
<FromGitter> <Blacksmoke16> while still being able to emit single class events
<FromGitter> <Daniel-Worrall> yes, but then there'd be the same proc for each, but with their own handler id
<FromGitter> <Daniel-Worrall> which I'd have to store since I'm trying to abstract it away for the user
<FromGitter> <Blacksmoke16> seems you cant subscribe to a parent type anyway
absolutejam4 has quit [Ping timeout: 268 seconds]
<FromGitter> <Daniel-Worrall> https://carc.in/#/r/7jm3
<FromGitter> <Daniel-Worrall> How bad of an idea is this
ht_ has joined #crystal-lang
<FromGitter> <asterite> My guess is that you probably don't need Foo to be generic. `bar` should be the union of all types and that's it
<FromGitter> <Daniel-Worrall> Ah yeah, but I still need to put Foo(Klass)
<FromGitter> <Daniel-Worrall> otherwise, even if I specify it to use a union, it just falls back to a string
<FromGitter> <Daniel-Worrall> ty boios
<FromGitter> <Daniel-Worrall> ```p foo = nil ⏎ foo``` ⏎ ⏎ assignment inside a puts/p/pp breaks playground [https://gitter.im/crystal-lang/crystal?at=5d79190d3b1e5e5df1918fbd]
<FromGitter> <Daniel-Worrall> oops
<FromGitter> <Daniel-Worrall> think a dupe of https://github.com/crystal-lang/crystal/issues/7091
DTZUZO has joined #crystal-lang
<FromGitter> <bew> @asterite i see thanks, missed the early return case 👌
<FromGitter> <bew> TIL https://carc.in/#/r/7jn9 this is cool
<FromGitter> <bew> you can declare a top level module from inside some other module
Human_G33k has joined #crystal-lang
<FromGitter> <naqvis> how to `xor` value? for example in some languages you can do `^var` to retrieve the value. assuming `v = 5` output would be `-6`
<FromGitter> <Blacksmoke16> dont you need another value to do it with?
<FromGitter> <Blacksmoke16> i.e. `5 ^ 12`
HumanGeek has quit [Ping timeout: 244 seconds]
<FromGitter> <naqvis> yeah in that case it works, but how to do `bitwise xor` of same value?
<FromGitter> <naqvis> or what it called `^x bitwise complement`
<FromGitter> <bew> ah `~v` iirc
<FromGitter> <naqvis> aah
<FromGitter> <Blacksmoke16> wow thats not documented at all
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/Int.html#~-instance-method
<FromGitter> <Blacksmoke16> lol
<FromGitter> <naqvis> thanks @bew
<FromGitter> <Blacksmoke16> not in the api docs tho
<FromGitter> <naqvis> yeah, couldn't find that as well
<FromGitter> <Blacksmoke16> would make a good doc PR 😉
<FromGitter> <naqvis> 😆
<FromGitter> <bew> indeed, no doc, funny it's implemented as `self ^ -1`
<FromGitter> <Blacksmoke16> heres a question for you @bew
<FromGitter> <Blacksmoke16> so im working on how to implementing exclusion strategies for the serializer
<FromGitter> <Blacksmoke16> by default the group/version strategies will be supported
<FromGitter> <Blacksmoke16> however im thinking how to best implement a way for people to add their own custom strategies
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
<FromGitter> <Blacksmoke16> option 1 - have some class like ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d7934b92f93ab5a1546be28]
<FromGitter> <Blacksmoke16> option 2 - just have people reopen the serialize method and then call `previous_def` ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=5d7934f2ae44a84124be5682]
<FromGitter> <Blacksmoke16> (it'll prob be a module in the end vs Object)
<FromGitter> <Blacksmoke16> i think i like option 2 more, since its easier as you have access to the actual obj being serialized, i.e. ivars/annotations etc
<FromGitter> <Blacksmoke16> plus can override it on a per obj basis as well
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
early has quit [Ping timeout: 268 seconds]
early has joined #crystal-lang
sagax has quit [Quit: Konversation terminated!]
sagax has joined #crystal-lang
absolutejam4 has joined #crystal-lang
hightower2 has quit [Ping timeout: 245 seconds]
<FromGitter> <Blacksmoke16> is there a reason why the call doesnt have any location info? https://play.crystal-lang.org/#/r/7jnt \cc @asterite
return0e_ has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
return0e has quit [Read error: Connection reset by peer]
return0e has joined #crystal-lang
ua_ has quit [Ping timeout: 245 seconds]
ua_ has joined #crystal-lang
alex``` has joined #crystal-lang
alex`` has quit [Ping timeout: 246 seconds]
ht_ has quit [Quit: ht_]
livcd has quit [Remote host closed the connection]
absolutejam4 has quit [Ping timeout: 240 seconds]
absolutejam4 has joined #crystal-lang
<FromGitter> <watzon> `previous_def` is supposed to call the original method right? So if I extend a class and override one of the methods, calling `previous_def` within that method should call the original?
<FromGitter> <watzon> Maybe I'm misunderstanding what it's for
<FromGitter> <absolutejam_gitlab> yeah
absolutejam has joined #crystal-lang
<FromGitter> <watzon> Ahh right, it's for monkeypatching
<FromGitter> <watzon> not extending
<FromGitter> <absolutejam_gitlab> it's equivalent to `super` in other languages?
<FromGitter> <absolutejam_gitlab> I'd say it's fine for extending
<FromGitter> <watzon> It doesn't work for what I'm trying to do
absolutejam4 has quit [Ping timeout: 245 seconds]
<FromGitter> <watzon> https://carc.in/#/r/7jo6
<FromGitter> <watzon> What I need to do is call the method that I'm overloading, but on the other class
<FromGitter> <watzon> Ideally without creating an instance of the class I'm extending
<FromGitter> <watzon> I'd think super would work, but it doesn't either https://carc.in/#/r/7jo7
absolutejam1 has joined #crystal-lang
absolutejam has quit [Ping timeout: 246 seconds]
<FromGitter> <Blacksmoke16> @watzon its just `super`
<FromGitter> <Blacksmoke16> https://carc.in/#/r/7joa
<FromGitter> <watzon> Lol well there we go
<FromGitter> <watzon> Thanks
<FromGitter> <Blacksmoke16> np
absolutejam1 has quit [Ping timeout: 245 seconds]
alex``` has quit [Ping timeout: 246 seconds]
alex``` has joined #crystal-lang