haxetink / tink_web

Tinkerbell Web Framework
https://haxetink.github.io/tink_web
43 stars 14 forks source link

`user` special argument and `proxy.Remote` #106

Closed grepsuzette closed 4 years ago

kevinresol commented 4 years ago

I am not very sure what is the key message to be delivered here. Because "implementation of an interface must has the exact signature" is feature of the Haxe language itself. Not a tink_web one.

grepsuzette commented 4 years ago

This is related to the question I asked you on gitter. The removal of user On a client is due to a macro, therefore I think it has to be documented somewhere.

Edit: if we put no information on this, people will simply wonder how it is possible that the client implements a function with a user arg when actually the api call takes no such user. That’s why we need a short sentence to reassure them that “yes the interface must have a user arg, but don’t worry it will be removed on the client.”

kevinresol commented 4 years ago

Personally I found it confusing (perhaps it is a matter of the wording). Because it says Remote needs to implement user but then it says on client side it would be removed

grepsuzette commented 4 years ago

Maybe the phrasing is not clear

But it doesn’t use the word implement:

If you use this approach and have a interface defined for your API with tink.web.proxy.Remote, the interface methods must also have the user argument; on the client-side the user parameter is removed on the Remote.

grepsuzette commented 4 years ago

Maybe it’s because I used the word method instead of function you had this impression. I can replace that? Or how would you say it?

Other suggestion:

If you use this approach and have a interface defined for your API with tink.web.proxy.Remote, note any argument called user in an interface function definition gets automatically removed when compiled on client-side.

kevinresol commented 4 years ago

I think the key problem is this sentence, which is ambiguous and I don't really get what it means:

have a interface defined for your API with tink.web.proxy.Remote

I prefer a simple sentence about remote:

When wrapped by a `Remote` (link to remoting page), the `user` argument is removed.

What do you think?

grepsuzette commented 4 years ago

Yes, think it works!

kevinresol commented 4 years ago

Thanks 🙏