Method parameter declaration scope


in the first method, I wanted to let the user choose a value, or use a default value that is calculated somewhere else and stored with the same name. I think the value parameter shouldn’t be declared until the end of that parameter declaration(but should still be visible in the next parameter declaration), like in the second method.


if that “value” is package-level, maybe you can write the full name (with package name) of it to avoid confusion.


I’ve changed the outer value to defaultValue, however I’m curious why function parameter declaration is different from val declaration(if you ever wrote openresty, you know local ngx=ngx), maybe a use case I haven’t considered?