Friday, January 18, 2008

Glimmer Is Stylin'

NOTE: THIS HAS BEEN DEPRECATED AS IT WAS CAUSING SOME NAME CLASHING ISSUES

Take a look at this Glimmer code snippet:

table(SWT::BORDER) {
  layout_data GridData.new(SWT::FILL, SWT::FILL, true, true)
  table_column {
    text "First Name"
    width 80
  }
}

It may look clean enough to a casual SWT developer such as myself, but upon presenting Glimmer at a Chicago Area Ruby meeting, someone pointed out how it violates one of Glimmer's philosophies by repeating the word SWT before every style constant.

Of course Glimmer Listens, and just when you thought Glimmer's syntax couldn't get any cleaner, you get this:

table(border) {
  layout_data GridData.new(fill, fill, true, true)
  table_column {
    text "First Name"
    width 80
  }
}

Notice the difference? Styles don't need a bulky "SWT::" prefix anymore.

Just because Glimmer's fans loyal to its philosophies saw that improvement coming, that doesn't mean there won't be any surprises in the future. ;)

No comments: