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
Calling self.len() inside of any method implementation (in particular, enumerate()) calls the trait method, which is unlikely to be what's desired. The only way to prevent this is to rename len() and is_empty() to something else.
I would suggest length() or enumerator_len() instead of len(). For is_empty(), maybe has_no_elements() or is_void() or is_vacant()?
The text was updated successfully, but these errors were encountered:
SergioBenitez
changed the title
Object::len() and Object::is_empty() conflict with Vec::len(), Vec::is_empty()Object::len() and Object::is_empty() conflict with inherent len(), is_empty()Apr 4, 2024
Yeah that's surprisingly annoying. In the rest of the engine is_empty is just the inverse (is_true). I just never really liked that name because it's not literally true, but true as far as the conditionals is concerned, but we could use this here too. Then at least it's consistent. I think enumerator_len is reasonable because you're supposed to match them anyways and that way this is more explicit.
Calling
self.len()
inside of any method implementation (in particular,enumerate()
) calls the trait method, which is unlikely to be what's desired. The only way to prevent this is to renamelen()
andis_empty()
to something else.I would suggest
length()
orenumerator_len()
instead oflen()
. Foris_empty()
, maybehas_no_elements()
oris_void()
oris_vacant()
?The text was updated successfully, but these errors were encountered: