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

&mut self not required for is_*, most to_*, check_*, and opt_* functions, and some others. #46

Open
Parakleta opened this issue Jun 9, 2016 · 1 comment

Comments

@Parakleta
Copy link

The is_* functions do not modify state at all, and having that reflected in their signature makes matches easier.

All of the to_*, check_*, and opt_* functions do not modify state except for those involving strings (including check_option). It is probably still worth considering the pointer returning methods as mutable if they return mutable objects/pointers.

The abs_index, get_top, type_of, typename_of, raw_len, and typename_at also don't mutate the state.

There may be others I have missed.

@therustmonk
Copy link
Contributor

This somewhat limits.

Internally all of is_ methods calls:

LUA_API int lua_type (lua_State *L, int idx) {
  StkId o = index2addr(L, idx);
  return (isvalid(o) ? ttnov(o) : LUA_TNONE);
}

Which never mutate state. I can offer PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants