[Cuis-dev] Follow-up: #terminate and #suspend update

Juan Vuletich juan at cuis.st
Sun Jan 22 09:18:01 PST 2023


Hi Jaromir,

On 1/22/2023 10:18 AM, Jaromir Matas via Cuis-dev wrote:
>
> Hi Juan,
>
> Here’s a test illustrating the situation described below, resulting in 
> executing unwind blocks of a process considered terminated by the 
> current termination semantics. I assume it’s no harm to keep this 
> semantics; an alternative would be to consider a process terminated 
> iff the suspended context is nil or all remaining contexts have their 
> pc atEnd. The downside of this approach would be that a process found 
> not terminated could not be simply resumed to finish because there 
> might be dangerous contexts with pc=nil which could crash the vm when run.
>
> Best,
>
> --
>
> *Jaromír Matas*
>

I guess you are the first person to realize of this.

I think that changing the semantics of #isTerminated or any other such 
method is likely to break existing code, and create a compatibility 
problem. Maybe we'd need to add a new possible state to Process, and new 
testing selector(s).

WRT the code in the message below, it looks OK AFAIK. It is now at GitHub.


Thanks!!!

>
> *From: *Jaromir Matas via Cuis-dev <mailto:cuis-dev at lists.cuis.st>
> *Sent: *Saturday, January 21, 2023 17:12
> *To: *Juan Vuletich <mailto:juan at cuis.st>; Discussion of Cuis 
> Smalltalk <mailto:cuis-dev at lists.cuis.st>
> *Cc: *Jaromir Matas <mailto:mail at jaromir.net>
> *Subject: *Re: [Cuis-dev] Follow-up: #terminate and #suspend update
>
> Hi Juan,
>
> Thanks for your message.
>
> I’m enclosing a test for isTerminated documenting the current semantics.
>
> A few notes here:
>
> 1) I’ve added MethodContext>>#endpc as an analogue to 
> MethodContext>>#startpc but could you please doublecheck it’s ok? I 
> could have used a temp var assignment "endpc := self closure startpc + 
> self closure size - 1" instead but it seemed a bit awkward.
>
> 2) Currently we consider contexts with pc=nil as a sign of terminated 
> processes. In theory a context with pc=nil can still contain a 
> relevant unexecuted code, e.g. unwind blocks:
>
> Example: if you terminate a “terminated” process with an unexecuted 
> unwind block(s) and pc=nil in the suspended context (or below in the 
> sender chain) the unwind block(s) will get executed – which may be 
> perfectly appropriate but sounds a bit unexpected. I know these are 
> wildly hypothetical scenarios but I just wanted to make you aware.
>
> Best,
>
> Jaromir
>
>

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230122/82dc1bda/attachment.htm>


More information about the Cuis-dev mailing list