This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Curious Parcel reload issue
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Here's a problem in VisualWorks, along with a solution. Say you want to be able to reload parcels (presumably updated) in a runtime image, so you have code that looks like this:
Parcel quietlyLoadParcelFrom: file
If the reload results in rebinding existing code (a near certainty), you'll have the load silently fail - not at all what you want. Why does that happen? Well, try reloading a parcel in a dev image. You'll get a dialog asking you if you really want to reload the parcel. That's because the reload triggers a DuplicateBindingsError - and the development environment asks you what to do. When you try to silently (i.e., no dialogs) load the parcel in a dev image, that exception isn't being specifically looked for, and it just quietly fails. Here's what you want to do:
[Parcel quietlyLoadParcelFrom: file]
on: DuplicateBindingsError
do: [:ex | ex resume]
It turns out that this error is proceedable (as you would expect!). So simply resuming it ends up doing the right thing. I've filed a bug report on this, and am using this as a work-around in the dev builds of BottomFeeder.