havenwood changed the topic of #ruby to: Ruby 3.2.2, 3.1.4, 3.3.0-preview2: https://www.ruby-lang.org | Rules: https://ruby-community.com | Logs: https://libera.irclog.whitequark.org/ruby
<weaksauce> yeah hash does that too
ksmr has quit [Quit: WeeChat 4.0.5]
ksmr has joined #ruby
ksmr has quit [Client Quit]
ksmr has joined #ruby
Condition_Boy has joined #ruby
ConditionBoy has quit [Read error: Connection reset by peer]
Condition_Boy has quit [Read error: Connection reset by peer]
ConditionBoy has joined #ruby
ksmr has quit [Ping timeout: 255 seconds]
Condition_Boy has joined #ruby
ConditionBoy has quit [Read error: Connection reset by peer]
Condition_Boy has quit [Read error: Connection reset by peer]
ConditionBoy has joined #ruby
Vonter has quit [Ping timeout: 260 seconds]
Vonter has joined #ruby
caedmon has joined #ruby
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 255 seconds]
markong has quit [Ping timeout: 272 seconds]
raz3time has joined #ruby
raz3time has quit [Client Quit]
caedmon has quit [Ping timeout: 264 seconds]
razetime has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 252 seconds]
lucerne3 has joined #ruby
lucerne has quit [Ping timeout: 272 seconds]
lucerne3 is now known as lucerne
deadmarshal_ has quit [Ping timeout: 240 seconds]
joto3 has joined #ruby
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
thomas25 has quit [Ping timeout: 272 seconds]
victori has joined #ruby
joto has quit [Ping timeout: 272 seconds]
micro has quit [Ping timeout: 272 seconds]
joto3 is now known as joto
micro_ has joined #ruby
caedmon has joined #ruby
thomas25 has joined #ruby
deadmarshal has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
caedmon has joined #ruby
<johnjaye> hmm. if I define a lambda and pass it to a block is the : in front not required?
<johnjaye> e.g. foo = lambda { |x| x < 5 }, a=[1,2,3], a.all? foo
<johnjaye> foo or :foo both seem to work
caedmon has quit [Quit: caedmon]
caedmon has joined #ruby
m_antis has joined #ruby
Guest1927 has left #ruby [WeeChat 4.0.5]
dviola has joined #ruby
caedmon has quit [Ping timeout: 258 seconds]
<sam113101> johnjaye: that would surprise me
<sam113101> doesn't work here
<johnjaye> idk. i'm on ruby 2.7 so maybe it's different for 3?
<johnjaye> the :foo syntax seems to give the wrong answer
<sam113101> I don't think it does what you think it does
<sam113101> > [:foo, :foo, :foo].all?(:foo)
<sam113101> where is the repl bot when you need him
<sam113101> !help
<ruby[bot]> sam113101: You can find a list of my commands on http://ruby-community.com/ruboto/commands and my factoids on http://ruby-community.com/ruboto/facts
<johnjaye> well. it seems to do what I think it does. at least without the :
<sam113101> >> [:foo, :foo, :foo].all?(:foo)
<ruby[bot]> sam113101: # => true (https://carc.in/#/r/fvuf)
<sam113101> >> [:foo, :bar, :foo].all?(:foo)
<ruby[bot]> sam113101: # => false (https://carc.in/#/r/fvug)
<johnjaye> maybe the :foo one does not do it though
<johnjaye> so maybe it has to be a lambda or a Proc object
<sam113101> all?(:foo) checks if all items are :foo, there's no proc magic there
<sam113101> you can use an integer, a string, whatever value
<sam113101> doesn't have to be a symbol
<sam113101> that's one "form" of the all? method, another one takes a block
<sam113101> I don't know what happens when you provide both a normal argument and a block
<johnjaye> it prints a warning that it ignored the block
<sam113101> now we know
<johnjaye> i think the ambiguity is if I give it a lambda as an argument
<johnjaye> then it acts as if I gave it a block
<johnjaye> i'm not savvy enough to interpret the code though
<sam113101> it's so you don't have to put & in front of your lambda, which is nice if that's what you want, however I guess there has to be someone out there who has an array of procs and might want the "real" all?(x)
<johnjaye> if (rb_vm_frame_block_handler(GET_EC()->cfp) == VM_BLOCK_HANDLER_NONE) {
<johnjaye> this is the code that determines if a block was received
<johnjaye> i thought you had to put & in front though
<johnjaye> & says to pass it as a block not a parameter. so the fact it's letting me pass as a parameter is a bit off
<sam113101> I think it's just doing lamdba === argument
<sam113101> >> yo = proc { |x| x < 5 }; [yo(4), yo(5)]
<ruby[bot]> sam113101: # => undefined method `yo' for main:Object (NoMethodError) (https://carc.in/#/r/fvuh)
<sam113101> >> yo = proc { |x| x < 5 }; [yo.call(4), yo.call(5)]
<ruby[bot]> sam113101: # => [true, false] (https://carc.in/#/r/fvui)
<sam113101> >> yo = proc { |x| x < 5 }; [yo.(4), yo.(5)]
<ruby[bot]> sam113101: # => [true, false] (https://carc.in/#/r/fvuj)
dviola has quit [Ping timeout: 255 seconds]
<sam113101> >> yo = proc { |x| x < 5 }; [yo === 4, yo === 5]
<ruby[bot]> sam113101: # => [true, false] (https://carc.in/#/r/fvuk)
diego has joined #ruby
diego is now known as Guest8898
Guest8898 has left #ruby [#ruby]
dviola has joined #ruby
caedmon has joined #ruby
<johnjaye> hmm
<johnjaye> so a lambda === something means it plugs the something into the lambda?
<johnjaye> that's... interesting
caedmon has quit [Ping timeout: 255 seconds]
_ht has joined #ruby
konsolebox has quit [Ping timeout: 255 seconds]
caedmon has joined #ruby
caedmon has quit [Quit: caedmon]
caedmon has joined #ruby
Pixi has quit [Ping timeout: 255 seconds]
Pixi has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
<leftylink> each class is free to define === in the manner it sees fit, just as they can with any other definable operator. how else is case/when supposed to work if classes couldn't do that?
<johnjaye> i don't know. i've never used case in ruby yet
<johnjaye> i just read that it uses ===
lucerne has quit [Quit: Ping timeout (120 seconds)]
ollysmith has quit [Quit: ZNC 1.8.2+deb3.1 - https://znc.in]
ollysmith has joined #ruby
lucerne has joined #ruby
Linux_Kerio has joined #ruby
razetime has quit [Ping timeout: 255 seconds]
razetime has joined #ruby
grenierm has joined #ruby
_ht has quit [Quit: _ht]
Tempesta has quit [Quit: See ya!]
John_Ivan is now known as DicktaThor
Tempesta has joined #ruby
reset has joined #ruby
Condition_Boy has joined #ruby
ConditionBoy has quit [Ping timeout: 255 seconds]
konsolebox has joined #ruby
alphacentauri has quit [Quit: WeeChat 4.0.5]
alphacentauri has joined #ruby
Condition_Boy has quit [Read error: Connection reset by peer]
ConditionBoy has joined #ruby
Guest84 has joined #ruby
smp has quit [Ping timeout: 240 seconds]
smp_ has joined #ruby
smp_ is now known as smp
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ruby
teclator has joined #ruby
willfish has joined #ruby
Condition_Boy has joined #ruby
ConditionBoy has quit [Read error: Connection reset by peer]
Condition_Boy has quit [Read error: Connection reset by peer]
razetime has quit [Ping timeout: 240 seconds]
ConditionBoy has joined #ruby
grenierm has quit [Quit: Client closed]
konsolebox has quit [Ping timeout: 240 seconds]
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
dza has quit [Remote host closed the connection]
razetime has joined #ruby
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
dza has joined #ruby
konsolebox has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
Linux_Kerio has quit [Ping timeout: 255 seconds]
fercell_ has quit [Ping timeout: 264 seconds]
graywolf has quit [Quit: WeeChat 4.0.4]
fercell has joined #ruby
infinityfye has joined #ruby
weaksauc_ has joined #ruby
weaksauce has quit [Ping timeout: 272 seconds]
mollerup has joined #ruby
nmollerup has quit [Ping timeout: 245 seconds]
markong has joined #ruby
otisolsen70 has joined #ruby
ultralan has joined #ruby
ultralan has quit [Remote host closed the connection]
konsolebox has quit [Quit: Leaving]
konsolebox has joined #ruby
dalan0382283 has quit [Quit: dalan0382283]
dalan0382283 has joined #ruby
dalan0382283 has quit [Quit: dalan0382283]
dalan0382283 has joined #ruby
dalan0382283 has quit [Client Quit]
dalan0382283 has joined #ruby
dalan0382283 has quit [Client Quit]
dalan0382283 has joined #ruby
marwin666 has joined #ruby
dalan0382283 has quit [Quit: dalan0382283]
marwin666 has quit [Quit: ircII EPIC5-2.1.12 -- Are we there yet?]
razetime has quit [Ping timeout: 255 seconds]
dalan0382283 has joined #ruby
marwin666 has joined #ruby
dalan0382283 has quit [Quit: dalan0382283]
dalan0382283 has joined #ruby
marwin666 has quit [Quit: ircII EPIC5-2.1.12 -- Are we there yet?]
markong has quit [Ping timeout: 255 seconds]
otisolsen70 has quit [Quit: Leaving]
user23 has joined #ruby
razetime has joined #ruby
user23 has quit [Remote host closed the connection]
molle has joined #ruby
razetime has quit [Ping timeout: 255 seconds]
razetime has joined #ruby
mollerup has quit [Ping timeout: 260 seconds]
TomyWork has joined #ruby
u0_a115 has joined #ruby
markong has joined #ruby
eddof13 has joined #ruby
u0_a115 has quit [Ping timeout: 272 seconds]
razetime has quit [Remote host closed the connection]
razetime has joined #ruby
Vonter has quit [Ping timeout: 255 seconds]
Vonter has joined #ruby
_ht has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eddof13 has joined #ruby
razetime has quit [Quit: Go back to your cringe 9 to 5. I'll be gaming.]
konsolebox has quit [Quit: Quit]
willfish has quit [Ping timeout: 272 seconds]
Guest98 has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
u0_a115 has joined #ruby
u0_a115 has quit [Ping timeout: 240 seconds]
eddof13 has joined #ruby
u0_a115 has joined #ruby
u0_a1151 has joined #ruby
u0_a115 has quit [Ping timeout: 255 seconds]
u0_a1151 has quit [Ping timeout: 255 seconds]
marwin666 has joined #ruby
marwin666 has quit [Quit: ircII EPIC5-2.1.12 -- Are we there yet?]
willfish has joined #ruby
graywolf has joined #ruby
Linux_Kerio has joined #ruby
caedmon has joined #ruby
u0_a1151 has joined #ruby
caedmon has quit [Ping timeout: 272 seconds]
Guest84 has quit [Quit: Connection closed]
brokkoli_origin has quit [Remote host closed the connection]
TomyWork has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
markong has quit [Ping timeout: 255 seconds]
Guest98 has quit [Quit: Client closed]
brokkoli_origin has quit [Remote host closed the connection]
brokkoli_origin has joined #ruby
Guest98 has joined #ruby
Guest98 has quit [Client Quit]
u0_a1151 has quit [Ping timeout: 252 seconds]
u0_a1151 has joined #ruby
u0_a1151 has quit [Ping timeout: 255 seconds]
<dorian> noticed something weird in whatever ruby ships with ubuntu 23.04 (3.1.2p0?)
u0_a1151 has joined #ruby
<dorian> say you have an instance of a class with a []= method and it takes its input and transforms it, returning something else, the following multiple assignment doesn't propagate
caedmon has joined #ruby
<dorian> so if i say `foo = bar[lol] = rhs`, foo has the value of rhs
<dorian> not the output of bar.[]=
f8a08e38 has joined #ruby
<dorian> the question to me is is that supposed to be like that or is that a bug in ruby
<weaksauc_> that's expected
<weaksauc_> the same as if you were to do bar[lol] = rhs
f8a08e38 has quit [Client Quit]
<weaksauc_> except foo gets assigned to that
<weaksauc_> it's more easily thought of as foo = (bar[lol] = rhs)
<dorian> what i'm saying is it *doesn't* do that
<weaksauc_> oh
<weaksauc_> what version of it
<dorian> i'm saying foo gets rhs when it should be getting the output of bar.[]=
<weaksauc_> did you override bar[]= or something
<dorian> oh wait is the return value of []= ignored?
e4813111 has joined #ruby
<weaksauc_> apparently yeah
<dorian> oh, that's what's going on
<dorian> boo
<dorian> well that explains things
caedmon has quit [Ping timeout: 272 seconds]
u0_a1151 has quit [Ping timeout: 258 seconds]
u0_a1151 has joined #ruby
u0_a1151 has quit [Read error: Connection reset by peer]
dstein64- has joined #ruby
u0_a1151 has joined #ruby
u0_a1151 has quit [Read error: Connection reset by peer]
dstein64 has quit [Ping timeout: 255 seconds]
dstein64- is now known as dstein64
u0_a1151 has joined #ruby
u0_a1151 has quit [Read error: Connection reset by peer]
caedmon has joined #ruby
u0_a1151 has joined #ruby
u0_a1151 has quit [Read error: Connection reset by peer]
u0_a1151 has joined #ruby
u0_a1151 has quit [Read error: Connection reset by peer]
u0_a1151 has joined #ruby
u0_a1151 has quit [Read error: Connection reset by peer]
caedmon has quit [Ping timeout: 240 seconds]
meimei has quit [Remote host closed the connection]
pounce has quit [Remote host closed the connection]
meimei has joined #ruby
pounce has joined #ruby
u0_a1151 has joined #ruby
caedmon has joined #ruby
johnjaye has quit [Ping timeout: 246 seconds]
Guest84 has joined #ruby
caedmon has quit [Ping timeout: 258 seconds]
_ht has quit [Quit: _ht]
meimei has quit [Remote host closed the connection]
pounce has quit [Remote host closed the connection]
pounce has joined #ruby
meimei has joined #ruby
meimei has quit [Remote host closed the connection]
pounce has quit [Remote host closed the connection]
meimei has joined #ruby
pounce has joined #ruby
meimei has quit [Remote host closed the connection]
pounce has quit [Remote host closed the connection]
meimei has joined #ruby
pounce has joined #ruby
Guest82 has joined #ruby
<Guest82> Hello everyone
u0_a1151 has quit [Ping timeout: 255 seconds]
u0_a1151 has joined #ruby
Guest82 has quit [Client Quit]
u0_a1152 has joined #ruby
u0_a1151 has quit [Ping timeout: 240 seconds]
u0_a1152 has quit [Ping timeout: 272 seconds]
u0_a1152 has joined #ruby
infinityfye has quit [Quit: Leaving]
u0_a1152 has quit [Ping timeout: 260 seconds]
markong has joined #ruby
willfish has quit [Ping timeout: 258 seconds]
Linux_Kerio has quit [Ping timeout: 255 seconds]
graywolf has quit [Ping timeout: 248 seconds]
graywolf has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
e4813111 has quit [Quit: zzz]
fcccd29e has joined #ruby
graywolf has quit [Quit: WeeChat 4.0.4]
RougeR has joined #ruby
<leftylink> yeah there's even a small section in the docs about exactly this...
<leftylink> Note that for assignment methods the return value will be ignored when using the assignment syntax. Instead, the argument will be returned:
<leftylink> The actual return value will be returned when invoking the method directly:
<leftylink> intresting distinction indeed...
<leftylink> haven't given it enough careful thought to have decided whether I would prefer it one way or another
<leftylink> but interesting to know it
Condition_Boy has joined #ruby
ConditionBoy has quit [Read error: Connection reset by peer]
Condition_Boy has quit [Read error: Connection reset by peer]
ConditionBoy has joined #ruby
<weaksauc_> leftylink if i had to guess this was an optimization somewhere down the line and it stuck
<weaksauc_> similar to how @var will always return nil instead of undefined if you misspell it
<weaksauc_> undefined error*
<weaksauc_> though i think that was an intentional choice by matz even if it makes the code more buggy
gr33n7007h has quit [Ping timeout: 258 seconds]
gr33n7007h has joined #ruby
markong has quit [Ping timeout: 240 seconds]
FetidToot has quit [Ping timeout: 255 seconds]
fcccd29e has quit [Quit: zzz]
RougeR has quit [Quit: Leaving]
reset has quit [Quit: reset]
FetidToot has joined #ruby