From: "Hal E. Fulton" Date: 2001-08-16T01:33:00+09:00 Subject: [ruby-talk:19801] Re: The GUI poll is in, and the results aresurprising ----- Original Message ----- From: Lars Christensen To: ruby-talk ML Sent: Wednesday, August 15, 2001 7:24 AM Subject: [ruby-talk:19774] Re: The GUI poll is in, and the results aresurprising Good comments, Lars... My comments and large snips below... HF > Please don't forget what Ruby is all about in this discussion! I think > that the basic principles and idioms of Ruby should be respected in the > GUI that is made the "standard" for Ruby. > > Enjoying coding in Ruby can come to a halt when you are faced with a GUI > API that isn't Ruby's way of doing things. My take: I agree fully... I've even given some thought to a brand-new GUI system... bad idea, because I'm not that good with GUIs, and anyway we already have Babel in this area... > Tk isn't object oriented, at least not with Ruby Syntax. Granted, it isn't pretty. > FXRuby is IMO only a wrapper around a reasonable C++ Gui interface. It > isn't Ruby either. E.g. to declare message identifiers: > That is plain C++ style (or something) coding. Too many techinal > detais (not VHLL). Why not the Ruby way?: Again, not pretty. > > Gtk, I think, it a little cleaner about mapping concepts to the Ruby > Language. I can do "class MyApp < Gtk::Window". Gtk/Ruby uses > assignment methods so that you can do "@buttonbox.border = 10". This is > very intuitive, and its the Ruby way. It also has very few methods > that takes more tthan 1 or 2 arguments. Most things are configured > through methods. > > Gtk is ported to windows. The Ruby/Gtk/Windows combo should be possible > with a little effort. I *think* it's already working... I've seen a lot of GTK code but have not really played with it. > I wish for a GUI API that: > > - Assumes defaults for everything except the basic requirement. Everything > else should be setable through methods. E.g. Label.new('Press me'). > Border, color, font, and everything else should not be arguments to > constructors. Never. Hmm. I wouldn't say "never." I think there should be defaults that can be overridden in the constructor as a shorthand (and also changed afterward via method call, of course). Maybe even a CSS-like system where the user can specify defaults on an app-wide basis. Doesn't Swing do something like that? > - Uses Ruby concepts to the full extends. No win.set_border(40) when > you can handle it with win.border = 40. Use of attribute declerator > methods whenever applicable in the line of attr_*. Yes. > - Allows inheriting classes to create windows or other widgets with > special keyboard/mouse handling. Yes. > For now, I think Gtk is the best canditate (having not tried Qt). In any > case, I want pure ruby style interfaces before portability. With matz > have designed such a great language, it would be a shame to waste it on > ugly APIs. A lot of Java's success comes from it's coherent, > comprehensible and consistent API. There is "one way" to do things, and > they stick to it. I'd like the same thing to happen in the Ruby world. Yes... and if we had a JVM-based Ruby... couldn't we use Swing? Or am I over-simplifying? Hal Fulton