Sunday, January 4, 2009

Smallworld turns 20

Smallworld turned 20 in December and I missed it! I have had the privilege of being associated with Smallworld for 12 of those 20 years... some as a Smallworld/GE employee and the rest as a partner in the Geodata/Navigant/Smallworld/GE/RedPlanet/(and now iFactor) career track.

You can read a retrospective from Peter Batty at this blog post.

Tuesday, November 11, 2008

Dialog Designer v1.8 now available

Graham Garlick over at iFactor Consulting has uploaded v1.8 of the open source Dialog Designer. You can get the latest version from the SourceForge Magik Components community or from a zip file at iFactor Consulting.

Here are the release notes:
  • autosave a copy of current XML dialog description to the generated module.
  • dt_dt language added (thank you Frank Wolff @ GE)
  • added button to refresh of icon list, to capture newly loaded modules
  • expose the double_click_notifier attribute for tabular_list and tree_list

Thursday, October 30, 2008

Empty iterator still runs _finally

In my years of doing code reviews I have always gotten on people's cases for writing...


_if _not some_set.empty?
_then
_for a_value _over some_set.fast_elements()
_loop
write(a_value)
_endloop
_endif


... what's the point, I asked, of asking SOME_SET if it is empty? If it is empty, then the loop won't be entered anyways and now you are just cluttering up the file with redundant code. It seems that the following should be equivalent...


_for a_value _over some_set.fast_elements()
_loop
write(a_value)
_endloop


Well, today I learned that those two statements are not equivalent. If you use the _finally keyword, its scope will always be processed, even if the iterator has not even run a single loop.


MagikSF> _for a_value _over {:a,1,"bb",300}.fast_elements()
_loop
show(a_value)
_finally
write("Finally")
_endloop
$
:a
1
"bb"
300
Finally
MagikSF> _for a_value _over {}.fast_elements()
_loop
show(a_value)
_finally
write("Finally")
_endloop
$
Finally


So lesson learned... if your _finally block of code expects some value to be set in the main _loop block, be sure to put error handling in there for the case where the loop had no iterations to process.