Open limira opened 5 years ago
I forgot to say that I know what clone!
do now. The improve is just for new users when they first look at dominator!
Statically checking if a child (directly) is allowed in an element, an attribute is available for an element.
I have thought about that, but it's rather difficult to do, and even more difficult to do correctly. It's hard to keep it up-to-date, because every time a new attribute, element, or style is added to the W3C specs, you need to update the code to allow it.
And it gets even trickier when you consider browser support: some browsers might support an element/attribute/style while others don't. So allowing it at compile-time gives the false impression that your code is correct when it isn't.
And it gets even trickier when you consider custom elements, which can have custom names and attributes.
So instead I've generally favored runtime checking (e.g. dominator checks at runtime to make sure that your styles are correct). This catches bugs/typos without any of the above issues.
Add the Component as discuss in #12, and have an example demonstrating it.
I think any sort of component system needs to be carefully developed before I include it in dominator. I don't want to promote a half-baked solution, or a solution which will be deprecated and replaced later.
Luckily, it's easy to create your own components (in whatever style you wish), because dominator is very flexible.
After a component system has been tried and tested in real projects, then I can reevaluate whether to include it in dominator.
Less mysterious macro, especially the clone! (at least document it).
I completely agree that dominator needs a lot more documentation (it's on my todo list).
Able to build directly with wasm-bindgen-cli or wasm-pack?
Yes, my current number 1 priority is to port dominator so it works with wasm-bindgen.
I have thought about that, but it's rather difficult to do, and even more difficult to do correctly. It's hard to keep it up-to-date, because every time a new attribute, element, or style is added to the W3C specs, you need to update the code to allow it.
Personally I am fine with all these downsides. I agree that it's very hard to do everything correctly, but I will give it a try. Decision is made, I will go with my library, although I am not sure what are waiting me in the future.
I think any sort of component system needs to be carefully developed before I include it in dominator. I don't want to promote a half-baked solution, or a solution which will be deprecated and replaced later.
I agree with this. Now, I feel that sending all messages to a single update method a bit awkward for a framework that base on signals. I tried to call directly to each method (similar to dominator, but encourage the separation of update and view by default), but in some special cases I found that I still need a single update method. Every approach have their trade-offs. Decisions are hard.
clone!
How about change the name to handler!
or create_handler!
. I think it less mysterious/confused.
How about change the name to handler! or create_handler!. I think it less mysterious/confused.
How are those clearer? The clone!
macro just calls the clone()
method, that's it. Nothing more.
So these are the same:
clone!(x => y)
{
let x = x.clone();
y
}
In particular, the clone!
macro has absolutely nothing to do with handlers. It is just a macro that makes cloning a bit more convenient, and it can be used on anything that implements Clone
.
Oh, sorry, handler!
is more suitable for my own implementation. I did not think carefully enough before propose to dominator.
Yeah, from your view point, clone!
seems a reasonable name. If a user understand what it does, it seems reasonable too.
But if a user know nothing before, then they read this (from dominator/examples/counter):
clone!(state => move |_: ClickEvent| {
state.counter.replace_with(|x| *x + 1);
})
It just clones a tiny part of the whole big thing you pass to clone!
. What are you thinking if you are not the author of clone!
, not yet read the implementation of clone!
? What does it mean? Cloning the whole big thing?
If you are happy with the name, I think, at least, it should be explained in the simplest example counter
(by adding a comment for it).
Would it help if the macro were named with_clone!
instead? That would better emphasize that it's some parameter being cloned, not the whole thing.
Yeah, maybe, or clone_for!
. But explanation is still needed, for example: in examples/counter:
// This will clone `state`, the cloned `state` will be moved into the closure.
clone_for!(state => move |_: ClickEvent| {
state.counter.replace_with(|x| *x + 1);
})
The real solution is to have proper documentation + a tutorial, which I already mentioned I will do.
Where do I find docs/tutorial?
@Zireael07 Sorry, since I no longer contribute to Rust I haven't made any documentation. Your best option is to look at the examples or ask questions on the Discord server.
There is also the Signals tutorial which gives a basic overview of Signals (which is important, since they are used a lot in dominator).
since I no longer contribute to Rust
Out of curiosity: did you write somewhere why?
@d4h0 I might get banned from GitHub for sharing this, but...
The Rust team recently declared their official support for the Black Lives Matter movement:
https://blog.rust-lang.org/2020/06/04/Rust-1.44.0.html
https://twitter.com/rustlang/status/1267519580756422659
https://twitter.com/rustlang/status/1267519582505512960
Black Lives Matter is a violent political organization that has looted, burned buildings, and murdered innocent black people and black police:
https://en.wikipedia.org/wiki/Shooting_of_David_Dorn
They have been known to be violent and evil for many years. They have publicly admitted to be Marxists:
https://www.youtube.com/watch?v=kCghDx5qN4s
And they have stated that one of their goals is the destruction of Western families:
https://web.archive.org/web/20200408020723/https://blacklivesmatter.com/what-we-believe/
And the money donated to Black Lives Matter is used to fund the Democrat Party in the US:
https://twitter.com/RealCandaceO/status/1271062636315193346
There have been many black people who have come out against Black Lives Matter:
https://www.youtube.com/watch?v=PLuJa9X21PE
https://www.youtube.com/watch?v=X4BveH3iTFM
https://www.youtube.com/watch?v=JocOjvPizzY
Anybody who questions the Rust team on their decision is silenced and told to stop using Rust:
https://twitter.com/halfnibble/status/1267544911697469440
https://twitter.com/nokusu/status/1267547090307239942
https://users.rust-lang.org/t/rust-says-tech-will-always-be-political/43627
Rust is supposed to be an inclusive and welcoming programming language, taking political sides (regardless of the side) goes against that goal.
Also, although the Rust team thinks that promoting Black Lives Matter is a good thing, they did not support the millions of peaceful Hong Kong protestors who were fighting for their basic human rights. That seems very hypocritical to me. Rust is supposed to be international, yet they seem to only care about US issues.
In addition, there has been some very recent extreme moderator abuse by Rust Core Team members:
https://files.catbox.moe/7k3qdh.png
https://files.catbox.moe/le86vq.png
Unfortunately I believe that things will only become worse over time. There will be more forced politics in Rust, and more moderator abuse in the future. Anybody who tries to remain neutral will be silenced and banned.
Thanks for the detailed response, @Pauan!
To be honest, I agree with you 100%.
The "Black Lives Matter" release announcement, and what I found out during the surrounding hubbub, made me a bit depressed (I had invested much time and effort to learn Rust, and I had a similar outlook in regard to Rust's future, as you).
In the end, I decided to continue to use Rust for two reasons:
A) I don't know anything better,
and B) I assume that what makes these people behave in this way is also the reason why they invest their time in improving Rust (assuming these people contribute significantly to Rust. I'm not 100% sure if this is true, however).
I also hope that the situation will improve when the dust has settled.
Because these people are so invested into this cause, it's difficult for them to see the problems that it turned out to have (they probably can see problems, but think that it's still worth it).
The Laws of Human Nature
by Robert Greene is a good book that explains how this happens.
Out of curiosity: what are you using now?
The only alternative to Rust I know (for what I use it) is OCaml/ReasonML, but the ecosystem is too small/inactive.
I also hope that the situation will improve when the dust has settled.
I do not think it will improve. Multiple people on the Core Rust team are very radical leftists/communists, they will always put their agenda and ideology first. If that was not true, they would not feel the need to censor anybody who speaks out.
And with the upcoming election, things will only get even worse.
Out of curiosity: what are you using now?
At work I use TypeScript. For my personal projects... I don't program much anymore. I have not found any other language which comes close to the technical excellence of Rust. But I have considered making my own language...
Even Rust will degrade over time, because Alex has moved away from Rust (he did 90+% of the work on Rust Wasm), and Ashley is now in full control over Rust Wasm.
HK rioters are more violent than BLM by every measure. They literally put some old man on fire for holding a different political view.
They have publicly admitted to be Marxists...
Isn't it strange for you to condemn them for what they believe? Sure I understand that you value law and order, but being a Marxist is not and should not be a crime anywhere, just like being a Christian is not a crime.
@kindlychung Why do you assume that I'm a Christian? I'm not. Do you just assume that everybody who disagrees with you must be some "far right Christian zealot"? I'm not even a Trump supporter, I'm a left-leaning libertarian.
In actuality, most of the world strongly disagrees with communism. Even Democrats, classical liberals, and libertarians disagree with communism. It is only a tiny fringe minority of radicals who believe in communism. You are an extremist, you are not on the "right side of history".
Yes I do condemn a horrible ideology which has murdered over 100 million people and many more indirectly. You claim that we should accept all beliefs, but do you think that fascism should also be accepted? Or do you condemn fascism? Communism has murdered far more people than fascism, so if you disagree with fascism then why do you agree with communism?
Please do explain to me how this is "less violent" than the HK protests:
https://www.youtube.com/watch?v=0WsoD_mY_Rw
They murdered a woman for saying "all lives matter":
They also murdered a black police officer (who had done nothing wrong):
They burned down hospitals, apartment buildings, and businesses, including businesses owned by black people:
They set fire to a home with a child inside:
They murdered a 10 year old boy:
None of this has anything to do with "justice" or "improving the world".
https://files.catbox.moe/t8ajri.jpg
https://files.catbox.moe/28vg68.jpg
https://files.catbox.moe/bp5k64.png
I don't assume anything, just taking Christianity as an example. You are assuming that I am a communist, which I'm not. How many people have Christians murdered/enslaved/tortured/abused in history, have you ever checked? Why don't you condemn people for being Christians then? That is a huge bias on your part, and you are by no means on the right side of history.
Most of the world strongly disagrees with communism.
If you are talking about the USA, I would understand. Otherwise you need to back up your view with real data.
Yes I do condemn a horrible ideology which has murdered over 100 million people and many more indirectly.
In the mean time you should also condemn democracy, because how many people has the USA and its allies killed directly and indirectly all over the world in the name of democracy?
The U.S. program, codenamed Operation Ranch Hand, sprayed more than 20 million gallons of various herbicides over Vietnam, Cambodia and Laos from 1961 to 1971. Agent Orange, which contained the deadly chemical dioxin, was the most commonly used herbicide.
I'll take one single war waged by the USA as example: https://en.wikipedia.org/wiki/Vietnam_War_casualties
@kindlychung Why don't you condemn people for being Christians then? That is a huge bias on your part, and you are by no means on the right side of history.
Once again, you assume that I'm a Christian. Of course I condemn all of the horrible things done by Christians in the past, because I condemn the horrible things done by all people in the past, present, and future. I don't care which group did it.
And if we're going to talk about the atrocities committed by religious groups, then we would also have to talk about the atrocities of Muslims, Hindus, various African religions, etc. We need to talk about things like the Holodomor and the Armenian genocide. Every group has done bad things, no group is innocent.
If you are talking about the USA, I would understand. Otherwise you need to back up your view with real data.
Nope, actually Western countries are the most accepting of communism. Communism is very popular in American and European colleges, but it is very unpopular everywhere else.
Just go into India, or Eastern Europe, or the Middle East, or Africa, or Japan, or South East Asia, and ask them what their opinion is of communism.
Western countries (and especially America) gets the most media representation, but they are only a tiny percentage of the world's population. Most people in the world do not support communism.
In the mean time you should also condemn democracy, because how many people has the USA and its allies killed directly and indirectly all over the world in the name of democracy?
Yes, I do condemn the atrocities committed by all people around the world. And that includes communism and Black Lives Matter. Just because one group does something bad, that doesn't make it okay for other groups to do bad things.
Once again, you assume that I'm a Christian.
Not at all. I was only giving examples to convince you to avoid bias.
Yes, I do condemn the atrocities committed by all people around the world. And that includes communism and Black Lives Matter. Just because one group does something bad, that doesn't make it okay for other groups to do bad things.
That sounds fair. But what does communism and BLM even mean in your mind? These ideas don't sound horrible to me, they are natural reactions to an unjust world. Yes, some communists and BLM followers did horrible things and they should be condemned. But if you want to condemn the ideologies, you probably should give them a careful analysis first.
Nope, actually Western countries are the most accepting of communism. Communism is very popular in American and European colleges, but it is very unpopular everywhere else.
Any American politician who dares to declare themselves a communist would be commiting career suicide. Communism is a heresy punishable by death in American politics. That says enough about its popularity.
In Europe there are indeed a large group of young people who are open to socialism/communism.
Just go into India, or Eastern Europe, or the Middle East, or Africa, or Japan, or South East Asia, and ask them what their opinion is of communism.
India is a socialist state by constitution, they used to be in a close relationship with the USSR and they are still friendly with Russia even today. Other socialist states in Asia include China, Vietnam and North Korea. Based on these facts, I don't think communism is hated by the vast majority of the world population.
And opinions change over time any way. Majority of world population used to believe women are inferior to men and the earth is flat, how is that going right now? Not defending communism per se here, just saying things need to be seen as they really are.
I am still not sure if I use this library or mine. But I think it worth raising this issue. How do you think about these?
clone!
(at least document it).Personally, the first thing I do is looking at the examples. And my impression is: "Oh, what the hell is all this?" - totally new to signals; able to figure out about
html!
, but what doesclone!
do? when to use it? Looking for the document - no explanation for it. Look at the definition code? Uh oh, I am not good at it. I guess if users not desperately need this, they will move along.(1) requires much more work, but give less obvious impact, but benefit in long term. Users may get frustrated if they accidentally assign an invalid attribute to an element. Because we are in Rust, we can help them avoid such situation. Especially for users who don't like to use the macro, IDEs can help showing available methods for an element.