I am working on [Luar](https://github.com/stevedonovan/luar), a reflection
binding library for Lua. The library can convert pretty much anything between Go
and Lua.

Pointers do not make much sense in Lua, so the lib dereferences them before
creating a new Lua value.

Luar also features proxies: the Go values can be accessed from Lua via userdata.
If the value is a slice/map/array/struct, any change made on the proxy will
reflect on the Go side.

Methods can be called on the userdata. If the proxy was created from a pointer,
any modification made to the pointed value by a method call will also show in
Go. Thus pointers matter in that case, since methods can only change the value
if they are called on a pointer, and Luar does not dereference them.

On the other hand, Go does not allow more than one indirection for method calls,
i.e. `func (t **T) bar()` is not OK.

Question: Is there a use case where a Luar proxy should wrap more than one level
of indirection? E.g. if passed `**int`, should Luar wrap `**int` or `*int`?

I tend to think that Luar should always dereference until there is only one
level of indirection left.

Comments?

--
Pierre Neidhardt

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to