On 3/3/2010 5:44 PM, Levente Uzonyi wrote:
> Here's a simple example (replace file with any external resource):
> My process opened a file, a termination block will close it if it's
> evaluated. If I send #terminate to the process I expect my file to be
> closed, so I won't leak a file descriptor.
> If the file can't be closed (aka the termination block raised an error)
> then there's a serious problem. It doesn't really matter what happens then.
>> But I don't have to try to convince you anymore, because Andreas is
> about to solve the issue.
Just FYI, the reason why you're not getting through to Igor is because
you're arguing the case from the perspective of a non-well-behaved
termination block which is a lost cause. There simply are no assurances
for that, Igor is correct on that. But that shouldn't stop us trying to
support well-behaved blocks properly. Because if we don't then ensure
becomes entirely random. Or can anyone here explain why it would be
reasonable to expect that this version works:
p := [[Processor yield] ensure:[Transcript show: 'finished']] fork.
Processor yield.
p terminate.
but this one doesn't:
p := [[] ensure:[Processor yield. Transcript show: 'finished']] fork.
Processor yield.
p terminate.
(we're using yield here to denote any kind of process switch) If the
only thing that determines whether an ensure block is executed is a
process switch, then we basically have random, non-predictable unwind
handling. Which is a problem that is entirely unrelated to whether the
unwind block is itself well-behaved or not.
Cheers,
- Andreas