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