<FromGitter>
<jwoertink> Out of curiosity, why is there no String#length?
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
zodiak has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
zodiak_ has quit [Ping timeout: 276 seconds]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
ponga has joined #crystal-lang
snsei has quit [Remote host closed the connection]
Oliphaunte has quit [Remote host closed the connection]
Oliphaunte has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
sp4rrow has quit [Client Quit]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
pawnbox has joined #crystal-lang
Oliphaunte has quit [Remote host closed the connection]
<BlaXpirit>
jwoertink, because aliases are not wanted; .size is used
snsei has quit [Remote host closed the connection]
sp4rrow has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 258 seconds]
<FromGitter>
<sdogruyol> :+1: for size
<FromGitter>
<ttdonovan> New to Crystal but have been working with Ruby for many years - as my introduction to Crystal I’m attempting to port over a few of the dry-rb gems. Coming from a dynamicly interpreted language I’ve struggled a bit with understanding how to do things the Crystal way. If anyone have feedback or would like to help it would greatly be appreciated https://github.com/dry-cr. Thanks.
<FromGitter>
<sdogruyol> @ttdonovan welcome!
<FromGitter>
<sdogruyol> nice job on porting those :+1:
<FromGitter>
<ttdonovan> I like what the dry-rb community is doing and wanted to share the love with Crystal. They are far from complete with plenty of TODOs but hoping others might get invovled so I can learn from them as well.
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
zodiak_ has joined #crystal-lang
zodiak has quit [Ping timeout: 258 seconds]
<FromGitter>
<sdogruyol> That's great to hear
<FromGitter>
<sdogruyol> @ttdonovan are you enjoying Crystal yet?
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 264 seconds]
snsei has joined #crystal-lang
snsei has quit [Ping timeout: 258 seconds]
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox_ has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
bjz has joined #crystal-lang
bjz has quit [Ping timeout: 260 seconds]
bjz has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 252 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
trapped has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 244 seconds]
trapped has quit [Read error: Connection reset by peer]
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 250 seconds]
pawnbox has joined #crystal-lang
qard has joined #crystal-lang
Oliphaunte has joined #crystal-lang
Oliphaunte has quit [Ping timeout: 240 seconds]
<crystal-gh>
[crystal] michaeldesu opened pull request #2901: Minor changes as per email in google groups (gh-pages...gh-pages) https://git.io/voyGb
<ysbaddaden>
hello, I'm trying to hack HTTP2 support into HTTP::Server, but all I get is: "constant WHATEVER requires initialization of HTTP2::WHATEVER, which is initialized later" because of an IO ;-(
<ysbaddaden>
the only solution I see is "get rid of all constants" but that's not gonna happen
<jhass>
huh, not sure I follow
<ysbaddaden>
I need an IO object in HTTP::Server::Response to write to he HTTP2 streams
<ysbaddaden>
problem is, whenever I create such an IO object, it depends on HTTP2::Stream that in turn depends on all HTTP2/HPACK constants
<ysbaddaden>
but crystal tries to resolve constants and all IO classes at the same time, and eventually fails
<ysbaddaden>
constant OpenSSL::BIO::CRYSTAL_BIO requires initialization of HTTP2::DEFAULT_MAX_FRAME_SIZE, which is initialized later. Initialize HTTP2::DEFAULT_MAX_FRAME_SIZE before OpenSSL::BIO::CRYSTAL_BIO
<jhass>
Is there some code to poke at?
onec has quit [Remote host closed the connection]
<ysbaddaden>
if I hack CRYSTAL_BIO to be a @@crystal_bio, then it fails with "constant Logger::DEFAULT_FORMATTER requires initialization of HTTP2::DEFAULT_MAX_FRAME_SIZE" and so on
<ysbaddaden>
the problem is having an IO class writing to a HTTP2::Stream, because all of a sudden whatever depends on an IO type also depends on HTTP2::Stream which in turn depends on everything under HTTP2
<ysbaddaden>
Crystal fails resolving constants that depend on IO (eg: CRYSTAL_BIO, Logger::FORMATTER, and most certainly STDOUT, ...) because it requires other constants to be already resolved
<FromGitter>
<ttdonovan> @sdogruyol yes I'm enjoying it greatly, the Ruby-like syntax has made it easy to get started - just need to better understand a few other concepts when working with a static typed and complied language
<FromGitter>
<sdogruyol> @ttdonovan that's great to hear and I am pretty sure that you gonna love it more and more :) Having a compiler is great
<j2k>
jhass: it was my own stupidity
Philpax has quit [Ping timeout: 276 seconds]
<jhass>
ysbaddaden: maybe we can do a first pass that initializes them for all primitives, tuple, named tuple, int's, float's, bool, char, perhaps string
<jhass>
should even be okay to do proc
pochito has joined #crystal-lang
ysbaddaden has quit [Ping timeout: 250 seconds]
snsei has quit [Remote host closed the connection]
<asterite>
oh, he's gone. I'll try to fix it, I was going to do it for 0.19 but maybe I can do it for 0.18.5
<asterite>
jhass: did ysbaddaden leave a note on how to reproduce the problem? I checked out the branch and everything works fine
<jhass>
asterite: run h.cr
<asterite>
ah, good
<asterite>
I think there's a check in the compiler that's old now... because recursive constant definition check is already done in a different place, and constants are either lazily initialized or initialized when the codegen reaches the line when they are initialized
<asterite>
I removed that check and now it compiles... I'll run a few more tests to see if something breaks, but I think I can fix it for 0.18.5 \o/
<jhass>
that is HTTP::Headers should internally store the http 2 normalized variant, allow fetch via both and have "to_h" that outputs with HTTP 1 formatting
<ysbaddaden>
for now, I made HPACK lowercase the header name... and it works \o/
<ysbaddaden>
that depends on what's more frequent: HTTP1 or HTTP2, the later isn't very available, yet
<jhass>
well I guess it's easy to change at some point
<ysbaddaden>
yup
<jhass>
but it should handle both and have "output modes" for either
<jhass>
and I'd make the http2 variant the recommended client code access variant already
64MAAIAT7 has quit [Remote host closed the connection]
<FromGitter>
<anlek> @jhass, interested, how would one use it via HTTP?
<jhass>
HTTP::Server by default spawns a coroutine for each client connection
<jhass>
HTTP::Client you can safely use inside spawn
<jhass>
well, multiple instances of it anyway
<FromGitter>
<anlek> Hmm, I am having a hard time wrapping my head around my problem and fit to HTTP::Client. I'm looking for something similar to: https://github.com/AF83/em-eventsource (as my source is using this along with EventMachine)
<FromGitter>
<anlek> I wonder if that would just be an HTTP::Client. So http::client == EventMachine::EventSource.new("http://example.com/streaming")
<jhass>
just read from it in your main fiber (the toplevel) and spawn new fibers to process the responses
<FromGitter>
<anlek> hahah, totally, except my knowledge of fibers is... well... let's just say low :)
<jhass>
or keep a pool of fibers to process the responses and send them new work over a channel
<jhass>
read the document I linked you ;)
<FromGitter>
<anlek> Will do! I'll reach out if I get a bit closer (or really stuck). Thanks for your time!
<jhass>
so from a quick look you just event = parse_event(response.body_io.gets("\r\n\r\n")); spawn process_event(event)
<FromGitter>
<anlek> And this is inside the HTTP::Client, yes?
<jhass>
yes, inside a get() do end
<jhass>
The stream must then be parsed by reading everything line by line, with a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR) character, and a single U+000D CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character being the ways in which a line can end.
<jhass>
ugh, common W3C
<FromGitter>
<anlek> Cool, thanks! :)
<jhass>
so since both, lf and crlf is valid you have to read line by line and aggregate until you see a blank line :/
<jhass>
might be actually fastest to keep the lines of each event in an array then actually
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<FromGitter>
<anlek> hehe, I'll see what I get in from the service
<crystal-gh>
[crystal] ysbaddaden opened pull request #2909: OpenSSL: get selected ALPN protocol (master...openssl-get-alpn-selected) https://git.io/voSSn
srabuini has joined #crystal-lang
soveran has joined #crystal-lang
sebasr has quit [Ping timeout: 272 seconds]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #crystal-lang
<crystal-gh>
[crystal] jhass pushed 2 new commits to master: https://git.io/voSHo
<crystal-gh>
crystal/master 97011f3 Julien Portalier: OpenSSL: get selected ALPN protocol
<crystal-gh>
crystal/master 2f7ad67 Jonne Haß: Merge branch 'release/0.18'