Add an alias statement to the language. This will provide a workaround for shadowed items.
Consider this example. Due to the namespace-relative functionality, the get method found on line 22 is the outer get function on line 21. However, we wanted to call get.aa() from line 27. We currently have no way to work around this.
That's where the alias statement comes in. It allows declaring a new name for an existing symbol.
alias get2 = get
namespace http
'Do an HTTP request
sub get()
print get2.aa() 'using `get2` aliased symbol here. it's now clear which item we intended to use
end sub
end namespace
namespace get
function aa()
end function
end namespace
Criteria:
aliases are scoped to the current file, and will not leak into the outer component or source scopes.
at transpile time, all referenced items will be transpiled using the original name (i.e. get2.aa() => get_aa())
alias name may not have the same name as an existing symbol.
Add an
alias
statement to the language. This will provide a workaround for shadowed items.Consider this example. Due to the namespace-relative functionality, the
get
method found on line 22 is the outerget
function on line 21. However, we wanted to callget.aa()
from line 27. We currently have no way to work around this.That's where the
alias
statement comes in. It allows declaring a new name for an existing symbol.Criteria:
get2.aa()
=>get_aa()
)