News for hackers. Stuff that matters.
Re:How to write PureScript react components to replace JavaS... by CraigJPerry on Thursday June 25, 2020 @09:27AM (#23640460)
There's something attractive about this example but i'm struggling to figure out why i think that. What is it that makes this attractive?

  + There's a signal to noise ratio that's off the charts
  + You've not cheated to achieve succinctness; there's no blackbox.nowDrawTheRestOfTheOwl()

  - I don't think that's "pretty" code
  - i don't find it easy to parse, i had to read your example with my index finger pressed against the screen as i traced through it - i didn't have to do that with the Typescript further example down-thread
Re:How to write PureScript react components to replace JavaS... by filoeleven on Thursday June 25, 2020 @01:33PM (#23643194)
Just curious: what’s your level of fluency with Clojure/lisp syntax vs C-style syntax?

I found that learning to read the lisp-style indentation (which is purely by convention but has widespread acceptance and tooling support) was a pretty fast process with a solid payoff. It becomes easier to jump between levels of detail, and I now find it to be more readable than C-style syntax, even though I only write JS for work.

For example, in the code above, “what it does“ is made clear by reading downward without looking very far to the right: it draws a button with a click handler and a label. There is a guarantee offered by immutability that says “anything deeper than my current level cannot affect things outside of itself.”

That may sound like a lie, since the :onClick handler updates an atom, but knowing that a dereferenced atom (@count) has a stable value during the lifetime of the function call resolves it.

I don’t know how strong that guarantee is with other lisps; I think Clojure’s immutability plays a key role though.

Re:How to write PureScript react components to replace JavaS... by CraigJPerry on Thursday June 25, 2020 @04:20PM (#23645199)
Yeah i agree the readability is purely a lack of familiarity on my part rather than some fundamental difficulty in the syntax.

If anything, the clojure syntax has fewer rules to understand - from my very limited knowledge of it.