Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
February 24, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- I don't think that the feature was thought to work with abstract types (the spec is very tight on that matter: https://dlang.org/spec/template.html#typed_alias_op). Although what this bug report is asking is a logical extension. -- |
February 24, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement -- |
February 24, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #2 from Paul Backus <snarwin+bugzilla@gmail.com> --- The spec you linked to says: > Alias parameters can also be typed. These parameters will accept symbols of that type ...which is not "tight" at all--it places no restrictions on the type whatsoever. The *grammar* says that the type must be a BasicType, but the definition of BasicType is as follows: > BasicType: > FundamentalType > . QualifiedIdentifier > QualifiedIdentifier > Typeof > Typeof . QualifiedIdentifier > TypeCtor ( Type ) > Vector > TraitsExpression > MixinType Since this includes QualifiedIdentifier, Typeof, and MixinType, it also does not place any restriction on the type used. And in any case, the example given in this issue parses successfully. It's possible that the type was intended to be restricted in some way, but in that case, this is a bug in the spec. Either way, it is certainly not an enhancement request. -- |
February 27, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
February 27, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 --- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to Paul Backus from comment #2) > The spec you linked to says: > > > Alias parameters can also be typed. These parameters will accept symbols of that type > > ...which is not "tight" at all--it places no restrictions on the type whatsoever. When I said "tight", I meant "brief, not too explanatory". > > The *grammar* says that the type must be a BasicType, but the definition of BasicType is as follows: > > > BasicType: > > FundamentalType > > . QualifiedIdentifier > > QualifiedIdentifier > > Typeof > > Typeof . QualifiedIdentifier > > TypeCtor ( Type ) > > Vector > > TraitsExpression > > MixinType > > Since this includes QualifiedIdentifier, Typeof, and MixinType, it also does not place any restriction on the type used. And in any case, the example given in this issue parses successfully. > > It's possible that the type was intended to be restricted in some way, but in that case, this is a bug in the spec. Either way, it is certainly not an enhancement request. What I meant is that the way I read the spec, it seems that template alias parameters would work only for concrete types. I don't know if this was intentional or not, but if the design is extended to work for abstract types as well, then that is an enhancement request. If the person that implemented this did intend to exclude abstract types, then indeed it is a "normal" spec bug. -- |
October 15, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 --- Comment #4 from Paul Backus <snarwin+bugzilla@gmail.com> --- Worth noting that this error is specific to alias parameters. If the example is changed to use a template value parameter, it compiles successfully: --- template foo(T, T t) {} alias _ = foo!(int, 0); // ok --- So, it seems to me that referring to an earlier template parameter in a later parameter's declaration is something that's intended to work in general, and the fact that it doesn't work for alias parameters is indeed a bug. -- |
October 15, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- @SixthDot created dlang/dmd pull request #15691 "fix issue 23733 - Can't use template type parameter as type of alias …" fixing this issue: - fix issue 23733 - Can't use template type parameter as type of alias parameter https://github.com/dlang/dmd/pull/15691 -- |
October 15, 2023 [Issue 23733] Can't use template type parameter as type of alias parameter | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23733 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #15691 "fix issue 23733 - Can't use template type parameter as type of alias …" was merged into master: - 9064a7acc70a5316b1525d8c6f32eff83b29affe by Basile Burg: fix issue 23733 - Can't use template type parameter as type of alias parameter https://github.com/dlang/dmd/pull/15691 -- |
Copyright © 1999-2021 by the D Language Foundation