<BlaXpirit>
basically a list of reasons why formatter is detrimental
pawnbox has joined #crystal-lang
trapped has joined #crystal-lang
slash_quit is now known as slash_nick
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trapped has joined #crystal-lang
n1ftyn8_ has quit [Ping timeout: 240 seconds]
n1ftyn8_ has joined #crystal-lang
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ssvb has quit [Ping timeout: 240 seconds]
ssvb has joined #crystal-lang
trapped has joined #crystal-lang
<ytti>
how is select() implemented internally in langauges where it includes timeout?
<ytti>
i realized i don't know how to implement it
<ytti>
like Channel#select is blocking infinitely
<ytti>
if i were to implement timeout there, i'd do it with silly loop and sleep
<ytti>
but that introduces delay or busy loop
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trapped has joined #crystal-lang
<jhass>
fowlduck: some do use it for some production grade stuff already though, you just need to be okay with a fast moving target
<jhass>
ytti: same reason and and or are not a thing, remove redundancy in the language. Also indirection, not being a method call is less obvious than ! being one
<jhass>
ytti: modifer-while and modifier-unless sadly were removed over disagreements on how they should behave
<jhass>
er modifier-until I mean
<ytti>
jhass, not/! isn't really a biggy, i guess using not in ruby is not nice either ,due to awkward precedence
<jhass>
indeed
<ytti>
jhass, modifier while is big shame, i hope it makes comeback
<jhass>
you'll have to convince asterite & waj of it, let me get the issue
<ytti>
my expectiation is not to run body once, if while is false
<ytti>
so i'll <AOL> that
<jhass>
regarding the timeout for select, I guess it would work by adding a timeout to the event loop that sets a flag and reschedules the waiting fiber
fdisotto has quit [Quit: Konversation terminated!]
fdisotto has joined #crystal-lang
<ytti>
i'm trying to write something which does not iterate over array/hash/tuple uselessly
<ytti>
but will trigger only when needed
<ytti>
and without timeout in sleep, it becomes very complicated hard to understand
<ytti>
so i think i'll rather just make it simple and iterate periodicially instead of add lot of complexity for on-time triggering
<ytti>
with timeout in sleep, i could wait for new stuff, but stop sleep when anything from the previous ones would need to trigger
<jhass>
I'm not sure I follow
<ytti>
without select timeout, i'll need more coroutines and channels and it's jsut messy
<ytti>
yeah i don't blame you, it's very out-of-context explanation
<jhass>
btw your comment doesn't really take any previous discussion into account
<ytti>
take away is, timeout for select is super important :)
Excureo has joined #crystal-lang
ssvb has quit [Ping timeout: 250 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
ssvb has joined #crystal-lang
pawnbox has quit [Ping timeout: 260 seconds]
trapped has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
trapped has joined #crystal-lang
Bofu2U has quit [Ping timeout: 260 seconds]
Bofu2U has joined #crystal-lang
<omninonsense>
Is there a way to check in a macro something along these lines `{% if T.is_a? Number %}` to cover both `Float`s and `Int`s?
<omninonsense>
doesn't work if T is a template type
<omninonsense>
oh this works only on literals anyway
<jhass>
yeah
<omninonsense>
I hoped it was just named that
<omninonsense>
so, I'll basically need to check for each of the possible types?
<jhass>
maybe add some context?
<jhass>
not sure what you're doing
<omninonsense>
Hold on
<omninonsense>
http://carc.in/#/r/mmr essentially this gives nil all the time now (size_for_floats isn't defined in the example)
<omninonsense>
(I naively switched to == after is_a? didn't work, lol)
<jhass>
just step out of the macro language there, LLVM should optimize the condition away since it will be always truthy or falsy in the generated code
<jhass>
though I guess it would be kinda neat if we find a way to not compile at all instead of returning nil when calling .size on a non numeric range
<jhass>
or actually just super to Enumerable#size?
<jhass>
just because it's not numeric it doesn't mean it doesn't have a countable amount of elements
<omninonsense>
jhass: oh I know, I just tried to match ruby's behaviour, because Ruby returns nil
<omninonsense>
but originally it already does just use Enumerable#size anyway
<jhass>
hrm, class is missing stuff
<omninonsense>
Why did it even get to the "size_for_floats" part anyway, though? Shouldn't it have been clever enough to use `return nil unless ...` since String isn't a Number?
<[spoiler]>
jhass: is there a way to make a special Range(Float64, Float64)#size (and for Float32, too?) but meh this still breaks all other types that don't have a #succ
<jhass>
well, I kinda tried to do that with the macro def
<[spoiler]>
Oh i tried that with the macro too, but I didn't think that's what it would do
<RX14>
does a macro def get run for each type too?
<jhass>
"too"? I think it's probably the only thing that is
<crystal-gh>
[crystal] trapped closed pull request #1882: Add 'label' tag to HTML::Builder (master...master) http://git.io/v8H6f
Raimondi has quit [Quit: The road to wisdom?—Well, it's plain and simple to express: Err and err and err again, but less and less and less. — Piet Hein]
Liothen has quit [Quit: The Dogmatic Law of Shadowsong]