Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38439 > unrolled thread

howdy -- any svelte fans in here?

Started byTimothy Brisbane <tbrisbane@tuta.io>
First post2020-05-23 22:24 -0700
Last post2020-05-27 14:09 -0700
Articles 6 — 6 participants

Back to article view | Back to comp.lang.javascript


Contents

  howdy -- any svelte fans in here? Timothy Brisbane <tbrisbane@tuta.io> - 2020-05-23 22:24 -0700
    Re: howdy -- any svelte fans in here? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-05-25 03:36 +0200
      Re: howdy -- any svelte fans in here? Andrew Poulos <ap_prog@hotmail.com> - 2020-05-25 16:19 +1000
        Re: howdy -- any svelte fans in here? Julio Di Egidio <julio@diegidio.name> - 2020-05-25 09:28 -0700
      Re: howdy -- any svelte fans in here? Arno Welzel <usenet@arnowelzel.de> - 2020-05-25 16:51 +0200
    Re: howdy -- any svelte fans in here? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-05-27 14:09 -0700

#38439 — howdy -- any svelte fans in here?

FromTimothy Brisbane <tbrisbane@tuta.io>
Date2020-05-23 22:24 -0700
Subjecthowdy -- any svelte fans in here?
Message-ID<TxnyG.110940$VX.99865@fx34.iad>
I just discovered svelte 6 months ago. I love it.

[toc] | [next] | [standalone]


#38441

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2020-05-25 03:36 +0200
Message-ID<10162473.VPuiaCfT3b@PointedEars.de>
In reply to#38439
Timothy Brisbane wrote:

> I just discovered svelte 6 months ago. I love it.

What is it?

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#38442

FromAndrew Poulos <ap_prog@hotmail.com>
Date2020-05-25 16:19 +1000
Message-ID<d8idnZbhd8Qf_lbDnZ2dnUU7-UnNnZ2d@westnet.com.au>
In reply to#38441
On 25/05/2020 11:36 am, Thomas 'PointedEars' Lahn wrote:
> Timothy Brisbane wrote:
> 
>> I just discovered svelte 6 months ago. I love it.
> 
> What is it?

Well, in English, it's an adjective that describes a person as slender 
and elegant but I guess they are referring to another JavaScript 
framework. Of Svelte, the web site says "You can't write serious 
applications in vanilla JavaScript without hitting a complexity wall. 
But a compiler can do it for you."

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#38444

FromJulio Di Egidio <julio@diegidio.name>
Date2020-05-25 09:28 -0700
Message-ID<b8e20fe7-d2cc-4419-90a1-7fbff8637072@googlegroups.com>
In reply to#38442
On Monday, 25 May 2020 08:19:56 UTC+2, Andrew Poulos  wrote:

> Of Svelte, the web site says "You can't write serious 
> applications in vanilla JavaScript without hitting a complexity wall.
> But a compiler can do it for you."

Bollocks.

Julio

[toc] | [prev] | [next] | [standalone]


#38443

FromArno Welzel <usenet@arnowelzel.de>
Date2020-05-25 16:51 +0200
Message-ID<hj24bvFk68nU4@mid.individual.net>
In reply to#38441
Thomas 'PointedEars' Lahn:

> Timothy Brisbane wrote:
> 
>> I just discovered svelte 6 months ago. I love it.
> 
> What is it?

Another "pseudo code to JavaScript compiler framework":

<https://svelte.dev/>


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#38445

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2020-05-27 14:09 -0700
Message-ID<b25c499a-79e3-40fe-9e0e-f76bc8cb4059@googlegroups.com>
In reply to#38439
On Sunday, May 24, 2020 at 12:24:08 AM UTC-5, Timothy Brisbane wrote:
> I just discovered svelte 6 months ago. I love it.

Better than doing it from scratch I guess if you don't know better.

I'm not a fan but I've looked at it once or twice. It seems to sell itself as not being React which is not a high bar.

The efficiency of it's output leaved much to be desired. The "Hello World" example is 41 lines of code excluding the 7 imports:

<https://svelte.dev/examples#hello-world>

The implementation leaks:

```svelte
<script>
var args = arguments;

function handleClick() {
    alert(JSON.stringify(args))
    alert(create_fragment.toString())
}
</script>

<button on:click={handleClick}>Click</button>
```

Reactive declarations, while valid syntax, are semantically not JavaScript:

<https://svelte.dev/tutorial/reactive-declarations>
<https://svelte.dev/tutorial/reactive-statements>

This is just bad design:

<https://svelte.dev/tutorial/updating-arrays-and-objects>

Given that "JavaScript" and a compiler are already involved, why does a new DSL for conditionals and loops need to be reinvented? The language already has these:

<https://svelte.dev/tutorial/if-blocks>
<https://svelte.dev/tutorial/each-blocks>

Then there's this "await" thing where the same criticism applies:

<https://svelte.dev/tutorial/await-blocks>

Due to how the compilation works a strange event system was created:

<button on:click={handleClick}></button>

Which tries to make up for the loss of the vanilla functionality:

<button onclick="handleClick()"></button>

The event modifiers could be done in the handler itself, so I don't understand the need to add another syntax:

<https://svelte.dev/tutorial/event-modifiers>

This just promotes duplicating logic and mixing it with the "markup". If I had a list of elements with the same handler then adding a modifier on each element is not an improvement.

Speaking of an over-complicated event model:

<https://svelte.dev/tutorial/event-forwarding>

"Unlike DOM events, component events don't bubble. If you want to listen to an event on some deeply nested component, the intermediate components must forward the event."

Svelte is using what is called the Chain of Responsibility pattern to process events. This has been known to be a bad idea since the late 90s When Java abandoned it. This approach requires either:

1. Every intermediate component has to explicitly forward the event (as mentioned in the quote)
2. A particular container component has to define a switch-statement or if-else to filter and handle the child events when there are many types. (as shown in the linked example with dispatch() if more events were defined)

The Delegation Model of events, as used in the DOM is superior and should have been kept instead. A reactive approach would also have been better.

<https://svelte.dev/tutorial/numeric-inputs>

"In the DOM, everything is a string. That's unhelpful when you're dealing with numeric inputs — type="number" and type="range" — as it means you have to remember to coerce input.value before using it."

That is just wrong. <input> elements support:

value, valueAsDate, valueAsNumber

<https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement>


<https://svelte.dev/tutorial/group-inputs>

The "name" attribute already does this.

This may be a failure of imagination on my part, but it looks to me by the examples that "Stores" are just being used to bypass the event model and hierarchy in order to cross-communicate to other components. Perhaps if the event model was better this thing wouldn't exist?

<https://svelte.dev/tutorial/writable-stores>


Transitions and Animations: CSS exists. I'm not seeing much of a gain here in Svelte.


Regarding components, I'll just reference the criticism I've already given:

<https://thenewobjective.com/web-development/a-criticism-of-web-components>


The context api looks to be another example of a feature trying to work around the terrible event model:

<https://svelte.dev/tutorial/context-api>

This one also:
<https://svelte.dev/tutorial/sharing-code>


So I guess with all of that being said: What is it you love about it?

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web