ballerina-platform / ballerina-spec

Ballerina Language and Platform Specifications
Other
167 stars 53 forks source link

Annotation access with service declarations and remote/resource methods #734

Open MaryamZi opened 3 years ago

MaryamZi commented 3 years ago

Description: The annotation access expression requires the typedesc value to access annotations.

But, IINM, it is not possible to retrieve the typedesc in the following scenarios.

Is there or will there be an alternative to access the typedesc in these scenarios to access the annotations using the annotation access expression?

Related Issues: https://github.com/ballerina-platform/ballerina-spec/issues/98

jclark commented 3 years ago

Long-term we need to be able to write listeners in Ballerina, which will require a way to invoke resources and remote methods of services. When we do that, we should make sure we have a way to get the typedesc also (e.g. using typeof).

For a service declaration, the problem is to get to the service object. When you have that, you can use typeof to get to the annotations. A listener can get to the service object when it’s attached. If the service object is needed in other contexts, then the listener could provide a method to list all the service objects that have been attached to it.

For remote methods of clients, now that they are in a separate symbol space, we should probably make ->@ work by analogy with .@.