Whilst writing a blog post today around noSuchMethod, I came across a
couple observations:
Assuming I have a class with noSuchMethod, as follows:
class Person {
noSuchMethod(f , args) {
if (f == "get:name") {
return "Chris";
}
}
}
elsewhere:
var p = new Person();
print(
p.name);
I have two observations:
1. The tools will always give a warning on
p.name
2. Any minification process will need to know not to minify the .name
part of
p.name
Questions:
1. Could there be some way to indicate that a class is actively
handling noSuchMethod (such as the presence of an overridden
noSuchMethod() method), and not produce a warning,
or
Is there a way to suppress these warnings?
(Another solution might be to expect classes that handle noSuchMethod
to implement a specific interface rather than having noSuchMethod in
the base Object)
2. Would this code be expected to run fine in checked mode?
3. How would minification handle using noSuchMethod (especially
minification of javascript)?
Cheers,
Chris
--------------------
http://dartwatch.com