MyModule<public> := module:
# An example of a struct.
my_struct<public> := struct {}
# Extend MyStruct as if it had this function as a member.
(S : my_struct).SomeFunction<public>() : void = {}
# Example function outside of the module.
F() : void =
# We refer to my_struct using the name of its module.
# This works perfectly :)
MyStructInstance := MyModule.my_struct{}
# We try to call SomeFunction, but we can't :(
MyStructInstance.SomeFunction() # ERROR, unknown member.
In this example, I refer to my_struct
from outside its module by using its module name MyModule.my_struct
. This way, I don’t have to import the whole module with using { MyModule }
.
But, the problem comes when trying to use the extension method SomeFunction()
, as I can’t seem to figure out any syntax that let’s me include the module name. Is it even possible?