ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.55k stars 736 forks source link

[Question]: Service and Object have the same TypeTag #43034

Open Shadow-Devil opened 6 days ago

Shadow-Devil commented 6 days ago

Description

I don't know if this is a bug or intended, but it seems quite strange that both Object and Service have the same TypeTag. I think it was forgotten to add the +1 to the definition of the service tag.

Relevant code: https://github.com/ballerina-platform/ballerina-lang/blob/74c7367c33644cb3464523349896622ac5221a5f/compiler/ballerina-lang/src/main/java/org/wso2/ballerinalang/compiler/util/TypeTags.java#L60-L62

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

MaryamZi commented 6 days ago

Previously (pre-Swan Lake) objects and services used to be two separate things. However, with the current service design, services are just another kind of object, so the two being the same is intentional.

We could probably get rid of the service tag altogether though.

Shadow-Devil commented 6 days ago

Thank you for clarifying it. I also added this change to remove the Service TypeTag in one of my PRs where I found it. (#43035) Commit: https://github.com/ballerina-platform/ballerina-lang/pull/43035/commits/df7f0e782ee45a02058daa57095cabebdc51a48a