jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.4 | 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
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
blue_deref has quit [Quit: bbn]
fowlduck has quit [Remote host closed the connection]
strcmp2 has joined #crystal-lang
strcmp1 has quit [Ping timeout: 252 seconds]
sadin has quit []
ponga has quit []
<crystal-gh> [crystal] hugoabonizio opened pull request #950: Fix a typo (master...patch-1) http://git.io/vqgSr
fowlduck has joined #crystal-lang
fowlduck has quit [Ping timeout: 256 seconds]
NeverDie has joined #crystal-lang
fowlduck has joined #crystal-lang
fowlduck has quit [Ping timeout: 248 seconds]
willl has quit [Quit: Connection closed for inactivity]
fowlduck has joined #crystal-lang
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
fowlduck has quit [Remote host closed the connection]
willl has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: http://git.io/vq20f
<crystal-gh> crystal/master b013da7 Hugo Abonizio: Fix a typo...
<crystal-gh> crystal/master 1340439 Ary Borenszweig: Merge pull request #950 from hugoabonizio/patch-1...
fowlduck has joined #crystal-lang
fowlduck has quit [Ping timeout: 246 seconds]
BlaXpirit has joined #crystal-lang
<travis-ci> manastech/crystal#1340439 (master - Merge pull request #950 from hugoabonizio/patch-1
fowlduck has joined #crystal-lang
unshadow has joined #crystal-lang
unshadow has quit [Quit: leaving]
strcmp2 has quit [Ping timeout: 256 seconds]
asterite has joined #crystal-lang
<asterite> jhass: I now think carc.in is, like, the best tool for sharing code snippets and quickly answering questions about a language. So, again, thanks :-)
<jhass> asterite: yw
<jhass> so you're staying in prague for the week?
<asterite> yes, going back on Sunday morning
<jhass> nice, lovely city from what I've heard
<asterite> Indeed! Very colorful and nice
<asterite> And the food is delicious
<jhass> hehe
<jhass> btw, still seeking a nice alternative to this idiom http://carc.in/#/r/6bf
asterite has quit [Ping timeout: 246 seconds]
shadeslayer has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
shadeslayer has joined #crystal-lang
asterite has joined #crystal-lang
<asterite> jhass: like this? http://carc.in/#/r/6pa
<asterite> Because of parsing issues you can't do ->Size.new.call(String), but we could make it work with ->(Size.new).call(String)
<asterite> I know it's not that direct, but the intent might be more clear... and it's simpler to implement (just do nothing :-P)
<asterite> However, I do agree that it's not "ok" according to the duck typing philosophy of the language
<jhass> mmh
<asterite> and you only need to specify the type there, so... there's definitely room for improvement
<asterite> Or your idea is to automatically try to convert that by looking at the "call" method?
<jhass> well, I'm not sure yet ;)
<jhass> I somehow didn't think about getting the pointer
<asterite> :)
<asterite> I liked your answer in google groups
<jhass> I think that's good enough, since you should be able to def add(foo); @cbs << ->foo.call(String)
<asterite> I feel like you somehow grasped the philosophy of the language really well... now we only need to write it down somewhere so everyone knows it
<jhass> and add ->(s : String) { }; and add Size.new
<asterite> jhass: true, maybe if you can add this callbacks with a method than you can have an overload with a block and one without it and place the ->foo.call(String) there, so type annotations are reduced
<jhass> well, I can make the block overload just call the non block overload for now
<asterite> jhass: and now you made me wonder if taking a pointer to a proc is possible, and... http://carc.in/#/r/6pc
<asterite> I guess not :-D
<asterite> Should probably be a nop in that case
<jhass> aw, yeah
<jhass> should just return self
<jhass> but I think that would be a good solution to that idiom
luislavena has joined #crystal-lang
<asterite> jhass: one talk here was about how threads are not a good concurrency primitive, https://twitter.com/asterite/status/617999733429260288
<asterite> once the video is out I'll let you know and I hope you watch it and, eventually, rewrite DeBot to use fibers ;-)
<jhass> sure, but they're well understood
<asterite> (of course, once we have all the concurrency primitives in place... like select)
<jhass> I'm kinda hesitant also because it's not distributed across a thread pool yet, so a single handler can block the entire queue
<asterite> Right, but maybe in a few years fibers will also be, but be more efficient and simple
<jhass> and I've some stuff that breaks in that case (handlers waiting for certain events)
<asterite> but blocking IO will schedule that fiber to the runtime and choose another fiber that's ready
<asterite> so even in a single thread you shouldn't have problems, unless you block in the CPU
<jhass> well, I guess I could rewrite that with the channel stuff... but still
<jhass> I'd like to have it as an option regardless, as said doesn't need to be in stdlib
<jhass> and DeBot works well with the current design, so if it's available as external library I can likely just plug that in
<asterite> Ok :-)
<asterite> BTW, some people ask us if we use crystal in production
<asterite> Of course the answer is "no", but I also mention debot and carc.in
<jhass> http://carc.in/#/r/6if should I open an issue for this one (just found it while skipping through but nobody reported anything afaik)?
<asterite> Like, they seem to work well, always online, perform well, etc.
<jhass> I should add some monitoring to the box for carc.in
<asterite> jhass: yes, please report it
asterite has quit [Quit: Page closed]
fowlduck has quit [Remote host closed the connection]
strcmp1 has joined #crystal-lang
fowlduck has joined #crystal-lang
jhass has quit [Ping timeout: 248 seconds]
thor77 has quit [Ping timeout: 248 seconds]
thor77 has joined #crystal-lang
jhass has joined #crystal-lang
unshadow has joined #crystal-lang
NeverDie has joined #crystal-lang
<jbye> jhass: what was the conclusion regarding the conversion of json_mapping to Hash? :D
<jbye> there's no support for this currently right
<jhass> right
<jhass> I think Ary didn't feel like that's common enough to add to stdlib, or should be encouraged to do by adding it to stdlib
<jhass> iirc I had a solution that you could just include, so you could just offer such a module as a library if you want to share it across projects
<jbye> yeah I remember, thanks - I just come across this a lot when fetching JSON that I later want to pass to functions that take Hash as input
<jhass> you could JSON.parse(json) as Hash if you ain't gonna use the mapping
<unshadow> jhass: is casting JSON.parse(json) as Hash is valid ?
<jhass> yeah
<jhass> >> require "json"; hash = JSON.parse(%({"foo": "bar"})) as Hash; hash
<DeBot> jhass: # => {"foo" => "bar"} - http://carc.in/#/r/6pq
Kilo`byte has quit [Ping timeout: 256 seconds]
<unshadow> I was having an issue with crystal-toml, and it seems I'm the only one actually using it ^^ so I think about changing to json
<jhass> why not fix it :(
<unshadow> jhass: https://github.com/manastech/crystal-toml/issues/3 I'm terible at string manipulation, I dont even know why this is happeinig
<strcmp1> unshadow, probs no reply cos they're in prague doing a talk
<unshadow> strcmp1: Yeha I heard :) it's ok, there is no rush , they should concentrate on the Convention ;)
Kilo`byte has joined #crystal-lang
<jhass> unshadow: TOML.parse is like JSON.parse, it gives you back a union of everything that can be
<jhass> (conf["sites"] as Hash).each do |site, params|
<jhass> params again being the union
lokulin has quit [Ping timeout: 264 seconds]
<jhass> and that's just Hash#each
<jhass> in Ruby that yields an array which is then autosplatted in the block params if you specify more than one
<jhass> in Crystal no such thing, it yields the key and value as two parameters, if you specify one parameter you get only the first one, the key
<unshadow> Oh....
<unshadow> So I need to do something like |site, hash| ?
<jhass> yes, as per my example above...
<unshadow> jhass: I see, so this is not a bug, just a difference in the language and how it handels certian things
<jhass> yeah, basically the reason json_mapping is a ting in the first place ;)
<jhass> *thing
<unshadow> jhass: What about making a toml_mapping ? ;)
<jhass> sounds like a good plan
lokulin has joined #crystal-lang
fowlduck has quit [Remote host closed the connection]
<unshadow> jhass: Can you verify this is a bug and not a File System issue ? http://carc.in/#/r/6pw (I get the same behivior at my machine using Crystal-0.7.4
<jhass> unshadow: http://carc.in/#/r/6py well depends on viewpoint I guess
<jhass> I can imagine "flushing after every log call is too slow" as a valid one
agpelliza has joined #crystal-lang
shevy has joined #crystal-lang
<shevy> ohhhh
<shevy> dom96 is here \o/
<unshadow> jhass: well.... http://carc.in/#/r/6q3
<unshadow> it seems that without manual flushing it wont write
<jhass> the autoflush threshold is not time based http://carc.in/#/r/6q5
<crystal-gh> [crystal] bcardiff opened pull request #952: Use %i %w to determine the expected type of the array literal (master...empty-array-literals) http://git.io/vqwEu
jtarchie has joined #crystal-lang
<luislavena> anyone knows why ConditionVariable#wait spec is still commented out?
<luislavena> (marked as pending)?
<jhass> no idea, it works fine for me in crystal 0.6.1 :D
<luislavena> I was in the need to introduce a wait option with a timeout (for the connection pool) and noticed wait doesn't have
<luislavena> so was going to add timedwait impl
<luislavena> so was checking ;-)
fowlduck has joined #crystal-lang
asterite has joined #crystal-lang
fowlduck has quit [Ping timeout: 246 seconds]
<asterite> barachy: The problem with TOML is that it has way too many ways to represent things, and with just one parse you can't figure out what's coming next (I think). So I don't think it's easy (or even possible) to have something like toml_mapping. But we can try
asterite has quit [Client Quit]
shevy has left #crystal-lang ["I'll be back ... maybe"]
asterite has joined #crystal-lang
<jhass> unshadow: ^ ;d
<jhass> * ;D
<asterite> luislavena: I think those specs didn't work in one os, either mac or linux... or in travis, can't remember. In any case, please don't build abstractions over that as spawn and channel will take over everything :-)
asterite has quit [Client Quit]
<luislavena> ok, will leave timeout out of the equation for now, still don't understand spawn/channel to see how they will play on this :)
<jhass> I guess you'd treat channel as a queue and abuse that queue as a semaphore :P
<luislavena> yeah, that means will need to wait a bit more for documentation around spawn/channel :D
agpelliza has quit [Ping timeout: 264 seconds]
Ven has joined #crystal-lang
<jhass> what I mean is that you'd just push the available connections onto the queue (= Channel), pop to acquire and push again to release
<jhass> well, that's my guess
NeverDie has quit [Quit: I'm off to sleep. ZZZzzz…]
agpelliza has joined #crystal-lang
NeverDie has joined #crystal-lang
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]
Liothen has joined #crystal-lang
Liothen has joined #crystal-lang
Liothen has quit [Changing host]
fowlduck has joined #crystal-lang
fowlduck has quit [Ping timeout: 248 seconds]
luislavena has quit [Remote host closed the connection]
fowlduck has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eam has joined #crystal-lang
luislavena has joined #crystal-lang
sadin has joined #crystal-lang
DeBot has quit [Ping timeout: 256 seconds]
DeBot has joined #crystal-lang
luislavena has quit []
DeBot has quit [Quit: Crystal IRC]
DeBot has joined #crystal-lang
<jhass> DeBot: !hangman crystal
<DeBot> ␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ [] 0/12
<jhass> DeBot: #:_
<DeBot> ␣␣␣␣␣␣␣␣␣␣␣#␣␣_␣␣␣␣␣ [:] 1/12
<havenwood> DeBot: to
<DeBot> ␣t␣t␣␣␣␣␣␣␣#to_␣␣␣␣␣ [:] 1/12
<jhass> DeBot: ea
<DeBot> ␣tat␣␣A␣␣a␣#to_␣␣␣␣e [:] 1/12
<jhass> DeBot: ui
<DeBot> ␣tati␣A␣␣a␣#to_␣␣i␣e [:u] 2/12
<jhass> DeBot: sr
<DeBot> Stati␣Arra␣#to_s␣i␣e [:u] 2/12
<jhass> DeBot: cl
<DeBot> StaticArra␣#to_slice [:u] 2/12
<BlaXpirit> what could it be
<jhass> x!
<jhass> DeBot: y
<DeBot> StaticArray#to_slice [:u] 2/12 You won!
fowlduck has quit [Remote host closed the connection]
fowlduck has joined #crystal-lang
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
NeverDie has quit [Quit: Textual IRC Client: www.textualapp.com]
NeverDie has joined #crystal-lang
havenwood has joined #crystal-lang
BlaXpirit has quit [Quit: Konversation]
sadin has quit [Remote host closed the connection]
endou___________ has quit [Ping timeout: 248 seconds]
endou___________ has joined #crystal-lang
havenwood has quit [Ping timeout: 246 seconds]
havenwood has joined #crystal-lang