-
Notifications
You must be signed in to change notification settings - Fork 93
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
Suggestions #23
Comments
|
It's significantly longer, while meaning exactly the same.
It is nice for tutorial examples. In any real world use you will quickly discover that the amount of user data will far outweigh the attributes. It also makes sense to highlight DOM elements, since it's a JS object - regular names should be regular members, as they are in JS, and anything different requires a special highlighting to make it clear.
It's no more dangerous than $cell, but removes one keyword and makes things simpler and actually more reliable. |
I agree with @devsnek: I strongly disrecommend switching {
$type: 'my-custom-element',
'my-custom-attribute': true
} With your proposal: {
tag: 'my-custom-element',
'$my-custom-attribute': true // ??
} |
Based on some of these suggestions I've made updates to the API experimentally: Here's a gist using this API: https://gist.github.com/guscost/d47e3437e75cd72293cede3ef847121d It has a couple of changes:
|
There are two main reasons to switch:
I would still prefer $tag, because it's shorter and clearer. Anyway, that's not that important...
How about $body? It's as short as $kids and has proper meaning in the context of DOM. |
Another idea - what if |
This decision should come form the purpose of the library. If it's just to create DOM from JSON, then $ indeed should not be on attributes. But if this library is for dynamic apps, then it makes more sense to mark few special elements and let the user write his code as before. These special variables are not JS variables, they mean different things, that's why they should be highlighted - to make it clear they are proxy entities for DOM. And to not make programmer's life harder by forcing him to mangle all his variables! But anyway, the great thing about this library is that it's tiny, so anyone can easily clone it. If one implementation is not willing to be the smartest implementation, somebody will clone it and make a smarter version. So in the end we will have a very good library, one way or another.
It's one of those cute names, which sounds "cool", but is actually more confusing. The library already has a lot of cute names, like "genotype" and what not. These are fun for 15 minutes, and in general should be avoided. |
Well that's a tough question. What is the purpose of the library? It's hard to say what it might excel at yet, but it might not be the same as something optimized for making big interconnected apps.
Definitely, the small size and reuse of built-in JS features is a huge strength.
I don't agree, the fact that they clearly come from a domain outside of "normal" programming cuts both ways. On the one hand, it violates the principle of least astonishment, but on the other those words can lock people into a certain way of thinking. At least for now, the choice to pick conventions that model biology might be a strength. |
Guys I just wrote a post to address a lot of issues mentioned here #111 Sorry for the delay, i took some time making sure I express myself clearly so that there's no misunderstanding. Note that this post is not some idea that's set in stone. I just wanted to share what I was going through when I made all these decisions, since I haven't really talked about those. So please feel free to share your thoughts after reading that. If you still think some of the ideas are bad, feel free to point them out, would love to discuss further. |
Closing since the linked post addresses all the questions brought up here. I appreciate all the feedback shared above, if you have further questions, please feel free to continue the discussion on the linked post. |
Some suggestions:
Rename $type into $tag, it's more appropriate and less confusing, otherwise: $type: "input", type: "text"
Rename $components into $kids. Again, less confusing, more appropriate and much shorter!
Reverse the naming convention: attributes should start with $, everything else is regular names. Since there are just a few attributes, it makes sense to mangle their names instead of prefixing all the variables with '_', which makes it harder to read. You only use a few reserved keywords (like $tag and $kids), so you can distinguish them from the attributes.
Remove $cell, detect elements by $tag, allow $tag == ''.
The text was updated successfully, but these errors were encountered: