Re:JSON vs. XML with Douglas Crockford
by tuukkah on Thursday April 06, 2023 @10:06AM
(#35468475)
Was it far from JSX?
[ Parent
| on HN ]
Re:JSON vs. XML with Douglas Crockford
by chimeracoder on Thursday April 06, 2023 @05:53PM
(#35475051)
It was almost literally JSX (except with Scala syntax instead of Javascript, of course).
An XML literal in Scala would have been:
// XML literals (to be dropped)
val mails1 = for (from, to, heading, body) <- todoList yield
<message>
<from>{from}</from><to>{to}</to>
<heading>{heading}</heading><body>{body}</body>
</message>
println(mails1)
This was replaced with "XML string interpolation", which // XML string interpolation
val mails2 = for (from, to, heading, body) <- todoList yield xml"""
<message>
<from>${from}</from><to>${to}</to>
<heading>${heading}</heading><body>${body}</body>
</message>"""
println(mails2)