3 ms·
JSX using JS for logic is both a boon and a curse. It is just as easy to shoot yourself in the foot and write some ugly imperative construction as writing an el
by Bahamut 10y ago
JSX using JS for logic is both a boon and a curse. It is just as easy to shoot yourself in the foot and write some ugly imperative construction as writing an elegant template.
I wonder if we will ever have a satisfactory solution to the template problem of conditional rendering. All I've seen so far solved one problem only to bring another. To some degree, this is really a dogmatic problem, which is why it'd be nice if we could solve this and move on with more important things.
- jwdunne 10y agoIn fairness that's the main point of contention with PHP templates, leading us to 4 big templating languages including PHP itself. It's the same old balance problem: more flexibility and less constraints opens up potentially dangerous misuse. We see it with languages too I.e C memory management vs garbage collection. We also see it socially too. There are particular problems with both 0% regulation and 100% regulation, with the ideal that nobody can agree on lying somewhere in between. In fact, some situations call for more or less, compounding the confusion. Perhaps the solution is a template system that can fit current needs, in that a programmer can choose to remove a restriction but the removal of the restriction gives the seconds required to think if removing a restriction is necessary. That then means we can collaborate as an industry. We may find that there exists one or a handful of "ideal general restrictions". We may also find that actually for certain types of problem would do well with a handful of specific restrictions that work well there. I just don't think there is a one size template solution and our attempts at a fixed ideal haven't seemed to work. After all, if we had the true ideal, we wouldn't keep making new ones.
- elcct 10y agoIt seems like a huge waste of time to create a new language so that people will not do "stupid" things in their templates. The case of PHP is especially amusing. How about using common sense? I mean if a programmer intends to do "dangerous misuses" in the templates, maybe he shouldn't work on it in the first place. Having a person not being able to tell whether something is dangerous or not, working on the project and then creating a template language to forgive the lack of knowledge is just asking for trouble in the long run.