jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.18.4 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
Philpax has joined #crystal-lang
sp4rrow has joined #crystal-lang
pawnbox_ has quit [Remote host closed the connection]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
Philpax has quit [Ping timeout: 246 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
sp4rrow has joined #crystal-lang
willl has joined #crystal-lang
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
ponga has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pochito has joined #crystal-lang
pawnbox has joined #crystal-lang
pochito has quit [Ping timeout: 250 seconds]
willl has quit [Quit: Connection closed for inactivity]
pawnbox has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
zodiak_ has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 252 seconds]
sp4rrow has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
sp4rrow has quit [Quit: Textual]
toydestroyer has quit [Remote host closed the connection]
toydestroyer has joined #crystal-lang
zodiak has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
sandelius has joined #crystal-lang
pawnbox has joined #crystal-lang
trapped has joined #crystal-lang
snsei has quit [Remote host closed the connection]
trapped has quit [Read error: Connection reset by peer]
trapped has joined #crystal-lang
xaxes` has quit [Ping timeout: 250 seconds]
ponga has quit []
ponga has joined #crystal-lang
steenuil has quit [Ping timeout: 276 seconds]
steenuil has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Philpax has joined #crystal-lang
Philpax has quit [Ping timeout: 244 seconds]
trapped_ has joined #crystal-lang
trapped has quit [Ping timeout: 240 seconds]
miketheman has quit [Quit: ZNC - http://znc.in]
miketheman has joined #crystal-lang
miketheman has quit [Client Quit]
miketheman has joined #crystal-lang
miketheman has quit [Client Quit]
miketheman has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
Philpax has joined #crystal-lang
snsei has joined #crystal-lang
snsei has quit [Remote host closed the connection]
snsei has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 258 seconds]
willl has joined #crystal-lang
trapped_ has quit [Read error: Connection reset by peer]
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/voH3d
<crystal-gh> crystal/master 59ca015 Ary Borenszweig: Merge branch 'release/0.18'
Philpax has quit [Ping timeout: 246 seconds]
<travis-ci> crystal-lang/crystal#9fa3eec (release/0.18 - Fixed #2916: Wrong overload matching for metaclasses): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/140364260
pawnbox has joined #crystal-lang
<travis-ci> crystal-lang/crystal#59ca015 (master - Merge branch 'release/0.18'): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/140364265
pawnbox has quit [Ping timeout: 240 seconds]
<crystal-gh> [crystal] mhib opened pull request #2917: Fix Char::Reader#pos documentation (master...master) https://git.io/voHGi
<crystal-gh> [crystal] jhass pushed 1 new commit to master: https://git.io/voHGN
<crystal-gh> crystal/master f5ebc44 Jonne Haß: Merge branch 'release/0.18'
<crystal-gh> [crystal] jhass closed pull request #2917: Fix Char::Reader#pos documentation (master...master) https://git.io/voHGi
pawnbox has joined #crystal-lang
pawnbox_ has joined #crystal-lang
pawnbox has quit [Read error: Connection reset by peer]
<travis-ci> crystal-lang/crystal#f5ebc44 (master - Merge branch 'release/0.18'): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/140370014
qard has joined #crystal-lang
<travis-ci> crystal-lang/crystal#752cb3c (release/0.18 - Fixed Char::Reader#pos documentation): The build passed. https://travis-ci.org/crystal-lang/crystal/builds/140370021
qard has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<RX14> jhass, i finished documenting SIzed and Delimited, what should be the namespace for the multipert stuff?
<jhass> HTTP?
<RX14> because it's not technically HTTP, it's mime
<jhass> mmh
<jhass> but then we have no SMTP or idk no anything else where mime is used tbh
<RX14> i think it would be acceptable to put it under http
<RX14> but it is used in email too
<jhass> yes, we can still move it for some time when it starts to get used somewhere else
<RX14> hmmn
<RX14> HTTP::Multipart::PullParser?
<RX14> because
<jhass> I thought we decided against the pull parser interface?
<RX14> well
<RX14> idk
<RX14> i feel that it's the root interface everything can build on
<jhass> just HTTP::MultipartBody or so?
<RX14> it's harder to build a reentrant parser on top of a block-based parser
<jhass> what do you mean?
<RX14> if say we wanted to build a parser that needed to be a pull parser
<RX14> it's harder to do that on top of a block based parser
<jhass> I don't follow which usecase your missing from yielding a IO::Delimited for each part
<jhass> *you're
<RX14> jhass, i just feel like it's not too hard to just make it a pull parser anyway
ruslux has joined #crystal-lang
<jhass> well by now I think it's too easy to write invalid code upon it
<jhass> and any valid usages I can come up don't benefit from such an interface
<RX14> well what if someone wants a upll-parsed string-based interface
<jhass> I don't follow
<RX14> what don't you follow?
<jhass> what a "pull parsed string based interface" is at all in this context
<jhass> some pseudo code might clear things up :)
<RX14> if someone wants to have a pull interface to the parser where it returns string
<RX14> instead of an IO
<RX14> a pull parser is the lowest common denominator
<jhass> it's a gets_to_end call on the IO away....
<RX14> yes but the block makes it hard
<jhass> the blocks makes it hard to write invalid code
<jhass> any valid code needs to consume the IO before getting the next one
<jhass> thus any valid code needs to store
<RX14> it amkes it hard to make a non-block-based interface on top without using fivers
<RX14> fibers*
<jhass> .map(&.gets_to_end) #=> array of all parts as strings
<RX14> yes but then thats not streaming
<jhass> I feel like you're ignoring my point :)
<RX14> so what if it's eas to write code that produces an exception
<RX14> you could say the same with slices sometimes
<jhass> this is already invalid
<jhass> and we have no way to raise
<RX14> jhass, yes we do
<RX14> the next call will close the image IO
<RX14> meaning the image.read will throw
<RX14> cause it's closed
<RX14> we need to keep a handle to the old IO anyway to read it until the delimiter
<jhass> the next problem with the example it actually should handle order
<RX14> jhass, yeah, well that doesn't have to do with that problem
<RX14> i think we should make the actual parser a pull parser even if we :nodoc: it and make the only visible interface a block-based one
<RX14> just because i think it's easier to make a lazy body parser that way
<jhass> I don't see how it's any easier?
<RX14> because sometimes you want to read the response in bits
<RX14> in different method calls
<RX14> this way FORCES you to read all the parts in one block
<RX14> you can't just say no i've found what i wanted but i might want to come back later
<RX14> that requires you to write your code a certain way
<jhass> well, I'm not convinced of either I guess
<RX14> there's nothing especially hard or dangerous about having it be a pull parser
<RX14> so why not?
<RX14> the multi-fiber behaviour is the same as any other IO
<jhass> I can only repeat my point, it's terribly easy to write code that'll raise at runtime. A block based API makes it _very_ obvious that storing the IO somewhere for later is a _bad_ idea
<RX14> and the closing the last stream returned when we call next means it's just going to throw
<RX14> jhass, thats why I said make the main interface that
<jhass> well go ahead I guess
<RX14> but some people want to do "dangerous" things, and I can think up of many use-cases the block-based model removes
<jhass> you'd buy me easier if you could come up with some more realistic usecase than "I might want to do something (what's this something?) else between reading two parts"
<jhass> so far you haven't provided one of those many usecases
<RX14> a pull-based parser based on strings is entirely reasonable, but it's impossible to do effciently with the block based interface
<RX14> you would need one fiber that writes the tuples from the block to a channel then the next method gets one form that channel
<jhass> I think I still have no clue what a "pull based parser based on strings" is in your mind
<RX14> like the json pull parser
<RX14> like the original idea
<RX14> before streams
<RX14> a pull parser that returns headers and body as a string
<jhass> whether i do that between two .next calls or within the block body, I don't see the difference
<RX14> what we had before the bounded IO happened
<RX14> jhass, the difference is that you can encapulate that in a class
<RX14> and call next in two different method calls
<RX14> a block-based interface only lends itself to the final consumer
<jhass> sorry I just don't understand you and I don't think I will without pseudo code
<RX14> not any intermediate wrapper classes
<jhass> so either go ahead like I already said it'd be ok
<jhass> or if you do want to discuss it further I can only ask you for some pseudo code
<RX14> how do you build an interface like that with a block?
<jhass> okay, that's convincing, thank you. However give me a minute I have a compromise
<jhass> next idea: require a block on the next call: https://p.jhass.eu/3l.cr
<jhass> consume & close the io in it's ensure
<RX14> yeah i guess that works
<RX14> it's the same thing anyway
<jhass> yes but discourages storing the io
<RX14> yeah i guess a little
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 240 seconds]
Raimondii is now known as Raimondi
<RX14> jhass, did you benchmark your cicular buffer implementation?
<jhass> no, not yet
<jhass> I think I'd like to benchmark in something more real worldy, that is if I can just drop it into your finished multipart stuff
<RX14> also, could you eliminate a memory copy by creating a slice that points to the single byte you want to read in the buffer and passing that to @io.read?
<RX14> s/buffer/ring
<jhass> RX14: I don't think so?
<jhass> oh, wait
<jhass> mmh
<jhass> yeah I guess
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<jhass> RX14: problem is I only want to copy the oldest ring value to the caller if there was a successful read
<jhass> and if I read to the ring directly I overwrite the oldest value
<RX14> hmmn
<jhass> mmh, or do I
<jhass> what did I get specs for, let's experiment a bit
<jhass> mh no that starts to skip stuff again on single byte reads by the caller
sandelius has quit [Quit: Textual IRC Client: www.textualapp.com]
_jungh4ns has joined #crystal-lang
<RX14> jhass, anything i need to add to the docs: https://github.com/RX14/crystal/tree/feature/multipart/src/io
<jhass> https://github.com/RX14/crystal/blob/feature/multipart/src/io/delimited.cr#L10 I'd show that a second call doesn't return anything anymore
<RX14> mnnph
<RX14> isnt that expected IO behaviour?
<jhass> it is, but sometimes documenting the obvious still makes things clearer ;)
<jhass> also not sure how well we handle missing closing codefences
<RX14> ah
<RX14> oops
<jhass> same suggestion for Sized
<RX14> it worked
<jhass> but that should be enough otherwise :)
<RX14> jhass, fixed
Raimondi has quit [Quit: All hail WeeChat 1.5-dev!]
<RX14> jhass, is accessing class variable more expensive than local variables in crystal?
<RX14> my java background is telling me it's expensive
<jhass> good question, I have no idea
<jhass> I would assume it's as expensive as accessing globals
<jhass> because that's what they are, namespaced globals
<RX14> in high-performance java code methods often create local copies of class variables
<RX14> that are used often
<RX14> because it's that expensive
<jhass> well I'm not sure the JVM is comparable here
<RX14> and my insticts tell me to do that in crystal bit it's probably wrong
<jhass> it has to keep them in some hashmap or so
<RX14> i'm just so used to it heh
<RX14> jhass, uhh, really?
<RX14> oh
<RX14> the jvm does
<jhass> yes
<RX14> i don't think that does either
<RX14> i mean
<RX14> the number of class variables are known when it allocates the memory
<RX14> so it can just create a memory layout per class i expect
<jhass> well let it be a heap blob with known offsets
<RX14> i think it does some special thread safety stuff idk
ruslux has quit [Ping timeout: 250 seconds]
<RX14> ok well i have an untested implementation of multipart parsing with the new stream ops
<RX14> just need to write specs now
<RX14> night
qard has joined #crystal-lang
Philpax has joined #crystal-lang
Raimondi has joined #crystal-lang
Philpax has quit [Ping timeout: 246 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]