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
kevinsjoberg has quit [Ping timeout: 240 seconds]
kiwiroy has quit [Ping timeout: 240 seconds]
kevinsjoberg has joined #crystal-lang
kiwiroy has joined #crystal-lang
Liothen has quit [Ping timeout: 245 seconds]
r0bby has quit [Ping timeout: 245 seconds]
r0bby has joined #crystal-lang
Liothen has joined #crystal-lang
ur5us_ has joined #crystal-lang
ur5us_ has quit [Remote host closed the connection]
ur5us has joined #crystal-lang
ur5us has quit [Ping timeout: 245 seconds]
notzmv has quit [Ping timeout: 268 seconds]
notzmv has joined #crystal-lang
notzmv has quit [Ping timeout: 240 seconds]
notzmv has joined #crystal-lang
hightower2 has quit [Ping timeout: 265 seconds]
hightower2 has joined #crystal-lang
<FromGitter> <Dan-Do> I have a GC statistic like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/crystal-lang/crystal?at=61a214b7b5ba9e5a11da6635]
<FromGitter> <Dan-Do> Is it high in the `@total_bytes`?
hightower2 has quit [Ping timeout: 240 seconds]
hightower2 has joined #crystal-lang
hightower2 has quit [Ping timeout: 260 seconds]
hightower2 has joined #crystal-lang
<SamantazFox> <paulocoghi> "Is LibreSSl ready for Quic?" <- no. None of the major SSL libraries have planned to support QUIC yet. that's why there is a plethora of forks like BoringSSL, quictls/openssl, and others, on which QUIC libraries rely.
<SamantazFox> Also, OpenSSL has plans for the future (understand, in a long time, they haven't finished the 3.0 migration yet) where they would implement a complete QUIC client, rather than just a crypto API for QUIC.
postmodern has joined #crystal-lang
<postmodern> how would you define a class that accepts an optional generic type? would you pass in Nil or something?
<FromGitter> <Dan-Do> You can look at `Slice(T)`, we can use `Slice` (without T)
<FromGitter> <Blacksmoke16> you cant have an optional generic type, best bet would be to define the common logic in a module/parent class and have generic and non-generic implementation
<FromGitter> <christopherzimmerman> @Dan-Do you can only do that in cases where the generic type can be implied. It’s not optional.
<FromGitter> <Dan-Do> Yeah πŸ‘
<postmodern> good to know!
<postmodern> so why does String lack `#swapcase`?
<postmodern> hmm also i wish the compiler was smart enough to handle block type invariants. compiler is complaining that i'm passing `Proc(String,String)` where `&block : Proc(String,String) | Proc(Nil,String) | Nil` is accepted
<postmodern> also find it odd that String#sub(string,&block) doesn't define the signature of &block
<yxhuvud> postmodern: You need to upcast in that case, `proc.as(Proc(String,String) | Proc(Nil,String) | Nil)` or something like that. But you may want to do something to size down that union type, as that trinary choice is not very nice.
<postmodern> yxhuvud, i'm trying to caputre the combined type signature of blocks passed to String#sub.
<postmodern> appears you can do "str".sub(pattern) { replace }
<postmodern> and "str".sub(pattern) { |match| match + replace }
<yxhuvud> passing a union type involving nil looks weird though, as I don't see how a method with &block can ever not get a block passed
<yxhuvud> the sub variants seems to be a jungle though, not going to dig deep into that now.
<postmodern> hmm `.as()` it isn't working `expected a function type, not (Proc(String) | Proc(String, String) | Nil)`
<postmodern> you are right about the `| Nil`, since i'm also using overloading for a method that accepts `(pattern : String, replace : String)` and `(pattern : String, &block : Proc(String,String) | Proc(String))`
<yxhuvud> any call without a block probably calls another of the 4711 different sub signatures
<postmodern> ah it seems i can't do `&@block : Proc(...)`
<postmodern> hmm no, that's not it
hightower3 has joined #crystal-lang
hightower2 has quit [Ping timeout: 268 seconds]
<FromGitter> <naqvis> just found an interesting finding that `Free Variables` take precedence over `No Annotation` ⏎ https://carc.in/#/r/ccoc
greenbigfrog has quit [Ping timeout: 245 seconds]
greenbigfrog has joined #crystal-lang
greenbigfrog has quit [Ping timeout: 240 seconds]
greenbigfrog has joined #crystal-lang
taupiqueur has joined #crystal-lang
<postmodern> what does `Error: expected block type to be a function type, not (Proc(String) | Proc(String, String))` exactly mean? I am trying to & pass a literal ->(match) { ... } object to a method's &block
<postmodern> oh wait, do i have to define override methods for each type of &block ?
<postmodern> hmm compiler gets confused by block argument arity if i do that
<FromGitter> <Blacksmoke16> can you make a playground link?
<postmodern> will have to reduce my code down to a minimal example
jhass|off is now known as jhass
<FromGitter> <naqvis> postmodern: you can’t type restrict block param with Proc union. You will have to define overload method
<postmodern> naqvis, i tried defining overrides, but then the compiler complained about block arity (giving 1, expected 0). do you have any advice for that?
taupiqueur has quit [Remote host closed the connection]
taupiqueur has joined #crystal-lang
<FromGitter> <naqvis> type restrict block param
<FromGitter> <naqvis> def test(&block : Proc1)
<FromGitter> <naqvis> def test(&block : Proc2)
<FromGitter> <naqvis> block without type restriction is treated as arity 0
ur5us has joined #crystal-lang
<postmodern> i have things like (String -> String) for Proc1 and (-> String) for Proc2. Not sure if that's the proper syntax?
<FromGitter> <Blacksmoke16> the first yields and returns a string, the second doesnt yield anything but returns a string
<postmodern> i should write up that self-contained example for carcin
hightower3 has quit [Ping timeout: 250 seconds]
ur5us has quit [Ping timeout: 240 seconds]