-
Notifications
You must be signed in to change notification settings - Fork 23
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
default
should be public instead of redefined everywhere; + proposal for a better implementation
#103
Comments
default
should be public instead of redefined everywheredefault
should be public instead of redefined everywhere; should use default[T]
default
should be public instead of redefined everywhere; should use default[T]default
should be public instead of redefined everywhere; should use default[T] instead of default(T)
default
should be public instead of redefined everywhere; should use default[T] instead of default(T)default
should be public instead of redefined everywhere; should use default[T]() instead of default(T)
I agree, we can do that once the compiler bugs are fixed. |
default
should be public instead of redefined everywhere; should use default[T]() instead of default(T)default
should be public instead of redefined everywhere; + proposal for a better implementation
@Araq I found a way to use the friendlier Which module, system.nim? |
|
Currently
template default[T](t: typedesc[T]): T = var v: T; v
is defined in multiple places:instead of being defined once and exported via
*
(it's also useful in library and user code).how about defining it (once) in
system.nim
, but using the following better definition which allows usage at compile time:EDIT /cc @LemonBoy see my edited proposal above.
NOTE: if nim-lang/Nim#8486 is fixed in the future, we can use the friendlier syntaxdefault(T)
/T.default
EDIT: added
template default*[T](t: typedesc[T]): T = defaultImpl[T]()
The text was updated successfully, but these errors were encountered: