havenwood changed the topic of #ruby to: Ruby 3.3.3, 3.2.4, 3.4.0-preview1 https://www.ruby-lang.org | Logs https://libera.irclog.whitequark.org/ruby
otisolsen70 has quit [Quit: Leaving]
slothby has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
donofrio_ has joined #ruby
donofrio has quit [Ping timeout: 246 seconds]
konsolebox_ has quit [Quit: .]
szkl has quit [Quit: Connection closed for inactivity]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
Starfoxxes has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 255 seconds]
Haris_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jhass has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
fyang has joined #ruby
Fridtjof has quit [Quit: ZNC - http://znc.in]
Fridtjof has joined #ruby
factor has quit [Quit: The Lounge - https://thelounge.chat]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
wbooze has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 264 seconds]
Furai has quit [Quit: WeeChat 4.3.2]
factor has joined #ruby
Furai has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
factor has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
grenierm has joined #ruby
factor has joined #ruby
fyang has quit [Quit: Client closed]
fyang has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
wbooze has joined #ruby
grenierm has quit [Quit: Client closed]
cappy has joined #ruby
wisegopher has joined #ruby
wisegopher has quit [Remote host closed the connection]
fyang has quit [Quit: Client closed]
jenrzzz has joined #ruby
brokkoli_origina has quit [Ping timeout: 252 seconds]
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
fyang has joined #ruby
fyang has quit [Ping timeout: 250 seconds]
fyang has joined #ruby
wisegopher has joined #ruby
wisegopher has quit [Client Quit]
mange has quit [Remote host closed the connection]
fyang has quit [Quit: fyang]
osc4rpt has joined #ruby
FetidToot3 has quit [Read error: Connection reset by peer]
FetidToot3 has joined #ruby
c10l has quit [Remote host closed the connection]
c10l has joined #ruby
konsolebox has joined #ruby
TomyWork has joined #ruby
wisegopher has joined #ruby
wisegopher has quit [Client Quit]
jenrzzz has quit [Ping timeout: 268 seconds]
gaussianblue has joined #ruby
Trivial has joined #ruby
cognemo has quit [Ping timeout: 256 seconds]
jhass has joined #ruby
resica has joined #ruby
<resica> Hi
cappy has quit [Quit: Leaving]
FetidToot37 has joined #ruby
aesthetikx has joined #ruby
Trivial has quit [Ping timeout: 264 seconds]
FetidToot3 has quit [Read error: Connection reset by peer]
FetidToot37 is now known as FetidToot3
<resica> I just discovered ruby, it looks phenomenal. It's extremely simple like lua but still feels unixy in a way.
<resica> But when it comes to GUI frameworks, what choices do I have other than Tk? I don't know how active the GTK scene is for ruby.
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
<Momentum> resica: maybe also https://github.com/mcorino/wxRuby3
<resica> Awesome
<Momentum> this may sound controversial, but i don't feel like ruby is suitable for GUI development
<resica> It does come with the Tk toolkit.
<resica> But ncurses is probably better because it won't require X or wayland either way.
<resica> Or some curses like environment.
<Momentum> one problem with using a language like ruby is performance and another is packaging
<Momentum> this applies to python too
<resica> And perl. Don't forget perl.
<Momentum> :D
<Momentum> totally
<resica> Ruby exists because perl was still in its early years.
<Momentum> C, C++, Rust and hell even Java
<Momentum> are better
<resica> I think, Momentum, if you're making a simple vi clone (and not something like photoshop), performance won't be an issue.
<resica> Just as an example.
<resica> And scripting language package managers have gotten way better these days. I never have a problem with pip for python.
<resica> Don't know how good ruby gems is on windows however, doubt it's that great since like perl, ruby was meant more for unix like systems.
<Momentum> yeah that's fair, although i disagree a bit on not having problems with pip :)
<Momentum> like now a standalone pip command won't work without setting up a virtual envirnoment
<resica> I like that because on msys2 with windows, it pollutes the rest of the database without venv.
<resica> I get install or update errors if I put pip packages into where the rest of the python packages are.
<Momentum> yeah i understand the merit for isolating pip installs, but it's just there
smp has quit [Ping timeout: 252 seconds]
<resica> How often does a ruby gem require a C or C++ compiler? If so, it's like perl where it's a pain in the arse to use gems or cpan without cygwin or msys2.
<resica> If you're not familiar with msys2, it's the recommended way to install ruby on windows. It's a fork of the original MinGW (Minimalist GNU For Windows) with a huge load of compilers or libraries available.
smp has joined #ruby
<resica> Unlike cygwin, msys2 does not come with an X emulation environment. So anything X mandatory will not work with msys2 like say xeyes.
<Momentum> I don't know, probably depends on what kind of gems you need
<Momentum> if i'd have to guess probably the majority of gems don't
<resica> I guess stuff like anything GNOME/GTK related, absolutely.
<resica> Which is going to be HUGE.
<Momentum> I don't GTK binding gems for ruby would require a C compiler, just the relevant shared libraries should be present in the system
<Momentum> s/I don't/I don't think
<resica> Well, I'm not on my windows machine right now, so I cannot confirm this, but I'll take your word for it. :)
<Momentum> uhh actually i'm not sure
resica has quit [Quit: Leaving]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
Pixi` has joined #ruby
factor3 has joined #ruby
desnudopenguino1 has joined #ruby
donofrio__ has joined #ruby
desnudopenguino has quit [Ping timeout: 264 seconds]
desnudopenguino1 is now known as desnudopenguino
Pixi has quit [Ping timeout: 256 seconds]
factor has quit [Ping timeout: 268 seconds]
factor3 is now known as factor
donofrio_ has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1))]
crespire1 has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
donofrio_ has joined #ruby
wbooze has quit [Remote host closed the connection]
wbooze has joined #ruby
donofrio__ has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
wisegopher has joined #ruby
wisegopher has quit [Changing host]
wisegopher has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
Trivial has joined #ruby
factor has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
jardsonto has joined #ruby
wbooze has quit [Quit: Konversation terminated!]
Inline has joined #ruby
wbooze has joined #ruby
wisegopher has quit [Ping timeout: 268 seconds]
wbooze has quit [Remote host closed the connection]
wbooze has joined #ruby
wbooze has quit [Remote host closed the connection]
wbooze has joined #ruby
wbooze has quit [Remote host closed the connection]
jenrzzz has joined #ruby
wbooze has joined #ruby
brokkoli_origin has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
user71 has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
hightower4 has joined #ruby
matoro has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
matoro has joined #ruby
hightower3 has quit [Ping timeout: 268 seconds]
Haris_ has left #ruby [#ruby]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jardsonto has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
gaussianblue has quit [Quit: leaving]
jardsonto has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
gthank has joined #ruby
TomyWork has quit [Remote host closed the connection]
<sphex> hmm why does this print nil? https://dpaste.org/fQBt2
Trivial has quit [Quit: WeeChat 4.2.2]
Trivial has joined #ruby
<havenwood> sphex: Delegator is a BasicObject. You can reproduce this with `class Sphex < BasicObject def self.sphex = defined?(Array) end` but the issue is BasicObject.
<havenwood> Your Delegator usage seems odd. Did you mean to make a SimpleDelegator or just discovered this and are showing a minimal reproduction case?
<havenwood> I'd suggest looking at `Delegator` code to make sure this is really what you want. https://github.com/ruby/delegate/blob/v0.3.1/lib/delegate.rb#L62
<havenwood> It's not too often you see Delegator used directly. I'm accustomed to seeing SimpleDelegator or DelegateClass.
<havenwood> You then would wrap a thing, rather than using your delegator directly.
Inline has quit [Remote host closed the connection]
Inline has joined #ruby
wbooze has quit [Remote host closed the connection]
wbooze has joined #ruby
Trivial has quit [Quit: WeeChat 4.2.2]
Trivial has joined #ruby
Trivial has quit [Client Quit]
Trivial has joined #ruby
user71 has quit [Quit: Leaving]
<sphex> havenwood: ohhh interesting. yeah that was just a minimal way to reproduce. but why does this happen with BasicObject though?
Trivial has quit [Quit: WeeChat 4.2.2]
Triviality has joined #ruby
<mooff> >> [defined? BasicObject::Object, defined? Object::Array, class Bar < BasicObject; [defined? Array, defined? ::Array]; end]
<ruby[bot]> mooff: I'm terribly sorry, I could not evaluate your code because of an error: JSON::ParserError:A JSON text must at least contain two octets!
ruby-eval has joined #ruby
<mooff> == [defined? BasicObject::Object, defined? Object::Array, class Bar < BasicObject; [defined? Array, defined? ::Array]; end]
<ruby-eval> => [nil, "constant", [nil, "constant"]]
<ruby-eval> => nil
<mooff> == defined? BasicObject::Array
<sphex> mooff: ok. so "defined?(::Array)" should work in a BasicObject.
<sphex> How comes "defined?(Array)" doesn't work where an "Array.new" would just work though? This is a bit confusing...
<mooff> ::Array yeap
<mooff> Array.new wouldn't work there for the same reason
<mooff> == class Baz < BasicObject; Array.new; end
<ruby-eval> ERROR: uninitialized constant Baz::Array
<ruby-eval> (eval):1:in `<class:Baz>'
mark22k has quit [Quit: The Lounge - https://thelounge.chat]
mark22k has joined #ruby
<sphex> mooff: oh ok.
<sphex> well, it's different in a Delegator though. "class Test < Delegator; def self.test = Array.new; end; p Test.test". There "Array.new" works but "defined?(Array)" doesn't.
<mooff> huh, weird
<sphex> anyway not a huge deal, I can make my thing work now, but that's still a bit confusing... so thanks guys.
<sphex> mooff: alright I'm going to check this out
<mooff> == require 'delegator'; class Delegator; [Array, defined? Array]; end
<ruby-eval> ERROR: cannot load such file -- delegator
<ruby-eval> Did you mean? delegate
<ruby-eval> <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<ruby-eval> <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<mooff> == require 'delegate'; class Delegator; [Array, defined? Array]; end
<ruby-eval> => [Array, nil]
<mooff> that's very weird o_O
<mooff> they must override const_missing or const_defined? on the Delegator class itself
<sphex> mooff: oh yeah. I just checked. it does that.
<mooff> though i don't think defined? actually uses const_defined?. must be const_missing ?
<sphex> So that works for regular constant references, but not "defined?"...
<mooff> makes sense
<mooff> good luck with it.. mind sharing your use case?
<sphex> mooff: it only redefines const_missing. I wonder if redefining const_missing? would make defined? work...
ruby[bot] has quit [Remote host closed the connection]
<sphex> mooff: nothing special really. I just have a Delegator class and I tried using "defined?" in it and it wasn't working right. While other constant references seemingly worked.
ruby[bot] has joined #ruby
<mooff> sphex: const_missing? is instead const_defined? :-) but defined? is a syntactic statement rather than a method call.. it doesn't seem to call const_missing?, so we can't override it
<mooff> sphex: use case for the Delegator i mean :-)
<sphex> mooff: a class to temporarily capture $stdout/$stderr in a thread-local way. it delegates to either a StringIO or whatever the real IO object was before that.
<mooff> nice. shame there are no thread-local global variables!
<sphex> yeah I wish there was a simpler/more elegant way to do that. not sure what that would be like though. with Fiber[] the semantics seem good though. it gets inherited between both threads and fibers. works well in ractors too apparently.
<mooff> you might find setting $stdout / $stderr won't catch everything
<sphex> mooff: what could it miss? I'm OK with it working just for the same process (and not across exec()s), I want the capture to be fast and not do syscalls.
<mooff> i've got a vague memory only, but i think some of the stdlib, probably C parts, won't actually send messages to the $stdout / $stderr objects
<mooff> and/or some use STDOUT instead of $stdout
<sphex> ok. well, will see if I spot any of them. I did see some code doing #reopen on $stdout to capture it. that didn't work with my thing either.
<mooff> might be able to #reopen to a pipe, siphoned into your StringIO from a fiber/thread
<mooff> oh, how would the pipe thread know what thread wrote to it in the first place
ua_ has quit [Ping timeout: 255 seconds]
ua_ has joined #ruby
<sphex> eh maybe I'll try to improve it later. I would want it to work across forks/execs eventually I think. if possible. maybe it could switch to a "pipe mode" only when it needs to. so that it stays fast in simple cases. don't really need it right now though.
donofrio_ has quit [Remote host closed the connection]
Triviality has quit [Ping timeout: 246 seconds]
konsolebox has quit [Quit: .]
<_0x1eef> sphex: That description you gave sounds very similar to: https://github.com/0x1eef/test-cmd.rb
<_0x1eef> It uses two pipes: one to capture stdout, the other to capture stderr: https://github.com/0x1eef/test-cmd.rb/blob/main/lib/test/cmd.rb#L47-L71
<_0x1eef> Ah no, sorry, I misunderstood. I think ActiveSupport has a helper for capturing stderr/stdout of the current ruby process fwiw.
zayd has quit [Quit: ZNC 1.8.2+deb2+b1 - https://znc.in]
rvalue has quit [Quit: ZNC - https://znc.in]
Exagone313 has joined #ruby
rvalue has joined #ruby
Exa has quit [Read error: Connection reset by peer]
Exagone313 is now known as Exa
zayd has joined #ruby