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
[WIP] seq[T]
as regular library code
#13324
Conversation
Problems that you will encounter are const seq and seq in vm. Possibly, there is generic solution that can make any container that allocates dynamic memory VM and const compatible. Once such solution found and implemented, it will be possible to make seq a library |
Well, there is still this |
Stalled PR, good idea, but |
just noticed |
This is an experiment / proof of concept to see whether
seq[T]
could be turned into a regular library code without special compiler support, which would simplify lots of things in the compiler if that were the case, as well as remove edge cases (eg #13303 (comment) among many others).many things work but some things don't:
what works
what doesn't work
I tried this but it didn't work:
this could be fixed by making OpenArray first class, eg see nim-lang/RFCs#88; or using a compiler patch
var s: seq[int] = @[]
this one is easily fixed, can be fixed using same hack as I did to support:
const a = @[1,2]
gives:system/gc.nim(103, 24) Error: cannot evaluate at compile time: gch
TODO
macros.tySeq
links
(EDIT)