<catphish>
opinion: should IPAddr.new('10.0.0.1/32').include?('::ffff:10.0.0.1') return true?
<catphish>
(and vice versa)
desnudopenguino has quit [Quit: desnudopenguino]
desnudopenguino has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
caedmon has joined #ruby
caedmon has quit [Client Quit]
donofrio has joined #ruby
donofrio_ has quit [Ping timeout: 256 seconds]
sympt has joined #ruby
<sphex>
catphish: that could be unexpected. if you ask me there should be a separate method for that.
<sphex>
catphish: right now include? is consistent with <=> comparison and that's a nice property. in general I think there should be "basic" methods that do (externally apparent) simple things and it's a mistake to try to make them too smart. in part because there might be multiple ways to do the smart things. I think of include? as a "basic" method like that.
<sphex>
well, just my opinion
moldorcoder7 has quit [Ping timeout: 256 seconds]
slothby has quit [Quit: brb ... maybe]
johnjaye has joined #ruby
slothby has joined #ruby
MalusVulgaris has joined #ruby
quads80 has joined #ruby
_ht has joined #ruby
grenierm has joined #ruby
quads80 has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
ap4y has quit [Remote host closed the connection]
MalusVulgaris has quit [Remote host closed the connection]
MalusVulgaris has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Quit: WeeChat 3.8]
lena64t1 has joined #ruby
lena64t has quit [Ping timeout: 240 seconds]
roshanavand has quit [Ping timeout: 240 seconds]
Jonopoly has quit [Quit: WeeChat 3.0]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 256 seconds]
Sankalp- is now known as Sankalp
roshanavand has joined #ruby
gr33n7007h has joined #ruby
moldorcoder7 has joined #ruby
hightower2 has joined #ruby
Jonopoly has joined #ruby
lena64t1 has quit [Remote host closed the connection]
lena64t1 has joined #ruby
otisolsen70 has quit [Quit: Leaving]
roshanavand has quit [Ping timeout: 240 seconds]
xuochi has joined #ruby
xuochi has quit [Quit: leaving]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
teclator has quit [Ping timeout: 240 seconds]
teclator has joined #ruby
nmollerup has quit [Quit: Leaving]
hwpplayer1 has quit [Quit: I'll be back]
hwpplayer1 has joined #ruby
hwpplayer1 has quit [Remote host closed the connection]
hwpplayer1 has joined #ruby
polishdub has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
crespire has joined #ruby
_ht has joined #ruby
crespire has quit [Ping timeout: 240 seconds]
crespire1 has quit [Ping timeout: 268 seconds]
finsternis has quit [Ping timeout: 248 seconds]
genpaku has quit [Ping timeout: 268 seconds]
crespire has joined #ruby
lena64t1 has quit [Quit: WeeChat 4.0.0-dev]
<catphish>
sphex: i suspect you're correct, after i asked, i discovered that there are plenty of helper methods than can allow one to easily identify the situation and cpmvert to the correct format to do the comparison, so almost certainly no need to confuse the core comparsion code
desnudopenguino has quit [Ping timeout: 248 seconds]
graywolf has quit [Quit: WeeChat 3.8]
szkl has joined #ruby
jmcgnh has joined #ruby
<johnjaye>
did i read that right before that for loops don't create scopes in ruby but while loops do?
<rapha>
perhaps it was between loops vs blocks, johnjaye?
<rapha>
(the latter do, also when following an iterator)
<johnjaye>
well. to me a loop would automatically create a scope or a block in other languages
<johnjaye>
it's kind of implied by the concept itself. hence the question
<gr33n7007h>
johnjaye: for, while and until are all keywords and do not create new local variable scope.
<johnjaye>
oh ok
<johnjaye>
how do i enforce a local variable scope inside a while loop?
<johnjaye>
does using the 'do' word not work?
<rapha>
you use an iterator instead
<rapha>
oh wait, you wanted a while loop
<johnjaye>
well if it's idiomatic ruby to use an iterator that's fine
<rapha>
very much so
<rapha>
but what are you needing the while loop for?
<johnjaye>
to repeat an action until the CONDITION form is nil or false
<gr33n7007h>
johnjaye: use Kernel#loop and break when needed
<rapha>
gr33n7007h: that won't give him local scope inside
<rapha>
oh wait it does
<rapha>
huh
<rapha>
TIL; thanks!
<johnjaye>
rubydoc.info doesn't mention that scope part though. how did you know!?
<rapha>
indeed i can't find that info online
<rapha>
i do seem to remember that it's in Programming Ruby (the book)
<johnjaye>
well that would also be an acceptable answer. Socrates himself would take "I don't know" as an answer, yet everyone claimed to know in Athens.
<johnjaye>
by the way is rubydoc.info a good site. it's what came up on google.
<rapha>
it is something i sometimes feel troubled about. for some reason "i don't know" can be a challenging answer to give.
<johnjaye>
i got the official ruby docs by just cloning the git repo and running rdoc
<rapha>
finding all kinds of nice things looking for where that answer could be found
<johnjaye>
one trick I use is sometimes to ask a person about something that is true.
<rapha>
eg i didnt know about until condition ... end
<johnjaye>
then I judge documentations or tutorials by whether they mention that thing or not
<rapha>
there really ought to be an online reasource mentioning the various scopes, though
<rapha>
like, exhaustingly. not like all those tutorials on some blog or elsewhere.
TomyWork has quit [Remote host closed the connection]
<johnjaye>
i guess what i meant is can i just create a local variable scope with {} like I would in c?
<gr33n7007h>
johnjaye: can you give me an example of what you are trying to achieve
<johnjaye>
no i'm just learning ruby. so i have these types of questions
<gr33n7007h>
ah, ok. i'm just a little unsure what you mean.
<johnjaye>
well in c you can create scopes for variables whenever you want
<johnjaye>
{ i = 0; } i +=1; // i isn't visible here
<johnjaye>
in fact the {} after for,if, and while are all completely optional
<johnjaye>
it just applies the loop to the next statement
<adam12>
I'm not sure of a way to create a local like that.
<sphex>
johnjaye: if you want a new scope in a method, you need a new block.
<sphex>
I don't recommend you do this, but you could have something like `module Kernel; private def scoped; yield; end; end` and then you could simply call `scoped do ... end` anywhere. but it's generally better to break things down into smaller methods instead.
roadie has quit [Quit: ERC 5.5 (IRC client for GNU Emacs 29.0.90)]
<adam12>
^ +1
Shortstop has joined #ruby
lena64t has joined #ruby
johnjaye has quit [Quit: WeeChat 4.0.0-dev]
johnjaye has joined #ruby
moldorcoder7_ has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
moldorcoder7 has quit [Ping timeout: 240 seconds]
hwpplayer1 has quit [Quit: "cylater"]
roshanavand has joined #ruby
roshanavand has quit [Remote host closed the connection]
heartburn has quit [Ping timeout: 264 seconds]
heartburn has joined #ruby
_ht has quit [Quit: _ht]
Shortstop has quit [Quit: Client closed]
Shortstop has joined #ruby
<ox1eef_>
johnjaye: proc { local = 1 }.call - that would be roughly equivalent to a IIFE in JS.
<ox1eef_>
I don't think you need to introduce anything new for that. if you want to scope a local to a while loop, then you can just use what's available out of the box for that ( proc { ... }.call ). And the intent will be clearer than some sort of DSL for doing it.
johnjaye has quit [Ping timeout: 240 seconds]
johnjaye has joined #ruby
infinityfye has quit [Quit: Leaving]
tomtmym has quit [Quit: Gone.]
gr33n7007h has quit [Ping timeout: 248 seconds]
gr33n7007h has joined #ruby
gr33n7001 has joined #ruby
gr33n7007h is now known as Guest3236
Guest3236 has quit [Killed (calcium.libera.chat (Nickname regained by services))]
gr33n7001 is now known as gr33n7007h
_whitelogger has joined #ruby
pounce has joined #ruby
meimei has joined #ruby
caleb has joined #ruby
yCrazyEdd has quit [Ping timeout: 240 seconds]
CrazyEddy has joined #ruby
<johnjaye>
ox1eef_: oh interesting. thanks
ap4y has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
dionysus69 has quit [Ping timeout: 256 seconds]
cybniv has quit [Read error: Connection reset by peer]