-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Dereferencing a ref type
buggy
#11773
Comments
I already mentioned my skepticism on IRC but I think we should have a deref for |
Here is the solution I would use: template `[]`*(T: typedesc): typedesc =
typeof(default(T)[]) This would also work for user-defined smart pointer types that have a deref operation. |
But that requires an instantiation. |
@mratsim, I've seen this misconception being mentioned before. It's wrong. The expression given to |
I reverted this PR. |
after #11751 was merged, the behavior of type dereferencing seems buggy
when compiles(Foo2[])
type Goo1d = Goo1c[]
)ref / ptr
would make sense IMO) vs accessing generic arguments (for which other apis should be used eg typetraits.genericHead, andextractGeneric
([superseded] new macro for generic reflection:extractGeneric(Foo2[float, string], 0) is float
#8554) otherwise it gives ambiguitiesExample
Current Output
inline in the example
Possible Solution
make
[]
only compile forref T
orptr T
other use cases (eg generic access, including for special seq) should use
extractGeneric
The text was updated successfully, but these errors were encountered: