-
Notifications
You must be signed in to change notification settings - Fork 262
access to generator names #2314
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
base: main
Are you sure you want to change the base?
Conversation
I'd rather have an API that preserves the ability for contexts to generate names on the fly. |
Ok, thanks. Would this version be acceptable with |
What is the exact use case here? What is the problem with returning newly allocated strings? |
In general, I would like to have a way of accessing the names of the generators. In practice, in the cases I am really interested in, I could probably just call A concrete use case is for changing the base ring of a polynomial ring. There is no real problem with returning newly allocated strings, it just feels a bit complicated when in 99% of cases a pointer to the existing names array would do the job. Take the previous example: either you return the generators one by one and the user must arrange them in an array to call |
Indeed, and this is already an issue:
For that reason, a method to return the generator names would indeed be useful. However, I'm still not sure about returning names by reference. Something to consider:
Not really, I think allocating temporary arrays and allocating new strings is the least hacky way to do it. For internal use, life would be easier if we had a memory-managed |
Do you prefer
|
I think I'd go with
|
An API for accessing generator names.
This includes some debatable choices. Most importantly, I am treating contexts as containers as regards generator names (not using status flags, providing pointers to names owned by the context rather than writing to a separate buffer), which basically makes it impossible to write a context that generates the names on the fly and does not want to store them forever. Also, the method for accessing the names returns an array of generator names rather than individual names.