Is there a way to refer to shadowed top-level declarations explicitly? E.g. to call a top-level function from a method of an object in the same package that shadows that top-level function?
d
Dominaezzz
05/05/2020, 12:00 AM
Off the top of my head, you can use a fully qualified call.
your.package.name.topLevelFunction("", 2, .....)
n
natpryce
05/05/2020, 12:00 AM
👍
natpryce
05/05/2020, 12:01 AM
Unfortunately when inlining the object method, that will leave fully qualified names at the original call sites, which are a PITA to clean up.
natpryce
05/05/2020, 12:02 AM
I’m trying to come up with a way to refactor from object methods to top level functions, that leaves the call site looking the same as (or as close as possible to) the original code, because the object and top-level functions provide the syntax of a DSL.
d
Dominaezzz
05/05/2020, 12:02 AM
Oh? You could rename the object method and then inline it.