logoalt Hacker News

lassejansenyesterday at 6:51 PM1 replyview on HN

DOM bloat can certainly become a problem when adding lots of code in e.g. table rows. I added functions mainly to be able to move common code into a central place to minimize that problem.

You certainly must get used to the stack based approach. I tried to make it more approachable by making stack lookups type based (automatic search for value with matching type) and by using type-prefixed commands, e.g.

  <request-send url="..."> // returns response
  <response-get-text> // looks up response on the stack and returns string
  <selection-set-text> // looks up string on the stack and writes it as text content to the current DOM element.

Replies

dhamidiyesterday at 7:55 PM

Maybe useful inspiration from TCL: there are many commands that define new variables, which makes modeling the stack unnecessary.

For example:

  lappend responses [dict status 200 body ...]
Appends a new dict to the list held in the variable responses, creating the variable if necessary.

I can see that being an attribute:

  <request-send url="..." as="greeting" />
  <response-text response="greeting" as="text" />
  <selection-set-text text="text" />
show 1 reply