--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
This is not a new problem.If you have a function like;foo(var bar) {notifyProperty(bar.second, bar.timestamp)}and you rename the "second" getter on a class Bar, you won't have any link between "bar.second" and "Bar.second". Symbols are the same, it's the name of an object property without a static way to determine which class the object is.I don't see a good solution for that, but maybe recognizing #second anywhere in the code when you rename a member called "second" and asking for each one whether it should be changed. I.e., similar to a global replace with a query for each replacement (and an option to replace all).
With the literal syntax, it would even make sense: #Bar.foo
(except that this syntax is reserved for library names).
Or const Symbol("foo", from: Bar) .
It's a language issue first, since the spec needs to state something like #Foo.qux and #Bar.qux create the same Symbol instance, with the additional class part there only for tools.
Cheers,
Sean Eagan
On Thu, Sep 5, 2013 at 7:39 AM, Sean Eagan <seane...@gmail.com> wrote:
On Wed, Sep 4, 2013 at 10:17 PM, Justin Fagnani <justin...@google.com> wrote:
It's a language issue first, since the spec needs to state something like #Foo.qux and #Bar.qux create the same Symbol instance, with the additional class part there only for tools.The class information will be useful at runtime as well, I wouldn't want to lose it. Any reflective APIs which don't need the class part could just ignore it.
For example, it would be cool to be able to get a version of an instance method, which adds the instance as the first argument. Assume I have:class A {String manyParams(String first, String second, [String third = 'third', String fourth = 'fourth']);}To get the closurization I want, it would not be DRY at all:(a, first, second, [third = 'third', fourth = 'fourth']) => a.manyParams(first, second, third, fourth);
I would rather have some reflective API which takes a Symbol and does this for me:closurize(A#manyParams);
I think this would be better covered by a richer mirror API. Something like:reflect(a)[#manyParams]Which would be equivalent to reflect(a)[#A.manyParams] if you wanted to make it more tool-friendly.