<FromGitter>
<mixflame> if anyone is into amber, can you please review pull request #1265 on amberframework/amber and tell me if you can spot any weaknesses? it's a multichannel redis adapter for websockets
<postmodern>
so what is the difference between .as(Int32) and .to_i32 ?
<FromGitter>
<Blacksmoke16> the former just tells the compiler to treat the values as an int32 without actually doing the conversion
<FromGitter>
<Blacksmoke16> i.e. pretty sure `.as` wouldn't handle over/underflows, so id deff use `.to_i32`, or really just `.to_i`
<FromGitter>
<Blacksmoke16> *BUT*, `.as(Int32` can be useful if the type of your value is like `Int32 | Bool` and you want to tell the compiler "i know it'll be an Int32 in the case"
<postmodern>
ah ha, i figured that might be the case for things like `UInt8 | Int32`
ur5us has quit [Ping timeout: 246 seconds]
notzmv has joined #crystal-lang
notzmv has quit [Ping timeout: 258 seconds]
lucf117 has quit [Remote host closed the connection]
sagax has quit [Excess Flood]
postmodern has quit [Quit: Leaving]
<yxhuvud>
it can also be used for upcasting, like `x = [1.as(Int32|String)]`
<FromGitter>
<rishavs> @lodenos , for a bigger aim, try gettiing #1 at https://www.techempower.com/benchmarks/#section=test&runid=76b9993b-3c68-4d6d-884c-fd01112e7b7a&hw=ph&test=composite&a=2 ⏎ The composite score is a much better representation of normal web load
<FromGitter>
<lodenos> @rishavs Thx It’s a really good challenge
<FromGitter>
<rishavs> @lodenos do keep in mind that all the tests around db queries are also test of the quality of the db drivers. And the drivers of languages like go, rust etc are far ahead of us due to their larger community size. ⏎ One way to work around this can be to wrap existing db clients in crystal instead of using our own drivers but it has its own set of cons
<FromGitter>
<lodenos> It’s always a balance btw Productivie, ez coding n Performance in run time
<FromGitter>
<Blacksmoke16> > We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
<FromGitter>
<lodenos> @Blacksmoke16 100% true
ur5us has joined #crystal-lang
deavmi has quit [Ping timeout: 246 seconds]
deavmi has joined #crystal-lang
terminalpusher has joined #crystal-lang
<terminalpusher>
where is the livestream?
<terminalpusher>
where can I see the livestream of the 1.0 conference? Doesn't it start right now? I can't find it anywhere at all
<FromGitter>
<Blacksmoke16> did you buy a ticket?
<terminalpusher>
no
<FromGitter>
<Blacksmoke16> then there is no livestream :)
<terminalpusher>
I thought it was going to be a YouTube livestream
<FromGitter>
<Blacksmoke16> will have to wait for them to be released afterwards
<terminalpusher>
or whatever video platform
<terminalpusher>
alright
<terminalpusher>
I'm really looking forward to watching it
<terminalpusher>
have been following Crystal for years
<terminalpusher>
it means a lot to me
deavmi has quit [Ping timeout: 255 seconds]
<FromGitter>
<Blacksmoke16> good to hear
notzmv has joined #crystal-lang
deavmi has joined #crystal-lang
<FromGitter>
<didactic-drunk> Is there a built in `Range` expection in `Spec`? Something like `a.should_be within range`? Or an approximate expectation for floats?
<FromGitter>
<alexherbo2> What is the convention to namespace multiple iterators? I initially have a `Walk.new("path/to/foo").each ...` class iterator to unconditionally traverse file entries. Now I want to have a `filter` method to control `next` generator if predicate passes, like this `Walk.new("path/to/foo").filter { |entry| Dir.exists?(entry.path) }.each ...`. I guess I need a subclass for that iterator, no?
<FromGitter>
<HertzDevil> that should still give you an iterator
<FromGitter>
<alexherbo2> For that case yep, but I need to step-in to prevent `next` going further down
<FromGitter>
<HertzDevil> what do you mean
<FromGitter>
<HertzDevil> `take_while`?
<FromGitter>
<alexherbo2> My class is implemented with a `root`, `current` and `stack`. When I do `next` I pop the stack to change the current entry, and push to the stack when directory entries. So it’s already too late to skip the entry going down
<FromGitter>
<alexherbo2> To filter entries, I have a `filter` method returning an iterator, taking the `entry` and a `predicate`. Its `next` does `predicate(walker.entry)` and if passing `walker.next`
<FromGitter>
<HertzDevil> i still don't understand
<FromGitter>
<HertzDevil> isn't that exactly `Iterator#select`
<FromGitter>
<alexherbo2> I don't think, `walker.select` will select on all entries
terminalpusher has quit [Remote host closed the connection]
<FromGitter>
<HertzDevil> i still don't understand where "namespacing" comes into this
<FromGitter>
<alexherbo2> @HertzDevil I will have to move my `Walk` class into a module like `Walk::Base` to not collide with a `Walk::Filter` iterator?
<FromGitter>
<HertzDevil> why
<FromGitter>
<alexherbo2> I don't understand how to implement my `filter` method to the `Walk` iterator class
<FromGitter>
<HertzDevil> that's a distinct issue from deciding how to namespace that iterator class
<FromGitter>
<HertzDevil> stdlib simply puts all those iterator wrappers as private classes/structs namespaced under `Iterator`
<FromGitter>
<alexherbo2> I can put a class in a class, like `Walk.Filter`?