<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 :-)
<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
<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
<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]