real conflicts
#2037
Replies: 1 comment
-
For v0.5 we will assume every conflict is a real conflict. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the same module, can we have a variable and a type (record / or-type) have the same name? Sure, the context tells us if you are referring to the type or variable. Similarly can variable or type and function can have same name. Again, the variable and function can have same name, and the call syntax tells you if it is a function call or variable access (this is what Rust does, foo.x and foo.x() can both refer to public property and public method).
How about type and function name? Again, no conflict.
Component name similarly do not conflict with anything, as component names are invoked in component invocation syntax.
How about passing a component as a "component argument". In this case as well, given the expected type is going to be component type, we know it is referring to component by some name, not some other variable of same name. As long as no variable can be of type component.
How about module? If foo defines a module
bar
and a variable, by same logic we can say, unless module is a type, compiler can figure out if you are referring to foo.bar as module or as variable. What if they have conflicting fields, eg bar is a record with field x, and module also has an integer field x? Conflict.So is module name and variable name the only real conflict? And all other can share name as long as they are of different "category"?
Beta Was this translation helpful? Give feedback.
All reactions