Skip to content
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

Auto-initialize deques #12879

Merged
merged 1 commit into from
Dec 21, 2019
Merged

Auto-initialize deques #12879

merged 1 commit into from
Dec 21, 2019

Conversation

zevv
Copy link
Contributor

@zevv zevv commented Dec 11, 2019

No description provided.

@zevv zevv force-pushed the zevv-autoinit-deque branch 2 times, most recently from 9929805 to 5b8f853 Compare December 12, 2019 20:20
@planetis-m
Copy link
Contributor

tablesimpl.nim does this differently:
First it has a template with the init code

template initImpl(result: typed, size: int)

and uses that directly in init procs. and then a second template that has the if check:

template checkIfInitialized() =
  when compiles(defaultInitialSize):
    if t.dataLen == 0:
      initImpl(t, defaultInitialSize)

which is used in [], []= and etc.

@Araq
Copy link
Member

Araq commented Dec 13, 2019

Yeah, I also find the tableimpl.nim way more elegant.

@Araq
Copy link
Member

Araq commented Dec 21, 2019

Ping @zevv

@zevv
Copy link
Contributor Author

zevv commented Dec 21, 2019 via email

@zevv zevv force-pushed the zevv-autoinit-deque branch from 5b8f853 to c8a10b0 Compare December 21, 2019 16:07
@zevv
Copy link
Contributor Author

zevv commented Dec 21, 2019

Removed init on accessors, refactored to use similar structure as tablesImpl (not sure why this is better, but it is at least more consistent)

@Araq Araq merged commit 28466ce into nim-lang:devel Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants