Hacker News new | ask | show | jobs
by notriddle 1330 days ago
If you just want to have your language throw up an error whenever it sees an unrecognized element, then you’ll probably be able to simplify it a lot. It’s probably fine, since

* as long as you use a build tool the errors will be seen by the author (who will know how to fix them) and not the reader

* graceful degradation and format extensions are a crapshoot due to Hyrum’s Law [1]

[1]: https://news.ycombinator.com/item?id=30726668

1 comments

Yes, this is probably the most sensible approach.

Other options would be to ignore everything you don't recognize or ignore all nodes of the form:

  unrecognized tag [value]
i.e. where you don't recognize the key and the value is not complex.

You could still display stuff like:

  unrecognized tag [
    [text]
    ...
  ]
i.e. text nodes which are children of unrecognized elements.

But approaches like these would need a good justification.