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
Currently to flag a function in a contract impl block to be a message that can (only) be called from outside we set its visibility to pub(external) like in the following example:
This has some downsides.
Fist of all it might be confusing to use the pub(restricted) syntax to restrict local entities from accessing but unrestrict remote accesses. Also it would be nice to not have to apply those annotation everywhere.
The following syntax might solve these issues.
With the #[extern] semantic attribute we can either annotate functions or entire impl blocks to mark them as callable from remote sources. An example of an annotated impl block can be seen below.
When we have implemented automatic message selectors (IDs) we could use this new syntax to opt-out of automatic ID generation for single messages like this:
We shouldn't break compatibility with ink! 1.0 but can look for new syntax with the upcoming ink_plugin approach. So this issue is superseeded by #163.
Currently to flag a function in a contract impl block to be a message that can (only) be called from outside we set its visibility to
pub(external)
like in the following example:This has some downsides.
Fist of all it might be confusing to use the
pub(restricted)
syntax to restrict local entities from accessing but unrestrict remote accesses. Also it would be nice to not have to apply those annotation everywhere.The following syntax might solve these issues.
With the
#[extern]
semantic attribute we can either annotate functions or entire impl blocks to mark them as callable from remote sources. An example of an annotated impl block can be seen below.Another advantage is that this syntax is more aligned to standard Rust code.
The text was updated successfully, but these errors were encountered: