jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
jl- has quit [Ping timeout: 256 seconds]
jpn has quit [Ping timeout: 256 seconds]
<havenwood> mooff: He's my metaprogramming take on just making it work, since it's Ruby and we can. :) https://gist.github.com/havenwood/1a297c2e1fcedf9a8b5d557b6dea6b60
<havenwood> mooff: That ^ makes a Digest::MD5::Mixing module you can include with all the class methods Digest::MD5 defines.
<havenwood> Digest::MD5::Mixin*
davidw_ has quit [Ping timeout: 240 seconds]
<mooff> havenwood: interesting. i didn't think that would be possible, as define_method is strict about classes matching when you give it a Method!
<weaksauce> do you program much anymore for your job havenwood ?
<mooff> ah. the trick is coming from Method#to_proc
<mooff> it's cheating a little, but cool nonetheless
jpn has joined #ruby
markong has quit [Ping timeout: 276 seconds]
jpn has quit [Ping timeout: 246 seconds]
constxd has quit [Ping timeout: 248 seconds]
jl- has joined #ruby
jl- has quit [Ping timeout: 272 seconds]
Ziyan has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
jl- has joined #ruby
factor has quit [Read error: Connection reset by peer]
jl- has quit [Ping timeout: 256 seconds]
Al2O3 has quit [Ping timeout: 272 seconds]
Al2O3 has joined #ruby
_ixti_ has joined #ruby
ixti has quit [Read error: Connection reset by peer]
jpn has joined #ruby
_ixti_ has quit [Remote host closed the connection]
_ixti_ has joined #ruby
jpn has quit [Ping timeout: 264 seconds]
<ox1eef_> well... if you can do it without C, in my view that's better.
<ox1eef_> C should be a last resort.
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
<havenwood> weaksauce: I do think about code a lot as part of my job, but yeah, most of the time I'm not writing code.
<havenwood> Sometimes I'll code a bunch for a stint for various reasons. It depends.
<havenwood> mooff: I don't know that I even see it as cheating, since it's like using a proc for a block. Here it's a lambda, but methods are naturally lambdas. Yeah, there's no way to unbind and rebind across classes even without Fiddle or C.
jl- has joined #ruby
jl- has quit [Ping timeout: 272 seconds]
<mooff> Method#to_proc seems to act like def to_proc() = -> *args, &blk { call(*args, &blk) }
<mooff> i.e. like it returns a lambda that just calls call on itself
<mooff> but that's different from including a module, where calling e.g. foo.bar will run bar with foo as the receiver
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
dionysus69 has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
jl- has joined #ruby
<ox1eef_> mooff: https://gist.github.com/0x1eef/d3224941c61846298be26396c7209d0b - not perfect, but my take.
jl- has quit [Ping timeout: 272 seconds]
<ox1eef_> as you can, 'self' is Foo when it should be Bar, but probably some trickery for that too
<ox1eef_> as you can see,*
michigan has quit []
lunarkitty has joined #ruby
Linux_Kerio has joined #ruby
jpn has joined #ruby
robotmay has quit [Quit: Be excellent to each other]
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
robotmay has joined #ruby
<ox1eef_> seems that is the toughest part - Bar has to inherit from Foo for that to work.
jpn has joined #ruby
_ht has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
Linux_Kerio has quit [Quit: Konversation terminated!]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Ziyan has quit [Ping timeout: 272 seconds]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Ziyan has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
freeworld has joined #ruby
Linux_Kerio has quit [Client Quit]
freeworld has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Client Quit]
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b4 - https://znc.in]
ollysmith has joined #ruby
jpn has quit [Ping timeout: 264 seconds]
sympt has quit [Ping timeout: 255 seconds]
protektwar has quit [Ping timeout: 272 seconds]
sympt has joined #ruby
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
lunarkitty has quit [Quit: Connection closed for inactivity]
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
jhawthorn_ has joined #ruby
jhawthorn has quit [Ping timeout: 260 seconds]
markong has joined #ruby
jpn has joined #ruby
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
vladh has joined #ruby
demographics0 has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
demographics0 has quit [Ping timeout: 246 seconds]
constxd has joined #ruby
mahlon has quit [Ping timeout: 268 seconds]
demographics0 has joined #ruby
demographics0 has quit [Ping timeout: 268 seconds]
demographics0 has joined #ruby
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
demographics0 has quit [Ping timeout: 240 seconds]
jl- has joined #ruby
jpn has joined #ruby
jl- has quit [Ping timeout: 248 seconds]
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
sagax has quit [Remote host closed the connection]
ccooke has quit [Quit: leaving]
ccooke has joined #ruby
dionysus69 has quit [Ping timeout: 256 seconds]
Thanzex has quit [Ping timeout: 246 seconds]
wand has quit [Remote host closed the connection]
jpn has joined #ruby
wand has joined #ruby
Linux_Kerio has joined #ruby
jpn has quit [Ping timeout: 276 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
jvalleroy has joined #ruby
sagax has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
dionysus69 has joined #ruby
sagax has quit [Remote host closed the connection]
depesz has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
sagax has joined #ruby
sagax has joined #ruby
sagax has quit [Changing host]
gr33n7007h has quit [Quit: WeeChat 3.5]
gr33n7007h has joined #ruby
dviola has quit [Quit: WeeChat 3.5]
cocalero has quit [Quit: Going offline, see ya! (www.adiirc.com)]
___nick___ has joined #ruby
gr33n7007h has quit [Ping timeout: 240 seconds]
depesz has joined #ruby
gr33n7007h has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 272 seconds]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
Ziyan has joined #ruby
Ziyan has quit [Ping timeout: 240 seconds]
<havenwood> mooff: Ah, gotcha. I was assuming they were functions and you may want to use the receiver. OO...
<havenwood> mooff: In this case though, they are functions and you don't want to use the receiver, right?
_ixti_ has quit [Remote host closed the connection]
_ixti_ has joined #ruby
Ziyan has joined #ruby
<havenwood> My solutions was just for class methods. I wasn't trying to make instance method mixins there ^
<havenwood> I explicitly was trying not to tie it to the receiver.
<havenwood> I guess it depends whether you're trying to mixin classes generally, which I would assume would be instance methods, or whether you want to expose class methods, which operate like module functions.
<havenwood> The goal above seemed like the latter to me, but both are fun.
Ziyan_ has joined #ruby
jl- has joined #ruby
Ziyan has quit [Ping timeout: 260 seconds]
jl- has quit [Ping timeout: 276 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
gr33n7007h has quit [Quit: WeeChat 3.5]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
wand has quit [Remote host closed the connection]
gr33n7007h has joined #ruby
<havenwood> It would probably be better if Ruby had an explicit "I don't care about the receiver" `fn` or something along those lines, IMHO, since it's really preferred to signal if the receiver matters.
<havenwood> I use `module_function` but it's a bit janky and no equivalent for classes.
jl- has joined #ruby
jl- has quit [Ping timeout: 255 seconds]
rtypo_bot has joined #ruby
rtypo_bot has left #ruby [#ruby]
Ziyan_ has quit [Quit: Textual IRC Client: www.textualapp.com]
jpn has joined #ruby
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
Ziyan has joined #ruby
Ziyan has quit [Read error: Connection reset by peer]
jpn has quit [Ping timeout: 260 seconds]
Ziyan has joined #ruby
Ziyan_ has joined #ruby
Ziyan has quit [Ping timeout: 260 seconds]
<mooff> yeah, it's definitely useful there!
<mooff> it's just funny that rebinding methods to a different class is one of the few real limitations we seem to have on Ruby OO
desnudopenguino has joined #ruby
reset has joined #ruby
Ziyan_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Ziyan has joined #ruby
Ziyan has quit [Read error: Connection reset by peer]
_ixti_ has quit [Read error: Connection reset by peer]
Ziyan has joined #ruby
<mooff> ox1eef_: yeah, but that's the rub.. i'm not so sure there is trickery for that!
<mooff> it's something you can do in JS, but not Ruby ;-O
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
cocalero has joined #ruby
John_Ivan_ has quit [Quit: Leaving]
John_Ivan has joined #ruby
wand has joined #ruby
markong has quit [Ping timeout: 255 seconds]
jl- has joined #ruby
jl- has quit [Ping timeout: 240 seconds]
jpn has joined #ruby
ccooke1 has joined #ruby
wand has quit [Remote host closed the connection]
wand has joined #ruby
kiki_lamb has quit [Quit: leaving]
libsys has quit [Ping timeout: 268 seconds]
libsys has joined #ruby
ccooke1 has quit [Quit: WeeChat 1.9.1]
ccooke has quit [Quit: leaving]
ccooke has joined #ruby
protektwar has quit [Ping timeout: 240 seconds]
jpn has quit [Ping timeout: 240 seconds]
jpn has joined #ruby
swaggboi has quit [Read error: Connection timed out]
jpn has quit [Ping timeout: 264 seconds]
swaggboi has joined #ruby
Thanzex has joined #ruby
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
wand has quit [Remote host closed the connection]
wand has joined #ruby
wand has quit [Remote host closed the connection]
wand has joined #ruby
___nick___ has quit [Ping timeout: 246 seconds]
_ht has quit [Remote host closed the connection]
desnudopenguino has quit [Ping timeout: 240 seconds]
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 260 seconds]
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 268 seconds]
stunthacks has joined #ruby
e2 has quit [Ping timeout: 272 seconds]
swaggboi has quit [Ping timeout: 240 seconds]
swaggboi has joined #ruby
jl- has joined #ruby
ixti has joined #ruby
jl- has quit [Ping timeout: 264 seconds]
gr33n7007h has quit [Quit: WeeChat 3.5]
gr33n7007h has joined #ruby
Linux_Kerio has quit [Ping timeout: 240 seconds]
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
markong has joined #ruby
michigan has joined #ruby
jpn has joined #ruby
crankharder has joined #ruby
swaggboi has quit [Read error: Connection timed out]
swaggboi has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
henninb has joined #ruby
henninb has quit [Client Quit]
henninb has joined #ruby
henninb has quit [Client Quit]
stylo has joined #ruby
cocalero has quit [Quit: Going offline, see ya! (www.adiirc.com)]
crankharder has quit [Ping timeout: 264 seconds]
crankharder has joined #ruby