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

More usability woes #7

Open
7 of 9 tasks
p0nce opened this issue Jan 3, 2024 · 0 comments
Open
7 of 9 tasks

More usability woes #7

p0nce opened this issue Jan 3, 2024 · 0 comments

Comments

@p0nce
Copy link
Contributor

p0nce commented Jan 3, 2024

I tried to modify njson to use more numem:

  • .length for vector (also: slength for signed length?)
  • .ptr for string
  • for shared_ptr and unique_ptr, .ptr gets repeated a lot, at any point of use. Not sure how alias this can settle that.
  • ref inout(T) for vector index and slices, currently only mutable supported. Tricky with atomics.
  • ref inout(T) for string index and slices

Note during yxml development:

  • unique_ptr!A not naturally covariant with a B class that would descend from A. This is quite complicated, when involving vector!unique_ptr after... ouch
  • nogc_delete crashes if the class instance access its surrounding frame (not a static class). So this shall be documented, I don't see a way out. (EDIT: this is related to std.conv.emplace segfaults for nested types dlang/phobos#10125)
  • unique_ptr can't be copied:
    unique_ptr!A a = unique_new!A();
    vector!(unique_ptr!A) v;
    v ~= a; // fail
    v ~= unique_new!A(); // but this works
    perhaps an explicit ".appendMove" operation?
  • vector!(unique_new!Class) owns every element. But vector!(Struct*) and vector!Class also own every element. It just bypass the whole move constraint and is more usable for now than vector!(unique_ptr!Class)
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

No branches or pull requests

1 participant