On Tue, Jun 9, 2026 at 5:57 PM Jan Wielemaker <jan@swi-prolog.org> wrote:
[...] 
What should the call below do?  After all, foo can be a stream alias
name that either exists, has existed or has never existed.

     ?- current_input(foo).

Turning the above into failure also turns this into a failure.  SICStus
raises a domain error.

Just a comment: if I am not wrong, ISO does not allow aliases in current_input/1. 

P.s. Although I think failing is logically more sound, systems must be
able to safely deal with the ABA issue, i.e., a stream handle is closed
and a new stream is opened using the same term.   This cannot happen in
SWI-Prolog because stream handles are "blobs" that are subject to
Atom-GC and a stream handle can thus only be reclaimed after the old was
reclaimed by atom-GC

Ciao (still) has no proper atom-GC but we keep the object around (marked as "closed") until it is reclaimed. I think we are safe too.
 

        Regards --- Jan
_______________________________________________
Prolog-standard mailing list -- prolog-standard@software.imdea.org
To unsubscribe send an email to prolog-standard-leave@software.imdea.org


--
Jose