by dmitriid 8 years ago

What I don't get in all these frameworks is the desire to invent new and incompatible template languages with increasingly inane syntaxes. Oh. And, of course, with stringly-typed programming and magic binding rules.

Just look at Svelte's templates: https://svelte.technology/guide#template-syntax

Not only it's some custom implementation, it also breaks all assumptions about javascript code

   const counter = new Counter({
      data: {
        count: 99
      }
   });

   ...then {{count}}, or counter.get('count')

Why is it `counter.get('count')`? WTF?

Or just the section on computed properties[1]: oh, it's no longer even Javascript. It's some magic Javascript-like scripting language that gets injected with properties based on what you write.

Much like in Vue data, properties, and methods are magically hoisted up to the object breaking everything you learned about Javascript:

  export default {
    methods: {
      say: function ( message ) {
        alert( message ); // again, please don't do this
      }
    }
  };

  // and then

  import MyComponent from './MyComponent.html';

  var component = new MyComponent({
    target: document.querySelector( 'main' )
  });

  component.say( '' );

Why the hell is `.say` a top-level method now?

And so on and so forth.

[1] https://svelte.technology/guide#computed-properties

purple-again 8 years ago

I’m not an expert can I can chime in and say that .get and .set are common in Ember data objects as well. No idea if it’s an ES6 thing or Ember thing though.

  • dbbk 8 years ago

    Those are Ember-specific, because ES getters and setters weren't widely available at the time of introduction. They just dropped < IE 11 though so they'll start to go away.