Could Mutex be an eqtype in future? (I see it is currently implemented as a word ref….)
-- Michael Norrish (Associate Professor) School of Computing, The Australian National University Canberra ACT 2600, AUSTRALIA michael.norrish@anu.edu.au W: comp.anu.edu.au/people/michael-norrish TEQSA Provider ID: PRV12002 (Australian University) | CRICOS Provider Code: 00120C
On 26/05/2026 08:15, Michael Norrish wrote:
Could Mutex be an eqtype in future? (I see it is currently implemented as a word ref….)
I guess it could be in principle. It definitely has to be mutable so equality would be pointer equality. The type is given in Thread.sml as "word ref" but actually the implementation is dealt with by the various code-generators.
David
The reason I ask is because I would like to replace a standard ref with an Isabelle-derived Sref.t type in a larger composite type, and I can’t make the Sref an equality type unless the Mutex is one too.
Thanks, Michael
From: David Matthews David.Matthews@prolingua.co.uk Date: Wednesday, 27 May 2026 at 00:41 To: polyml@lists.polyml.org polyml@lists.polyml.org Subject: [Polyml] Re: Mutex as eqtype?
On 26/05/2026 08:15, Michael Norrish wrote:
Could Mutex be an eqtype in future? (I see it is currently implemented as a word ref….)
I guess it could be in principle. It definitely has to be mutable so equality would be pointer equality. The type is given in Thread.sml as "word ref" but actually the implementation is dealt with by the various code-generators.
David
_______________________________________________ Poly/ML mailing list -- polyml@lists.polyml.org To unsubscribe send an email to polyml-leave@lists.polyml.org
On 28/05/2026 01:31, Michael Norrish wrote:
The reason I ask is because I would like to replace a standard ref with an Isabelle-derived Sref.t type in a larger composite type, and I can’t make the Sref an equality type unless the Mutex is one too.
You could wrap another ref type constructor around the mutex, and keep that private to the new type.
Makarius
True! Thanks—Michael
From: Makarius makarius@sketis.net Date: Thursday, 28 May 2026 at 19:27 To: Michael Norrish Michael.Norrish@anu.edu.au; polyml@lists.polyml.org polyml@lists.polyml.org Subject: Re: [Polyml] Re: Mutex as eqtype?
On 28/05/2026 01:31, Michael Norrish wrote:
The reason I ask is because I would like to replace a standard ref with an Isabelle-derived Sref.t type in a larger composite type, and I can’t make the Sref an equality type unless the Mutex is one too.
You could wrap another ref type constructor around the mutex, and keep that private to the new type.
Makarius