Why doesn't Ruby support GTK+ 2.14 and newer versions? - ruby

My application requires a GUI, and I was thinking of using GTK+ because by far it is the best library for Graphical User Interface. When I looked at the GTK+ page and went to Language Bindings, I found the following:
If Ruby is a good language and has a lot of programmers, why doesn't Ruby support GTK+ 2.14 and newer versions?

Because bindings to a more recent versions hasn't been yet written ? ;-)
Ruby-GNOME project is probably the most known implementation, see status of Gtk2. They also provide bindings for Gtk3, version 3.4 .
The differences between 2.12 and 2.24 are relatively marginal, there is no point it should you keep back at writing Gtk2 UIs in Ruby. The project is very active, latest commits was done a day ago.
Btw. linking on Linux/BSD systems is done to the major version so it'll run regardless minor subversion is currently installed. If there is some very specific feature added in latest versions you can write binding yourself, it's very easy. However as you are just at learning stage I'd bet you'll ever get in such situation in the near future.

Related

Do you need to update Ruby manually on a Mac?

Ruby comes automatically installed on OS X. I assume when you get a new Mac it comes with the latest stable release of Ruby. Do you have to update it yourself manually over time, or does it get upgraded automatically when you upgrade your OS?
I assume when you get a new Mac it comes with the latest stable release of Ruby.
No, it comes with whatever release Apple felt confident to support for the lifetime of the OS release.
Do you have to update it yourself manually over time, or does it get upgraded automatically when you upgrade your OS?
Those two are not mutually exclusive.
Yes, it does get upgraded automatically, in order to, e.g., patch security vulnerabilities. However, an OS vendor will generally avoid updating anything they ship as part of the OS as much as possible, since they generally guarantee backwards-compatibility, and the easiest way to guarantee backwards-compatibility for third-party code that you have no control over, is to just not change it.
For example, macOS 10.14.6, which is the current release of macOS and was released 4 weeks ago, ships with Ruby 2.3.7, which was released 18 months ago.
The last release of Ruby 2.3 was Ruby 2.3.8, and the Ruby developers stopped providing security patches to Ruby 2.3 6 months ago. (Note that Apple does still provide security patches for Ruby 2.3 as part of macOS, though.)
So, yes, it does get upgraded automatically, with e.g. security fixes, but if you want a different version than the one shipped with the OS, you have to install it yourself.
Short answer: No.
Long answer:
If you just want a taste of Ruby, then no, you really don't need to do anything.
If you want to use Ruby to do something non-trivial, like beyond a "Hello, world!" application, then yes you should update.
The best approach is to use a Ruby version manager like RVM or rbenv where you can get the latest version of Ruby, specific historical versions if necessary for testing, as well as alternate implementations like JRuby and Rubinius.
These version managers make it possible to have multiple versions of Ruby installed simultaneously and you can switch between at any time. You can even pin different projects at specific versions if they haven't been updated to work with the latest Ruby, a common problem with older code-bases.
This pattern plays out with any language, be it Ruby, Python, Perl, Node.js, C# or what have you. If you're doing serious development in those languages the first thing you do is install a version manager and the best version for your situation.

What versions of lazarus and free pascal are stable and compatible

AFAIK the installation of Lazarus consists from downloading it and FPC from SVN and compiling. There's a problem(*) with the newest versions and I'd like to install a stable version. However, all I have are the SVN revision numbers and I couldn't find out what versions are stable and what work together.
(*) Our application crashes when compiled on Ubuntu 32 and run on OpenSUZE. No idea, what's exactly going on, but this is a too complicated problem for including it in this question.
No, both projects provide releases, and these releases are the only ones formally declared stable, currently Lazarus 1.2.6 (from the 1.2 stable branch) using FPC 2.6.4 (also from stable 2.6 branch).
Lazarus mentions the prefered version of (release, stable) FPC with every release and for 1.2.6 that is 2.6.4.
Of course the status of moving trunk is sometimes more stable than other times, e.g. currently it is quite usable because a new major (FPC) branch is imminent, an event that only occurs once every 2-3 years. But there are no guarantees there, and this branch still must go through the formal release process.
Many users from emerging targets that are not supported in the stable branches often use it though.

Does QtRuby work with Qt 5?

Everything I can find online about QtRuby uses Qt 4, but the current version of Qt is 5. Is this simply a matter of documentation not catching up with reality, where Qt 5 would work just fine with QtRuby?
If you assert that this is the case (that Qt5 is unsupported) then please backup your assertion with evidence.
QtRuby
Qtruby and korundum are not maintained for years now. To get a maintained version of qtruby, install qtbindings as ruby gem.
Qtbindings home page: https://github.com/ryanmelt/qtbindings/
Also see https://github.com/ryanmelt/qtbindings/issues/131 for a discussion about supporting Qt5.
Ruby-QML
Ruby-qml is a QML / Qt Quick wrapper for Ruby. It provides bindings between QML and Ruby and enables you to use Qt5 Quick-based GUI from Ruby.
The bindings provided by Ruby-QML are much leaner in comparison to QtRuby. In particular there is no direct access to the Qt classes' methods. That might first seem to be a a disadvantage when coming from QtRuby.
When learning to use use Ruby-QML, it turns out quickly that the advantages outweigh the limitations:
QML and JS greatly complement to describe and model the static and dynamic aspects of the UI
The user community of QML/JS is huge. It is so much easier to find examples or help to solve QML/JS issues, than it was within the tiny QT/Ruby community.
The examples on Ruby-qml are pretty much complete to demonstrate the constructs needed to get started.
JS may be used as flexible 'glue logic' between Ruby and Qt.
QtRuby only supports Qt 4 for the time being. Hopefully, it will change soon, but this seems to be the reality at the time of writing this.
The last release happened two and half a years ago as the time of writing this. That can be seen here:
http://rubyforge.org/projects/korundum/
As you can see, that is also a Qt 4 release as its name says: qt4-qtruby-2.2.0.
That information is also getting from their outdated KDE Wiki in here:
http://techbase.kde.org/Development/Languages/Ruby
If this is still not enough proof, you can look into the code yourself to see it is not actually binding Qt 5 classes added in that major Qt variant.
Here is a quick ls after decompressing the latest tarball:
lpapp ~/Downloads/qt4-qtruby-2.2.0/qtruby/src/lib $ ls
CMakeLists.txt Qt Qt.rb Qt3.rb Qt4.rb

Rich and widely used Ruby GUI framework for Windows?

I read about wxRuby and Shoes but never used them. I want to learn ruby by developing a real-world serious Windows application. Among the available frameworks, which one is widely used and acceptable, rich in libraries and comes bundled with .exe builder?
There aren't a great deal of sensible choices for client/desktop applications in Ruby right now, however I believe one of your best options is to take advantage of mature JVM libraries via JRuby.
The Redcar text editor is written in Ruby and runs on the JVM, and you can view the source on Github here https://github.com/danlucraft/redcar
There is also a development company called Atomic Object that made a neat Ruby desktop app using JRuby with a fairly sophisticated GUI and you can view that here.
I've been thinking about the exact same problem as you and keeping and eye on my the options, these last few months :-)
I've also been using JRuby on the server-side and it's solid and reliable.
Finally, if it's Windows-only as you say, then you could consider using a .NET GUI Framework like WPF and build it using IronRuby, however IronRuby is not yet as mature as JRuby, so you could be exposing yourself to some risk there in terms of compatibility, bugs and performance (and for the record, I like IronRuby!).
However, the potential issues of using IronRuby might be balanced out by the gains you'd make using a GUI framework that's designed and optimised for Windows and is nicer than Swing. WPF is about as rich as it gets for GUI frameworks on Windows.
There are bindings for Qt on GitHub. I believe it's a fork from the Korundum bindings from KDE. However, I haven't tried it on Windows yet.
You might consider using RubyTk. Tk is a toolkit that works with many languages including ruby. For more information see tkdocs.com
disclaimer: I have no idea how widely used it is, though Tk in general is used in many places for both commercial, internal and open source projects.
http://en.wikibooks.org/wiki/Ruby_Programming/GUI_Toolkit_Modules will help
In terms of popularity, in 2008 shooes was most popular, but that has probably dropped.
http://www.pressure.to/ruby_gui_survey/
Since RubyInstaller project bundles now complete modern Tk distribution and bindings eliminating Windows installation woes- Tk seems the way to go.
With RubyGems I believe it is now possible to install GTK+ for this. So says this in Gems. This is a widely used framework, both in open source and industry. It is used in GIMP and, I think, presents a good windows system that is close to native and easily useable.

What version of Ruby to learn?

I've wanted to learn Ruby for some time and even started to learn a little bit. I then got distracted and for some reason went with Python. I have now however decided that even though my current project is in Python, I will also be learning Ruby and Ruby on Rails.
If somebody were to ask me what version of Python to start with I'd suggest 2.6 because 3 breaks compatibility with all the tutorials they would google. Knowing so little about Ruby, what version should I install on my computer? Is there a major difference between any two versions etc etc?
The version you learn is not that important.
While there will eventually be a shift from the more stable 1.8.x series, 1.9 isn't game breaking in a way where you will be disadvantaged.
Rails recommends version 1.8.7, so if you're going to be learning rails, I'd stick with that. This book is pretty good.
I don't think Ruby has had that many breaking changes - except 1.9 onwards. So any version in the 1.8.x should be fine.. pick the latest stable version.
Rails on the other hand has changed dramatically in Rails 2.
If you're going to be working in Windows, go with the current most stable one-click installer. At time of writing, that would still probably be the 1.8.6-26, although 1.8.6-27 is imminent. 1.8.7 is a small increment and I'm very uncertain about the status of 1.9.1 on the platform.
On OSX or other *nix varieties I'd be prepared to be somewhat more adventurous: the current production Rails release (2.3.2) is supposed to be 1.9.1-compatible (although that may not be the case with all third-party libraries for some time) and learning might be more entertaining with the latest version. It should run a good but faster, too.
Ruby 1.9 makes a few breaking changes, but not like Python 3. Any old Ruby tutorials should work just fine for 1.9. There's nothing like, for example, Python changing print and merging range() with xrange().
It really doesn't make that much difference. The core language hasn't changed a lot — 1.9 is just a lot faster and has gained some new features.
There are some changes that broke some libraries, but those have more to do with the finer implementation details rather than what you learn in basic tutorials, so it shouldn't hurt you. If you want to go with 1.8 for the better library support, that's fine. If you want to go with 1.9 for the better core features, that's fine as well. It doesn't make that much of a difference when you're just starting off.
If you're planning on building stuff that you don't release to the public, that makes use of lots of libraries, 1.8.7 or 1.8.6. If you're writing libraries that will be released to the public, please, please, please make sure they work in Ruby 1.9. Ruby 1.9 is a superior interpreter, but we're stuck with 1.8.x because so many libraries are incompatible with it right now.
http://isitruby19.com/
Learn the latest version. Current latest version is 2.4., but when higher versions are out, go for them immediately. Ruby team pays attention to only release finished work, you don't need to be afraid to install the newest one.

Resources