Re: random-port-state? and random-port?
Wolfgang Corcoran-Mathe 04 Jun 2026 19:11 UTC
Peter,
On 2026-06-04 09:08 -0400, Peter McGoron wrote:
> I think the libraries should export a `random-port-state?` and
> `random-port?` procedure that determine if the state/port is was
> created from that library.
I considered adding 'random-port?' when I first started writing the
SRFI. I think it can work if, as you say, we provide a 'random-port?'
procedure for each library. We then have to decide whether
'foo:random-port?' is true only when applied to random ports from the
(srfi 271 ... foo) library. (I think it would have to be, to be of any
use at all.) Could this monomorphism pose an implementation difficulty?
'random-port-state?' poses the same challenge, but in this case it's
easily solved: simply wrap the state vector (or whatever) in a record
type and you get a library-exclusive 'random-port-state?' for free.
This isn't an option with random ports, except in implementations that
allow defining new port types.
What do you think? Is all of this worth it?
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>