IMO IllegalResumeAttempt should be resumable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

IMO IllegalResumeAttempt should be resumable

Eliot Miranda-2
Hi All,

    an attempt to resume an unresumable signal results in raising IllegalResumeAttempt; quite right:

Exception>>resume
"Return from the message that signaled the receiver."

self resume: self defaultResumeValue


However, IllegalResumeAttempt is not itself resumable.  So in those rare cases (e.g. test coverage) where a knowledgeable client wants to force resumption of a non-resumable signal by catching and resuming IllegalResumeAttempt, they can't because

IllegalResumeAttempt>>isResumable
^ false


So take e.g.

[Cogit chooseCogitClass testPCMappingSelect: [:m| true]]
on: AssertionFailure
do: [:ex| | ctxt |
ctxt := ex signalerContext findContextSuchThat:
[:ctx| ctx sender selector = #allSelect:].
Transcript ensureCr; print: (ctxt tempAt: 1); flush.
[ex resume]
on: IllegalResumeAttempt
do: [:ex| ex resume]]

where I'm trying to JIT every method in my image and catalogue those that assert-fail, proceeding through the assert failure (and AssertionFailure isn't resumable).  I happen to know that proceeding from the assert-fails is safe.  But I can't force resumption because IllegalResumeAttempt is itself not resumable.

I propose that we make IllegalResumeAttempt resumable.  Objections?  Cautions?

best
Eliot
Reply | Threaded
Open this post in threaded view
|

Re: IMO IllegalResumeAttempt should be resumable

Eliot Miranda-2
Belay that.  Apologies for the noise.  resumeUnchecked: is of course the right solution.  e.g.

Array streamContents:
[:s|
[Cogit chooseCogitClass testPCMappingSelect: [:m| true]]
on: AssertionFailure, Error
do: [:ex| | ctxt |
ctxt := ex signalerContext findContextSuchThat:
[:ctx| ctx sender selector = #allSelect:]. "testPCMappingSelect uses allSelect: to enumerate so return to allSelect: to continue"
s nextPut: (ctxt tempAt: 1).
Transcript ensureCr; cr; print: (ctxt tempAt: 1); cr; flush.
ex searchFrom: ctxt.
ex resumeUnchecked: false]]

On Sat, Jan 22, 2011 at 1:50 PM, Eliot Miranda <[hidden email]> wrote:
Hi All,

    an attempt to resume an unresumable signal results in raising IllegalResumeAttempt; quite right:

Exception>>resume
"Return from the message that signaled the receiver."

self resume: self defaultResumeValue


However, IllegalResumeAttempt is not itself resumable.  So in those rare cases (e.g. test coverage) where a knowledgeable client wants to force resumption of a non-resumable signal by catching and resuming IllegalResumeAttempt, they can't because

IllegalResumeAttempt>>isResumable
^ false


So take e.g.

[Cogit chooseCogitClass testPCMappingSelect: [:m| true]]
on: AssertionFailure
do: [:ex| | ctxt |
ctxt := ex signalerContext findContextSuchThat:
[:ctx| ctx sender selector = #allSelect:].
Transcript ensureCr; print: (ctxt tempAt: 1); flush.
[ex resume]
on: IllegalResumeAttempt
do: [:ex| ex resume]]

where I'm trying to JIT every method in my image and catalogue those that assert-fail, proceeding through the assert failure (and AssertionFailure isn't resumable).  I happen to know that proceeding from the assert-fails is safe.  But I can't force resumption because IllegalResumeAttempt is itself not resumable.

I propose that we make IllegalResumeAttempt resumable.  Objections?  Cautions?

best
Eliot