29
78
Fork
You've already forked r7rs
2

Uninterned symbols #70

Closed
opened 2022年04月14日 13:24:28 +02:00 by mnw · 6 comments
Member
Copy link

They haven't been standardized in small nor in earlier reports. The large language may want to introduce them. They can be useful for implementing a variety of things, e.g. the colors/marks of the syntax-case expansion algorithm.

They would be most useful if they would also obey read/write invariance. This can be achieved if the implementation associates a UUID to each of them and given them a written representation, e.g. in Chez's form #{<pretty name> <uuid>}.

Technically, this wouldn't make them uninterned anymore. They would be symbols interned by their UUID and not their name.

They don't necessarily have to be a subtype of symbols but could be their own type, but this would probably be a novelty among most existing implementations.

The Foundations would have to provide at least (gensym [<string>]) and (gensym? <obj>) together with the definition of an external representation.

Alternatively to the above, (gensym) could just return an ordinary symbol whose name is random in the sense of Version 4 UUIDs. In that case, there would be no gensym?.

They haven't been standardized in small nor in earlier reports. The large language may want to introduce them. They can be useful for implementing a variety of things, e.g. the colors/marks of the syntax-case expansion algorithm. They would be most useful if they would also obey read/write invariance. This can be achieved if the implementation associates a UUID to each of them and given them a written representation, e.g. in Chez's form `#{<pretty name> <uuid>}`. Technically, this wouldn't make them uninterned anymore. They would be symbols interned by their UUID and not their name. They don't necessarily have to be a subtype of symbols but could be their own type, but this would probably be a novelty among most existing implementations. The Foundations would have to provide at least `(gensym [<string>])` and `(gensym? <obj>)` together with the definition of an external representation. Alternatively to the above, `(gensym)` could just return an ordinary symbol whose name is random in the sense of Version 4 UUIDs. In that case, there would be no `gensym?`.
Owner
Copy link

I’ve previously (c. 2010, I think?) experimented with gensyms with read-write invariance, using a UUID-like solution, and found them pretty useless. (I intended them to be useful for sending data including gensyms across a Unix pipe between two Lisp processes. This turned out not to be worth the trouble.)

In general I think we should not standardize them. Even if they’re useful for implementing generate-temporaries, that’s an implementation detail. (I guess you could use them to implement marks as well.)

There are a couple of other things I’ve used gensyms for in other Lisps, e.g. as a sentinel value in certain algorithms/data structures signalling a special case. In Scheme I currently do this by consing a pair and checking for it with eq? to handle the special case (cf. how Chibi handle multiple values), but I intend to propose a SRFI for ‘sentinel objects’ — values with no contents and no semantics other than equality, and by extension whatever meaning a program attaches to their existence or presence in a certain context.

I’ve previously (c. 2010, I think?) experimented with gensyms with read-write invariance, using a UUID-like solution, and found them pretty useless. (I intended them to be useful for sending data including gensyms across a Unix pipe between two Lisp processes. This turned out not to be worth the trouble.) In general I think we should not standardize them. Even if they’re useful for implementing `generate-temporaries`, that’s an implementation detail. (I guess you could use them to implement marks as well.) There are a couple of other things I’ve used gensyms for in other Lisps, e.g. as a sentinel value in certain algorithms/data structures signalling a special case. In Scheme I currently do this by consing a pair and checking for it with `eq?` to handle the special case (cf. how Chibi handle multiple values), but I intend to propose a SRFI for ‘sentinel objects’ — values with no contents and no semantics other than equality, and by extension whatever meaning a program attaches to their existence or presence in a certain context.
Author
Member
Copy link

What do you mean by "not worth the trouble"? Where's the trouble?

In your use case, you may have found them pretty useless but this observation certainly does not extend to other users.

If they are cheap to implement, their semantics are clear and they are easy to spec, there's no reason not to ship them.

Gensyms are indeed not needed for your sentinel objects, but that's not why I am proposing them here.

What do you mean by "not worth the trouble"? Where's the trouble? In your use case, you may have found them pretty useless but this observation certainly does not extend to other users. If they are cheap to implement, their semantics are clear and they are easy to spec, there's no reason not to ship them. Gensyms are indeed not needed for your sentinel objects, but that's not why I am proposing them here.

If they are cheap to implement, their semantics are clear and they are easy to spec, there's no reason not to ship them.

If you really mean that, it is an abdication of responsibility. CL's TAGBODY meets these requirements, and cab even be implemented in syntax-rules using tail recursion (which CL does not have): should it therefore be included in R7RS-large, much less the foundation language? I think not. And that is just one of thousands of such things.

> If they are cheap to implement, their semantics are clear and they are easy to spec, there's no reason not to ship them. If you really mean that, it is an abdication of responsibility. [CL's TAGBODY](http://clhs.lisp.se/Body/s_tagbod.htm) meets these requirements, and cab even be implemented in `syntax-rules` using tail recursion (which CL does not have): should it therefore be included in R7RS-large, much less the foundation language? I think not. And that is just one of thousands of such things.
Author
Member
Copy link

If they are cheap to implement, their semantics are clear and they are easy to spec, there's no reason not to ship them.

If you really mean that, it is an abdication of responsibility. CL's TAGBODY meets these requirements, and cab even be implemented in syntax-rules using tail recursion (which CL does not have): should it therefore be included in R7RS-large, much less the foundation language? I think not. And that is just one of thousands of such things.

You can't view an argument in isolation.

In the actual case at hand, my argument goes as: if they weren't cheap to implement, that could be a reason not to implement them, despite their well-founded benefits and usefulness to some users and use cases.

> > If they are cheap to implement, their semantics are clear and they are easy to spec, there's no reason not to ship them. > > If you really mean that, it is an abdication of responsibility. [CL's TAGBODY](http://clhs.lisp.se/Body/s_tagbod.htm) meets these requirements, and cab even be implemented in `syntax-rules` using tail recursion (which CL does not have): should it therefore be included in R7RS-large, much less the foundation language? I think not. And that is just one of thousands of such things. > You can't view an argument in isolation. In the actual case at hand, my argument goes as: if they weren't cheap to implement, that could be a reason not to implement them, despite their well-founded benefits and usefulness to some users and use cases.

In Scheme I currently do this by consing a pair and checking for it with eq? to handle the special case

That certainly works fine; for myself, I prefer (define sentinel (string-copy "sentinel")).

See #71 for my discussion of cheap UUIDs.

> In Scheme I currently do this by consing a pair and checking for it with eq? to handle the special case That certainly works fine; for myself, I prefer `(define sentinel (string-copy "sentinel"))`. See #71 for my discussion of cheap UUIDs.
Member
Copy link

The group voted on 2026年04月30日 to not include either SRFI 258 or SRFI 260.

The group voted on 2026年04月30日 to not include either SRFI 258 or SRFI 260.
Sign in to join this conversation.
No Branch/Tag specified
main
pages
proc-draft
c-trichotomy
global-id-prop-ref
allow-van-tonder-like-expanders
No results found.
Labels
Clear labels
Batteries
Issues for the Batteries volume of the report, providing a standard library
Cleanup
Issues where inconsistencies or other infelicities have arisen
Consent Docket
Items which will be automatically be given a certain resolution if no objection is made by a certain date
Environments
Issues for the Environments volume of the report, providing OS interfaces and similar
Foundations
Issues for the Foundations volume of the report, related to the core language semantics
Macrological Fascicle
Meta
Procedural and organisational issues
Multiple proposals exist
Multiple competing, concrete proposals to resolve this issue exist (whether they are SRFI or still only pre-SRFI)
Pie-in-the-sky ideas
Ideas currently lacking any form of worked-out proposal
Problems without solutions
Problems we *must* solve but haven’t worked out any solution for yet
Procedural Fascicle
Public Comment
Publications
Issues related to the practicalities of making the report available
Question
For information and clarification
R6RS Compatibility
Issue touches on questions of R6RS compatibility
R7RS-small
Issues with the Small language Report
Resolution in draft
A resolution (not necessarily final) is specified in the current draft of the relevant fascicle
Specification exists
Proposals for which a viable, but incomplete specification text exists
SRFI/RnRS spec exists
A SRFI for this proposal exists, or a solution from another RnRS
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
scheme/r7rs#70
Reference in a new issue
scheme/r7rs
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?