Summary
After 37.00, changes were applied to (local:)
only be allowed inside functions. While this makes sense, it left us without alternatives on places such as parametric classes or interfaces, where the properties can’t be qualified by using other methods.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Steps to Reproduce
Assume the following structure:
Something(Test:float):void = {}
some_class(t:type) := class {
Something(Test:float):void = {} # Error: this function is ambiguous with the one above
}
This makes sense, since the function name is duplicated and ambiguous.
Before, we used to avoid the ambiguity by using the following to qualify it:
some_class(t:type) := class {
(local:)Something(Test:float):void = {} # No error, worked fine before v37.00, and was the only way possible to qualify fields on parametric classes/intefaces
}
But since (local:)
is not allowed on class scopes after v37.00, that is not possible anymore. In a non-parametric class/interface we just do:
some_class := class {
(some_class:)Something(Test:float):void = {} # works fine
}
The example above works only on non parametric classes/interfaces. But, the same syntax does not work on parametric classes and interfaces, giving other errors:
##### Example 1:
some_class(t:type) := class {
(some_class(t):)Something(Test:float):void = {} # Error: Qualifier does not refer to a scope
}
##### Example 2:
some_class(t:type) := class {
(some_class:)Something(Test:float):void = {} # Error: Could not determine the type referred to by this qualifier
}
The same happens with parametric interfaces and/or child classes, with no syntax or alternatives to do it properly:
my_interface(t:type) := interface {
Something : t
}
my_class := class(my_interface(int)) {
(my_interface(int):)Something<override> : t = 10 # Error: Qualifier on definition is invalid, 'my_class' doesn't inherit from or implement 'my_interface(int)'
}
#### Also tested with:
my_class(t:type) := class(my_interface(t)) {
(my_interface(t):)Something<override> : t = 10 # Error: Qualifier on definition is invalid, 'my_class(t)' doesn't inherit from or implement 'my_interface(t)'
}
#### and with:
my_class := class(
InterfaceInstance := my_interface(int) # can also be parent class for example
) {
(InterfaceInstance:)Something<override> : t = 10 # Error: Unknown Identifier 'InterfaceInstance'
}
Since we lack alternatives to properly qualify it (probably due to other bugs causing the errors above), the removal of (local:)
of class scoped properties/functions became a huge wall on functionality, losing control of code structure and not having alternatives.
Due to that, I had projects who needed to change the entire structure to avoid these limitations, and I assume other creators also faced similar issues due to this change.
Expected Result
(local:)
should be allowed on class/interface scopes, or having another method to properly qualify class-scoped properties and functions.
Observed Result
After removal of (local:)
from class scopes, there is currently no alternative to qualify fields on parametric classes or interfaces anymore.
Platform(s)
Verse VM/Compiler
Additional Notes
On the examples above, I used generic names such as “Something
” as conflicting parts of the code that need qualifying. On real scenarios, qualifying should be required by many other reasons, including the project structure, module namings, even internal/built-in verse namings on modules/functions and so on…