3 ms·
FWIW, React is a built-in feature of the new Arc-in-JS port. Here's how it looks: (<a> href: "https://news.ycombinator.com" "Hacker News") That lets you mer
by iplusplus 8y ago
FWIW, React is a built-in feature of the new Arc-in-JS port. Here's how it looks:
(<a> href: "https://news.ycombinator.com" "Hacker News")
That lets you merge s-expression syntax with React syntax quite nicely.
(<html>
(<body>
(<div> width: "100%" "Hello, world")))
Here's the output of a REPL session.
$ rlwrap bin/lumen-node
> (load "arc.l")
> (print:compile:expand '(<a> href: "https://news.ycombinator.com" "Hacker News"))
React.createElement("a", {href: "https://news.ycombinator.com"}, "Hacker News")
> (print:html (<a> href: "https://news.ycombinator.com" "Hacker News"))
<a href="https://news.ycombinator.com">Hacker News</a>
> (print:html (<html> (<body> (<div> width: "100%" "Hello, world"))))
<html><body><div width="100%">Hello, world</div></body></html>
> (print:html (whitepage "Look ma, no Racket"))
Warning: Each child in an array or iterator should have a unique "key" prop.
Check the top-level render call using <html>. See https://fb.me/react-warning-keys for more information.
in body
<html><body bgcolor="white" alink="blue">Look ma, no Racket</body></html>
You can see it's actually JS, since you get all the same warnings that you'd normally get in a node repl. (It's literally running on Node.)
And (print:html (msgpage 'shawn toofast*)) spits out a page saying "You're submitting too fast. Please slow down. Thanks."
I find it much easier to generate HTML than traditional methods, and much more maintainable. But it's not fair to claim that something new is inherently better. Time will tell.
I'm most interested in any unexpected warts, but there don't seem to be any so far.
- iplusplus 8y agoCurrent code is at https://github.com/lumen-language/lumen/blob/f7bfd4dca71ed1e4eb380e7e819a302825d37936/arc.l#L2234-L2245 https://github.com/lumen-language/lumen/blob/f7bfd4dca71ed1e... if anyone's curious. It's basically a copy-paste from the official arc3.1 release. (You can diff with the official sources at https://github.com/arclanguage/anarki/blob/f01d3f9c661eed05511711a0f3388ca2a1d34fa2/news.arc#L400-L411 https://github.com/arclanguage/anarki/blob/f01d3f9c661eed055...) Apologies for the nested replies; wasn't able to edit.