3 ms·
Formatting thanks to @tempodox: ---------------- It's very interesting and neat and I hope they keep making progress, but one big question that I'm left with
by mattfenwick 12y ago
Formatting thanks to @tempodox:
----------------
It's very interesting and neat and I hope they keep making progress, but one big question that I'm left with is why this is better than using an embedded DSL.
This is supposed to be addressed on page 2, but the example is kind of a strawman:
let webpage : HTML = HTMLElement(Dict.empty(), [BodyElement(Dict.empty(),
[H1Element(Dict.empty(), [TextNode("Results for " + keyword)]),
ULElement((Dict.add Dict.empty() ("id","results")), to_list_items(query(db,
SelectStmt(["title", "snippet"], "products",
[WhereClause(InPredicate(StringLit(keyword), "title"))]))))])])
Although they claim that it's "too cognitively demanding for comfort", there are many ways that it could be improved without resorting syntax extensions, for example:
let webpage : HTML = HTML({}, [Body({},
[H1({}, ["Results for " + keyword]),
UL({"id": "results"}, to_list_items(query(db,
... etc. ...
Another reason to prefer an EDSL over syntax extensions for writing HTML is that an EDSL won't require that you write the close tags!
This isn't to say that they're wrong, it's that I think they need to do a better job of comparing their approach with EDSLs.