-
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
type bound operator to override default
and var
initialization
#290
Labels
Comments
timotheecour
changed the title
proc
proc Nov 25, 2020
=default
(t: typedesc): t {.compileTime.} type bound operator to override
default`=default
(t: typedesc): t {.compileTime.} type bound operator to override default
timotheecour
changed the title
proc
proc Nov 25, 2020
=default
(t: typedesc): t {.compileTime.} type bound operator to override default
=default
(t: typedesc): t {.compileTime.} type bound operator to override default
and var
initialization
timotheecour
changed the title
proc
Nov 25, 2020
=default
(t: typedesc): t {.compileTime.} type bound operator to override default
and var
initialization=default
type bound operator to override default
and var
initialization
Why not |
why would it be more efficient? var a: Bar
# a is not zero-initialized, it's directly initialized to `=default(Bar)`,
# possibly from ROM |
This was referenced Feb 5, 2021
This RFC is stale because it has been open for 1095 days with no activity. Contribute a fix or comment on the issue, or it will be closed in 30 days. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#252 was already accepted in the form of #252 (comment)
This leaves open another point, which is initialization for non-object types (as was suggested in #252 (comment))
proposal
allow type bound
=default
operator to overridedefault
andvar
initialization.it must be a
compileTime
proc (or at least compiler will only call it at CT).invariant:
var a: T
is always equivalent tovar a = T.default
example 1
example 2
in system.nim, add
so that:
The text was updated successfully, but these errors were encountered: