jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.11.1 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
theduke has joined #crystal-lang
AckZ has quit [Ping timeout: 240 seconds]
AckZ has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
bjz has quit [Client Quit]
bjz has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
tomchapin has joined #crystal-lang
tomchapin has quit [Client Quit]
A124 has quit [Quit: '']
A124 has joined #crystal-lang
arian0n- has joined #crystal-lang
BlaXpirit_ has joined #crystal-lang
asterite_ has joined #crystal-lang
Philpax_ has joined #crystal-lang
shadeslayer_ has joined #crystal-lang
jwaldrip_ has joined #crystal-lang
Excureo has quit [Remote host closed the connection]
Philpax__ has quit [*.net *.split]
shadeslayer has quit [*.net *.split]
asterite has quit [*.net *.split]
yxhuvud has quit [*.net *.split]
BlaXpirit has quit [*.net *.split]
arian0n has quit [*.net *.split]
Liothen has quit [*.net *.split]
jwaldrip has quit [*.net *.split]
tliff has quit [*.net *.split]
BlaXpirit_ is now known as BlaXpirit
asterite_ is now known as asterite
tliff has joined #crystal-lang
jwaldrip_ is now known as jwaldrip
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yxhuvud has joined #crystal-lang
Liothen has joined #crystal-lang
bjz has joined #crystal-lang
<travis-ci> manastech/crystal#96c0829 (master - Fixed and simplified zlib inflate and other related code): The build passed. https://travis-ci.org/manastech/crystal/builds/105810708
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ponga has quit []
tomchapin has joined #crystal-lang
theduke has quit [Quit: Leaving]
bjz has joined #crystal-lang
theduke has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
<adam12> Without send, is there another way I could call a method on an object where that method name is defined in some variable?
<adam12> I think a `case` statement will work here instead of `send`
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
triangles has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tomchapin has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 256 seconds]
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
Philpax_ has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
tomchapin has joined #crystal-lang
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tomchapin has joined #crystal-lang
tomchapin has quit [Client Quit]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
tomchapin has joined #crystal-lang
<jhass> theduke: a bit, nothing public and suspended for the moment
<jhass> adam12: yes, the usual way to solve send usecases is to use a case statement, possibly generated by a macro
Philpax has joined #crystal-lang
trapped has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
pawnbox has joined #crystal-lang
praveen has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<jokke> hello
<jokke> is it possible to somehow extract parts of a json as strings from an io with the pull parser for later use?
<jokke> my use case is this: i'm writing a parser for json-rpc. Every request has a method. depending on this method i want to instanciate the corresponding request class. each request class is responsible for parsing the params of the request (if any)
<jokke> the problem is: i could get a json like this {..., "params": {"foo": "bar"}, "method": "foobar"}
<jokke> in this case i wouldn't know the method at the time i should be parsing the params
<jokke> so i'm looking for a way to store the value of params as a string while skipping it for the time being
<jokke> after i've parsed the whole request object i could then pass the string to the request class instance corresponding to the method which would then parse the string
<jokke> i hope i made clear enough what i'm after
kulelu88 has joined #crystal-lang
praveen has quit [Remote host closed the connection]
praveen has joined #crystal-lang
<jhass> jokke: I'd parse twice
<jhass> first with a generic mapping that ignores the changing parts
<jokke> jhass: i can't since it's an io
<jhass> read it into a string first?
<jokke> it's a socket which remains open
<jokke> i need to read 1 json object at a time
<jokke> so i need the pull parser to tell me when i've read an object
<jokke> maybe it'd make sense to add some alternative skip method to the pull parser which would return the string of the skipped entity
<ytti> i'd love better docs how to turn JSON or YAML into crysytal structure
<ytti> the example in docs for YAML makes it non-obvious to me
<ytti> it works for simple case, but i don't get how to describe more common case, other than force type when evaluating
<ytti> i'd like to force type when loading
<ytti> i.e. fully describe whole JSON/YAML format, then populate the object
<ytti> http://crystal-lang.org/api/YAML.html - here, what if 'type: String' it's instead another Hash?
<ytti> it would be really cool if logged in useres could create user submitted examples for code, and vote up/down on them
pawnbox_ has joined #crystal-lang
praveen__ has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
praveen has quit [Ping timeout: 256 seconds]
praveen__ has quit [Ping timeout: 245 seconds]
tomchapin has quit [Quit: Textual IRC Client: www.textualapp.com]
tomchapin has joined #crystal-lang
praveen has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
<jokke> jhass: what do you think? https://gist.github.com/a0f3b6eb2ed89883b6f8
trapped has joined #crystal-lang
<jokke> ytti: look into YAML.mapping and JSON.mapping
<jokke> it's quite well documentde
<jokke> *documented
<ytti> jokke, the mapping in URL i pasted, does not make it clearly me, what happens if the key contains a hash
<jokke> oh ok. in that case you need to pass a converter
kulelu88 has quit [Quit: Leaving]
<jokke> that is basically just a class which needs to implement the class method from_yaml. OR you just define a YAML.mapping for that class (it will add the from_yaml method for you)
<jhass> jokke: you probably won't convince Ary of it, I'm not sure yet
<jokke> jhass: mmh
<jokke> i'd say it's a pretty common use case though
<jokke> i'd also think a JSON.mapping type :raw or something similar would be helpful (and would make use of the alternative skip method)
<jokke> but JSON.mapping is still not extendable by inheritage so i guess it's not that important
tomchapin has quit [Quit: Textual IRC Client: www.textualapp.com]
<jhass> jokke: I guess if anything it should return JSON::Any and mapping should be able to read from it
tomchapin has joined #crystal-lang
<jokke> mhm
<jokke> jhass: another thing: crystal-git failes to build on arch: https://p.jreinert.com/M05S/
<jhass> ugh sigh
tomchapin has quit [Client Quit]
<jhass> still not updated to llvm 3.7
<jhass> I'll see if I can be bothered to make it depend on llvm3.5
<jokke> hm i've got llvm35 installed
<jhass> huh?
<jhass> make sure to clean your src/ folder then
<jokke> kay
tomchapin has joined #crystal-lang
tomchapin has quit [Client Quit]
tomchapin has joined #crystal-lang
tomchapin has quit [Client Quit]
<jokke> jhass: that did the trick
tomchapin has joined #crystal-lang
tomchapin has quit [Client Quit]
tomchapin has joined #crystal-lang
praveen has quit []
pawnbox_ has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<jeromegn> Why doesn’t that work? https://play.crystal-lang.org/#/r/qu3
pawnbox has quit [Ping timeout: 240 seconds]
<jeromegn> well I more or less know why the second one doesn’t work
<jeromegn> that’s why I attempted other way to make it work
<jeromegn> I also tried: https://play.crystal-lang.org/#/r/qu8
<BlaXpirit> jeromegn, at least this works https://play.crystal-lang.org/#/r/qu9
<BlaXpirit> first one - can't put my finger on it..
<jeromegn> oh, interesting
<jeromegn> thanks
<BlaXpirit> it i were to guess, i'd say it would've worked
<BlaXpirit> but no
<BlaXpirit> if*
<BlaXpirit> works even without `as`
<jeromegn> yea, I just noticed that :)
<jhass> well the issue is that delegate doesn't forward the block
<jhass> so the last one without the as is the correct solution
<yxhuvud> is it a bug that it doesn't work or is it intentionally?
nakilon has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 264 seconds]
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
nakilon has quit [Quit: WHY NOT?]
nakilon has joined #crystal-lang
trapped has joined #crystal-lang
<jhass> well forwarding the block is hard I guess
<jhass> if not impossible in a generic matter atm
nakilon has quit [Quit: WHY NOT?]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
<jokke> is there a non-blocking receive method for channel?
sp4rrow has joined #crystal-lang
<jokke> @channel.receive unless @channel.empty? isn't thread safe
<sp4rrow> is there anything like named parameters in crystal?
<sp4rrow> I realize making some interfaces I love rubys implementation of named params
<jhass> jokke: just block your fiber and spawn another one for the other stuff?
<jhass> or you're looking for Channel.select?
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
trapped has quit [Quit: Textual IRC Client: www.textualapp.com]
trapped has joined #crystal-lang
krtv` has quit [Remote host closed the connection]
sp4rrow has quit [Ping timeout: 260 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
asterite_ has joined #crystal-lang
asterite has quit [Ping timeout: 240 seconds]
asterite_ is now known as asterite
triangles has quit [Quit: Leaving]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 250 seconds]
tomchapin has quit [Quit: Textual IRC Client: www.textualapp.com]