-
Notifications
You must be signed in to change notification settings - Fork 4
WSCL issue: sequence-definition #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jcguu95
wants to merge
4
commits into
s-expressionists:main
Choose a base branch
from
jcguu95:sequence
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
Issue: SEQUENCE-DEFINITION | ||
Forum: Cleanup | ||
Category: CLARIFICATION | ||
Status: draft | ||
Edit History: 16-May-24, Version 1 by Jin-Cheng Guu | ||
References: SEQUENCE | ||
|
||
Problem Description: | ||
|
||
In the draft ANSI Common Lisp specification, the description of the system | ||
class SEQUENCE [a] conflicts with the description of the Sequence Concepts | ||
[b], where | ||
|
||
[a]: The types vector and the type list are disjoint subtypes of type | ||
sequence, but are not necessarily an exhaustive partition of sequence. | ||
|
||
[b]: A sequence is an ordered collection of elements, implemented as | ||
either a vector or a list. | ||
|
||
Proposal: (SEQUENCE:A-SEQUENCE-CAN-BE-SOMETHING-ELSE) | ||
|
||
This proposal changes the description of the Sequence Concepts so that [b] | ||
instead reads: | ||
|
||
> A sequence is an ordered collection of elements, implemented either as a | ||
vector, a list, or possibly some other implementation-defined object. | ||
|
||
Test Cases: | ||
|
||
N/A (Test cases are difficult to provide, because conformating | ||
implementations are not expected to expose its definition of a SEQUENCE | ||
programmatically.) | ||
|
||
Rationale: | ||
|
||
For Common Lisp implementations that support user defined sequences via a | ||
mechanism like Extensible Sequences LIST and VECTOR will not be an | ||
exhaustive partition of SEQUENCE. In this case [a] is an accurate statement, | ||
but [b] will not be sufficient. | ||
|
||
Current Practice: | ||
|
||
SBCL 2.4.1 | ||
(slot-value (sb-kernel::specifier-type 'sequence) 'sb-kernel::types) | ||
;; => (#<SB-KERNEL:CONS-TYPE CONS> | ||
#<SB-KERNEL:MEMBER-TYPE NULL> | ||
#<SB-KERNEL:ARRAY-TYPE VECTOR> | ||
#<SB-KERNEL:NAMED-TYPE SB-KERNEL:EXTENDED-SEQUENCE>) | ||
|
||
Cost to Implementors: | ||
|
||
None. | ||
|
||
Cost to Users: | ||
|
||
None. | ||
|
||
Cost of non-adoption: | ||
|
||
None. | ||
|
||
Benefits: | ||
|
||
Remove a conflict from the standard. | ||
|
||
Aesthetics: | ||
|
||
No influence. | ||
|
||
Discussion: | ||
|
||
None. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(subtypep 'sequence '(or vector list))
could returnT NIL
orNIL NIL
on an implementation conforming to this proposal, butNIL T
would indicate nonconformance.Also: "conforming"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this.. For a conforming implementation, we do need
(subtypep '(or vector list) 'sequence)
to returnT T
. However, the point of this issue is to give such an implementation the freedom to have something else in the typesequence
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You read the arguments backwards. I'm saying you can test whether
sequence
is a subtype of(or vector list)
, not the other way around. If any non-list non-vector sequences are possible,sequence
is not a subtype of(or vector list)
.Of course I suppose this proposal doesn't necessarily require implementations to have non-vector non-list sequences, so maybe the subtype is inappropriate after all. Considered that way, having test cases at all would be inappropriate, since it's just making the standard more flexible without requiring any implementation to make any changes whatsoever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still confused. Why would
(subtypep 'sequence '(or vector list))
's returningNIL T
indicate nonconformance to this proposal? This proposal aims to provide the freedom for an implementation to havesequence
to possibly have things more than just vectors and lists.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A value of
NIL, T
orNIL, NIL
indicates the implementation does not conform to the current [b].For this issue, the test cases would not indicate conformance or non-conformance, but indicate whether LIST and VECTOR are exhaustive for the typespace of SEQUENCE. Supporting extensible sequences would require returning
NIL, T
, I would think.