logoalt Hacker News

zarzavatyesterday at 2:07 PM1 replyview on HN

Don't you still have imperative constructs if you use Svelte? It's not like any web framework can remove the need to render things conditionally.

If you have `{#if cond}`, that's imperative programming, not declarative, it's just imperative programming using a different syntax.

Using a different syntax for a conditional/loop depending on the type of the data is odd when you think about it. Why should vnodes use one syntax and every other data type use another syntax?

I will grant that the C ?: ternary operator syntax is ugly. If C had had expression based if/else like Rust then maybe people wouldn't mind JSX so much.


Replies

aatd86yesterday at 4:04 PM

Absolutely, and that's one of the reasons that, as much as I was enthusiastic about svelte, it still didn't quite hit the spot. Close but not quite there yet. It's neither html nor js. Still a bit confusing.