Open MostAwesomeDude opened 7 years ago
Why should it be legal?
I can see some appeal, but I think it's important to count the cost every time we make the language bigger.
What's a motivating example to use in documentation, for example?
This is analogous to decorator syntax in Python or Java, and is in general an instance of the Decorator Pattern, aka the Wrapper Pattern, which is common in ocap designs as a way to annotate a particular instance of an object when doing membrane-style constructions like powerboxes, Horton, etc.
For us, it may occasionally be useful to do this technique, popular in older Java:
def via (buildingThing) thing.justOneCustomMethod(arg) { ... }
As a concrete example, consider building simple pumps:
def via (buildingSimplePump) myPump(input :Str) :List[Str] {
return [for piece in (input.split(":") process(piece)]
}
This is not legal, but it should be:
The semantics are that the transformation would happen after auditing, during the binding of the object names to the closure and surrounding scope, and an exception would be raised if the match-bind fails. Yes, this means that
decorator
isn't evaluated until after auditing, and that this would be valid Kernel-Monte and not just valid Full-Monte.