<jhass[m]>
leah2: it's for when you want to match against the value of variable rather than capture into it. https://carc.in/#/r/cwdv makes some sense?
<leah2>
jhass[m]: but bound variables already match with equality no?
<jhass[m]>
maybe I don't get what you mean with a bound variable but I believe my example shows otherwise?
<leah2>
hm, i thoughy i had a bug yesterday due to case e; in [:foo, e] not rebinding e
<leah2>
wierd
<havenwood>
nakilon: I've seen substantial speed improvements since Ruby 3. Fiber scheduler is huge, but a bunch of tiny improvements can add up too if it aligns with what you're doing.
<havenwood>
nakilon: In some cases, especially without a JIT, not too much difference from Ruby 2.4.
gproto23 has quit [Remote host closed the connection]
gproto23 has joined #ruby
Sheilong has joined #ruby
infinityfye has quit [Ping timeout: 250 seconds]
infinityfye has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.4.1]
infinityfye has quit [Quit: Leaving]
roadie has joined #ruby
oxfuxxx has joined #ruby
oxfuxxx has quit [Ping timeout: 256 seconds]
Thanzex has quit [Read error: Connection reset by peer]
Thanzex4 has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
<adam12>
morning
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
<adam12>
Does anybody recall if an anonymous Struct affects constant invalidation? Struct.new(:foobar).new("baz")
<adam12>
I'm inclined to think it will, once the GC runs...
donofrio has joined #ruby
<adam12>
Hmm. It doesn't affect gobal_constant_state counter in RubyVM.stat. Maybe I'm wrong.
<adam12>
I did look at that, but I was more curious about the anonymous Class.
<adam12>
But I think the constant invalidation only happens with the `class` keyword...
roadie has quit [Ping timeout: 240 seconds]
<ox1eef>
what is constant invalidation?
<adam12>
ox1eef: I don't recall the specifics (I think its covered in the Ruby Under a Microscope book), but because of the way constant lookup works in Ruby, it can be somewhat expensive. So there's an internal cache that stores the values of constant lookups. When a constant is defined, the cache is invalidated.
<ox1eef>
ah i see, sounds similar to the method cache
<adam12>
I'd presume Class.new to not invalidate cache because it's not creating a constant, BUT I couldn't remember about Struct.new, because there are incantations of Struct.new that does create a constant, under the Struct namespace.
<adam12>
Yeah. Very similar to method cache.
<ox1eef>
thanks
<adam12>
Struct.new(:foobar) could technically do Struct.const_set(:SomeAnonymousClassName, my_struct). Which is what I was trying to remember. But I think it's safe.
<adam12>
After all this, I'm probably going to refactor it out to it's own constant anyways, but I never usually Struct.new.new in a hotpath. And I struggled to remember if it was cache invalidation as to why I never did.
<ox1eef>
i would think unless you assign a constant, there is no new constant being introduced. Struct.new(:foo).name => nil
_ht has joined #ruby
roadie has joined #ruby
Guest7375 has quit [Ping timeout: 256 seconds]
roadie has quit [Ping timeout: 252 seconds]
libsys has joined #ruby
<ox1eef>
that got me thinking to what happens when you have two constant references to one struct, looks like the first assignment wins.
oxfuxxx has joined #ruby
TCZ has joined #ruby
John_Ivan__ has quit [Read error: Connection reset by peer]
hololeap has quit [Excess Flood]
John_Ivan has joined #ruby
hololeap has joined #ruby
tungki has joined #ruby
<nakilon>
havenwood, idk, years already have passed since 2.3 and the only slight improvement was in 2.4 around Bigint; even with jit; the only thing that improved my programs speed were alternative ruby implementations
<nakilon>
*implementation; that is truffleruby
roadie has joined #ruby
roadie has quit [Client Quit]
<nakilon>
this was probably the last one I tried to speed up by switching the ruby versions and implementations https://dpaste.org/eDWT/slim
nullheroes has quit [Quit: WeeChat 2.8]
<nakilon>
btw, I always forget, when someone here asks how to compile the ruby inro executable, he might want to try this https://github.com/natalie-lang/natalie
<nakilon>
not full stdlib is covered and maybe it can't compile smoe gem dependencies but for simple scripts it works
<nakilon>
for now their executable is slower than ruby but they said they are working on it
<nakilon>
looks like they've increased the ruby/spec coverage from 40% to 90% in half a year https://natalie-lang.org/
libsys has quit [Ping timeout: 250 seconds]
libsys has joined #ruby
TCZ has quit [Quit: Leaving]
tungki has quit [Ping timeout: 256 seconds]
_whitelogger has joined #ruby
Guest7375 has joined #ruby
<havenwood>
nakilon: have you tried with 3.1 and --yjit, I'm curious?
oxfuxxx has quit [Ping timeout: 250 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Ping timeout: 256 seconds]
<mooff>
nakilon: or she :-)
tungki has joined #ruby
<mooff>
help, i'm addicted to Object#tap and Object#then
gproto23 has quit [Read error: Connection reset by peer]
taupiqueur has quit [Ping timeout: 240 seconds]
taupiqueur has joined #ruby
<adam12>
Heh
tungki has quit [Ping timeout: 256 seconds]
unyu has quit [Ping timeout: 240 seconds]
taupiqueur has quit [Quit: taupiqueur]
mdemo has joined #ruby
unyu has joined #ruby
trillp has joined #ruby
justAstache has quit [Remote host closed the connection]
<wand>
is it bad form to have an object attribute be a complex data structure such as a tree or nested hash
roadie has quit [Ping timeout: 268 seconds]
<wand>
i've been using ruby with a functional paradigm for a while. finally learning about oo design patterns etc
<mooff>
i think that's usually quite okay, wand
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
<weaksauce>
as opposedto what wand
<wand>
mooff: thanks. just wanted a sanity check or alternate best practice, etc.
nmollerup has joined #ruby
roadie has joined #ruby
<wand>
weaksauce: i don't know, i though maybe breaking out the tree into separate attributes might be better. I'd rather group them, sounds like that's normal
<weaksauce>
like anything it depends
<wand>
stoked about oo. reading the c2 wiki. i bough booch's book but maybe would have been better to get gang of four
<wand>
right weaksauce
<wand>
can anyone recommend a simple codebase using oo design principles i could go read to grok how it's properly done?
roadie has quit [Ping timeout: 240 seconds]
oxfuxxx has quit [Ping timeout: 252 seconds]
oxfuxxx has joined #ruby
<mooff>
which aspects in particular? what sort of things do you want to program?
oxfuxxx has quit [Ping timeout: 260 seconds]
oxfuxxx has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
peer has quit [Quit: Ping timeout (120 seconds)]
peer has joined #ruby
Guest7375 has quit [Quit: Konversation terminated!]
vit has joined #ruby
vit is now known as freeworld
oxfuxxx has quit [Ping timeout: 256 seconds]
freeworld has quit [Quit: Konversation terminated!]