You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Methods of wrapper classes should be marked const #870
For example, Object::Set and ThreadSafeFunction::Release. They don't modify the object itself but only call functions on the N-API object they wrap. This is similar to how the constness of a pointer is orthogonal to the constness of the object it points to.
These methods being non-const means that if I have to call them in a lambda, I have to either capture the object by reference (unidiomatic and not always possible, e.g. with TheadSafeFunction) or mark the lambda as mutable (unusual and misleading since the lambda itself doesn't mutate).
is adding const going to break any existing code (I'm expecting not)
Object::operator[] returns a different type depending on constness (Value or PropertyLValue), but PropertyLValue is implicitly convertible to Value, so I guess it's fine? 🤔
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
Activity
mhdawson commentedon Jan 4, 2021
@seishun is adding const going to break any existing code (I'm expecting not) and any interest in submitting a PR ?
seishun commentedon Jan 5, 2021
Object::operator[]returns a different type depending on constness (Value or PropertyLValue), but PropertyLValue is implicitly convertible to Value, so I guess it's fine? 🤔Sure, working on it.
github-actions commentedon Apr 6, 2021
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.