Forum: Ruby-Gnome 2 Simplification for ruby-gnome2 in general: the use of symbols rather than Gtk:: Enum Structures?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2015-07-03 20:40
Hi,

I was looking at old ruby-gnome code that I have here
and see stuff like this:

    notebook = Gtk::Notebook.new
    notebook.set_tab_pos(Gtk::POS_LEFT)

However, it occurred to me that knowing Gtk::POS_LEFT
seems superfluous.

We are using Ruby, not a lower level language here, so
I was thinking, this could be this:


    notebook.set_tab_pos(:left)


And internally get mapped to Gtk::POS_LEFT right?

Now I don't know if this would be good or bad, so I
am just making it as a suggestion - perhaps noone
was thinking about it so far.

I understand that the C API is the main target,
but I wonder if we could use additional constructs
to make the code more ruby-like (just as we
have methods such as set_foo() and also foo= )
This topic is locked and can not be replied to.