Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using strings for names. #2

Open
lrhn opened this issue Sep 10, 2020 · 1 comment
Open

Using strings for names. #2

lrhn opened this issue Sep 10, 2020 · 1 comment

Comments

@lrhn
Copy link

lrhn commented Sep 10, 2020

You are using strings for names, rather than Symbol.
I'm not unsympathetic to that, symbols are more trouble than they are usually worth, but it can cause issues for dart2js minification.

It also means that library private names are simply strings starting with _, which is ... all in all, probably an advantage.

I'd love to be rid of Symbol, but it does have a valid use in web minification.

@jakemac53
Copy link
Owner

jakemac53 commented Sep 10, 2020

Ya, I did very intentionally use Strings instead. Ultimately the strings must exist anyways in the code so I don't believe Symbols provide any real value that couldn't also be achieved with Strings.

Currently if you want to serialize/deserialize (to/from a Map) an instance of some class using dart:mirrors you have to toString the Symbols representing the names of each field, in order to create the key to insert into the map. So for that reason today afaik the Symbols all have their unminified names in their toString representation, and if they didn't it would anyways be broken for some of our core use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants