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

Jaromir Matas mail at jaromir.net
Sun Jan 22 11:29:25 PST 2023


Hi again,

Missed the list, sorry.

As we agree to keep the current isTerminated semantics (also consistent with Squeak/Pharo) I’d suggest to use the test as the documentation of the observed behavior; I’ve added a link to the archive in the comment.

Question: is there a way to make a test an “expected failure” like in Squeak? In Squeak I create a method

ProcessTest>>#expectedFailures

                ^ #(testTerminateTerminatingProcess testResumeTerminatingProcess)

As a result the two listed tests show green in the test runner if they fail.

If possible, I’d like to post two tests that currently fail as a reminder/documentation.

Thanks,
Jaromir


From: Jaromir Matas<mailto:mail at jaromir.net>
Sent: Sunday, January 22, 2023 19:37
To: Juan Vuletich<mailto:juan at cuis.st>
Subject: RE: [Cuis-dev] Follow-up: #terminate and #suspend update

Hi Juan,

> I think that changing the semantics of #isTerminated or any other such method is likely to break existing code, and create a compatibility problem.

True, another reason to keep the current semantics, thanks!

> Maybe we'd need to add a new possible state to Process, and new testing selector(s).

Let’s see, I’ll keep this in mind, thanks again.

Best,

--

Jaromír Matas


From: Juan Vuletich<mailto:juan at cuis.st>
Sent: Sunday, January 22, 2023 18:18
To: 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 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/a0f2b0c8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProcessTest-testTerminateProcessTerminatedViaNiledPc.st
Type: application/octet-stream
Size: 742 bytes
Desc: ProcessTest-testTerminateProcessTerminatedViaNiledPc.st
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230122/a0f2b0c8/attachment.obj>


More information about the Cuis-dev mailing list