Open
Conversation
Contributor
|
Thanks for your pull request and interest in making D better, @Bolpat! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
BasicType by PrimaryType mostlyBasicType by PrimaryType
Contributor
|
Has that DIP been accepted? DMD uses |
tim-dlang
reviewed
Sep 26, 2024
tim-dlang
reviewed
Sep 26, 2024
tim-dlang
reviewed
Sep 26, 2024
Contributor
Author
|
There have been some unintentional changes slipping through. I don’t know how or why… I’ll look into this tomorrow. |
207339a to
d4e013b
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Essentially, this change renames
BasicTypetoPrimaryTypeand givesBasicTypea new meaning.The entity
BasicTypeand the term basic type will be used for the non-recursive rules in the type grammar. The recursive rules areTypeCtor(Type)and__vector(Type). Those would constitute elaborate primary types (with elaborate = non-basic). The non-recursive rules are e.g. fundamental types, identifiers,mixintypes,typeoftypes, etc., stuff that doesn’t immediately require parsing aTypeagain.This is in prospect of the Primary Type Syntax DIP which, if accepted, will make
PrimaryTypetruly be the type equivalent toPrimaryExpressionin the expression syntax. Note that any DIP that adds tuples to the grammar based on parentheses, e.g. one that makes(int, int)a type, will profit from this change because such a type would be an elaborate primary type, and parts of the grammar spec (or forum discussions) can then easily distinguish primary and basic types in places where parsing ambiguity must be avoided.In particular, this change allows the grammar spec to require a non-trivial type construct that is not a qualified type in code. This makes sense in places where the qualifier would be ignored if given, e.g. base class lists and, possibly in the future, the argument of
__vector.I’m not that deep into the SIMD types, so I left it alone, but as far as I understand, it could be constrained syntactically so that providing an ill-formed vector type fails fast. Essentially, a vector type would probably be
__vector(BasicType TypeSuffixesopt)where theTypeSuffixesare optional because ifBasicTypeis something other than aFundamentalType, it could already be a static array.The parser changes required by this change are implemented in this PR.
Changes
Most changes are
BasicTypetoPrimaryType.class.dd
Rename
BaseClassList→SupertypeListso it can be re-used for interfaces.Streamline
SuperClassOrInterfaceandInterfaces/Interfaceto*BasicTypes*and re-useBasicTypefrom type.dd. The entitiesSuperClassOrInterfaceandInterfaces/Interfaceare unnecessary; giving these different names has no value because the parser can’t distinguish them anyway. Naming aclasstype later in the list is a semantic error.Among the goals of this PR: A base class or implemented interface should not be spelled out in code with qualifiers, e.g.
const(Object), because it’s equivalent toObject. if amixinortypeofresolves to a qualified type, the qualifiers are still ignored. This is about parsing only.declaration.dd
Rephrased a paragraph mentioning “basic type” with no actual connection to
BasicType.expression.dd
Also renames
BasicTypeWithSuffixestoPrimaryTypeWithSuffixesinterface.dd
Replace
BaseInterfaceList→SupertypeListThere is no value in distinguishing the list of a class and an interface.
Among the goals of this PR: A base interface should not be spelled out in code with qualifiers, e.g.
const(Interface), because it’s equivalent toInterface. if amixinortypeofresolves to a qualified type, the qualifiers are still ignored. This is about parsing only.simd.dd
Because I inlined the
Vectorgrammar entity, some rephrasing was needed.template.dd
For
TemplateValueParameter, I changedBasicTypetoTypebecause this is what the compiler implements and there’s no good reason to change the compiler. This change would also encompass the Primary Type Syntax DIP and (likely) any tuple DIP.Remove the clauses that allow
Constraintfollowed byBaseClassListorBaseInterfaceListas those are not actually supported by DMD and make little sense. (Note:BaseClassListandBaseInterfaceListwere also changed toSupertypeList.)type.dd
Rephrased a paragraph mentioning “basic type” with no actual connection to
BasicType.