-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
let text = " the quick brown ";
{
fn trim(x) {
"..." <> x <> "..."
}
// Calls the shadowed trim because Any matches String inside the scope.
print(text.trim());
}
In the example above the best match inside the current scope is used which is probably good!
let text = " the quick brown ";
fn trim(x) {
"..." <> x <> "..."
}
// Calls the original trim because String is a better match inside the same scope?
print(text.trim());
In this example the best match in the current scope is used which is probably fine but at little confusing?
let text = " the quick brown ";
let trim = fn(x) {
"..." <> x <> "..."
}
// Calls the overloaded trim :mild-panic-intensifies:
print(text.trim());
In this example the let binding for trim creates an implicit scope where the new trim shadows the existing trim and the call to trim only finds the last version. This is probably wrong 😢
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working