m. is always a path when m names a module of this package, the package itself, a dependency
or core. A local (parameter, let, var, for or pattern binding, closure parameter) with the
same name makes m.f(...) ambiguous: it could be a call on the value or a call of the module's
function. Auk rejects it instead of picking one silently. Rename the local.
Locals do shadow the core modules fs net time rand env proc str int float: with a parameter
env, env.get(k) is a method call on it, and core.env.get(k) still reaches the module.
Wrong#
The project has a module src/geo.auk:
[package]
name = "app"
version = "0.1.0"pub fn area(w: int, h: int): int = w * hfn first(geo: [int]): int? = geo.first()
fn main() { print(first([1, 2])) }Fixed#
fn first(sizes: [int]): int? = sizes.first()
fn main() { print(first([1, 2])) }Common causes#
- A parameter named after a helper module of the project (
geo,parse,util). - A parameter named after a dependency (
json,http,csv).