havenwood changed the topic of #ruby to: Ruby 3.4.3, 3.3.8 https://www.ruby-lang.org | Log https://libera.irclog.whitequark.org/ruby
<o0x1eef> Hm it looks like Ruby is setup to handle signals exclusively on the main thread as well. Not gonna lie I think that makes life easier.
entropie has quit [Quit: ""]
entropie has joined #ruby
mange has joined #ruby
johnjaye has quit [Ping timeout: 252 seconds]
johnjaye has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Quit: eddof13]
brokkoli_origin has quit [Ping timeout: 260 seconds]
brokkoli_origin has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
joako_ has joined #ruby
joako has quit [Ping timeout: 268 seconds]
_whitelogger has joined #ruby
hansolo has quit [Ping timeout: 268 seconds]
hansolo has joined #ruby
hansolo has quit [Ping timeout: 248 seconds]
hansolo has joined #ruby
grenierm has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
<kjetilho> ehh. now I actually tested my suggestion, and IO.select will resume the select in the same way as kernel.sleep :-(
hansolo has quit [Ping timeout: 272 seconds]
<kjetilho> o0x1eef: I sort of agree - the libc interface is that both sleep() and select() return the remaining time if it was interrupted, but that information is not available in Ruby - you have to time it yourself.
hansolo has joined #ruby
<kjetilho> and as you demonstrated, you have to handle the exception rather than install a signal handler.
hansolo has quit [Ping timeout: 272 seconds]
hansolo has joined #ruby
oznek has quit [Remote host closed the connection]
dionysus69 has joined #ruby
nmollerup has joined #ruby
<o0x1eef> Good morning :D
<o0x1eef> My two cents: the purpose of IO.select is not to sleep. The purpose of IO.select is determine the state of a given set of IO objects over a period of time. Like any system call that can block, it can interrupted with EINTR. But it is not really designed to put a thread to sleep IMO. For that we have a specific system call: sleep, nanosleep, etc.
<kjetilho> yes, but select is traditionally used in an event loop, and then it makes sense for it to return on signals, too. of course a single-threaded event loop is old-fashioned today, but it surprises me that the IO.select primitive doesn't support this use case
<o0x1eef> It returns an array of arrays (the IO objects) or potentially nil if none matched, because that's what it is usually used for. Otherwise it would have to return some type of object that represented all of that info, and for a use-case that seems niche and with alternatives, that seems overkill
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
Exa has quit [Quit: see ya!]
Exa has joined #ruby
<kjetilho> "usually"? that's your opinion. having access to the timing information without explicit gettimeofday is very useful.
<o0x1eef> It's my opinion, sure but also more or less how Ruby core usually works. It rarely returns "rich" objects. It returns basic objects.
<o0x1eef> At best it might return a hash
<kjetilho> it wouldn't be so strange if a function which takes 4 arguments also returned 4 values - like the underlying API does
<kjetilho> anyway. it won't change :)
<o0x1eef> Agreed. And I agree again, a fourth value could be a nice simple way to do it.
infinityfye has joined #ruby
andy-turner has joined #ruby
cappy has joined #ruby
infinityfye__ has joined #ruby
infinityfye has quit [Killed (NickServ (GHOST command used by infinityfye__!~infinityf@154.180.66.145))]
infinityfye__ is now known as infinityfye
levitating has joined #ruby
schne1der has quit [Ping timeout: 252 seconds]
levitating has quit [Quit: Computer exploded]
gemmaro_ has quit [Ping timeout: 244 seconds]
cappy has quit [Quit: Leaving]
gemmaro_ has joined #ruby
grenierm has quit [Quit: Client closed]
schne1der has joined #ruby
CRISPR has joined #ruby
sam113101 has quit [Read error: Connection reset by peer]
sam113101 has joined #ruby
mange has quit [Quit: Zzz...]
CRISPR has quit [Ping timeout: 252 seconds]
oznek has joined #ruby
Linux_Kerio has joined #ruby
donofrio2 has quit [Remote host closed the connection]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
dionysus69 has quit [Ping timeout: 276 seconds]
otisolsen70 has joined #ruby
CRISPR has joined #ruby
CRISPR has quit [Ping timeout: 252 seconds]
eddof13 has joined #ruby
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
user71 has joined #ruby
eddof13 has quit [Quit: eddof13]
CRISPR has joined #ruby
eddof13 has joined #ruby
otisolsen70 has quit [Quit: Leaving]
<havenwood> <3 keyword arguments. This type of `thingy(nil, nil, nil, 3.14)` is exactly what makes me want backporting `thingy(seconds: 3.14)` to historic methods.
TomyWork has joined #ruby
CRISPR has quit [Ping timeout: 260 seconds]
CRISPR has joined #ruby
wbooze_ has joined #ruby
wbooze has quit [Ping timeout: 248 seconds]
<o0x1eef> Generally agree. But as a rule of thumb I never mix them with positional args. IME that's when things can get weird.
<johnjaye> o0x1eef: i'm always torn as to whether i should learn more of perl, python, or ruby
<johnjaye> everytime i think i should learn one i think but what if i could learn more with the other one
<johnjaye> ruby is so elegant it's hard to quit though
oznek has quit [Remote host closed the connection]
oznek has joined #ruby
<o0x1eef> IME it is hard to learn multiple languages at the same time. But you could do something like: 3 months of ruby, 3 months of python, 3 months of perl. Then when you have a foundation, it's easier to switch between them, and learn multiple at the same time.
<johnjaye> that's a very wise answer.
oznek_ has joined #ruby
oznek has quit [Ping timeout: 260 seconds]
<o0x1eef> At the moment I want to learn Rust
<johnjaye> someone told me the rustlings github is useful for that.
<johnjaye> (this person claimed to be a rust programmer)
Linux_Kerio has quit [Ping timeout: 248 seconds]
<o0x1eef> Good to know! I have no shortage of books on the topic :D I just lack discipline. It's easier to pick up Ruby or JavaScript when you know them reasonably well, versus pick up a language you barely know at all.
<o0x1eef> It's also cool to learn about the idioms of other languages. Even though Python + Ruby are similar, the Python mindset is different, and it can interesting to explore and then apply the good ideas. Similar for JavaScript, etc. I definitely suggest keeping your mind open to multiple languages.
user71 has quit [Quit: Leaving]
TomyWork has quit [Ping timeout: 248 seconds]
wbooze_ has quit [Read error: Connection reset by peer]
CRISPR has quit [Ping timeout: 272 seconds]
wbooze has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
eddof13 has quit [Quit: eddof13]
eddof13 has joined #ruby
eddof13 has quit [Quit: eddof13]
andy-turner has quit [Quit: Leaving]
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
wbooze has quit [Ping timeout: 268 seconds]
user23 has joined #ruby
user23 has quit [Excess Flood]
user23 has joined #ruby
wbooze has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
cappy has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
<nakilon> I wish there were nested methods in an object
<nakilon> i.e. my_object.some_methods.method1()
<nakilon> if I do my_object.class.Some_methods_module.method1(), it won't know my object attributes
<nakilon> maybe I can do something like... def some_methods ; self.class.Some_methods.public_methods(false).map{ |m| m.curry[self] } ; end
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
cappy has quit [Quit: Leaving]