Live data from Hacker News

Generalizing JSX: Delivering on the Dream of Curried Named Parameters

tolmasky.com

21–29 of 29 posts

Re: Generalizing JSX: Delivering on the Dream of Curried Named Parameters

#21
post #20

Regarding the hack to make function calls: if JSX elements start with a capital letter, then the pragma is ignored, and the element name is used as a local variable name instead, e.g.: transform(" hi! ") outputs Foo({id: "my-element"}, ["hi!"])

Yeah, it was outside the scope of this blog post, but if you look at how its implemented here: https://github.com/tolmasky/generic-jsx/blob/master/generic-... you'll see it deals with both cases.

Re: Generalizing JSX: Delivering on the Dream of Curried Named Parameters

#22
Does this go far enough that we can invoke Greenspun's Tenth Rule?

> Any sufficiently complicated [Javascript] program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.

https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule

Re: Generalizing JSX: Delivering on the Dream of Curried Named Parameters

#24

Very good article, it is easy to predict great use cases for JSX concept in the future. I proposed the idea of using JSX as angular2 templates. They didn't like it and I think the React competition was an important factor for that. https://github.com/angular/angular/issues/5131

Heh, not exactly. We have a finite amount of hours in the day, and maintaining a JSX implementation is something we just aren't really interested in. You're more than welcome to implement such a thing yourself though, and I'd be the first to retweet it if you did.

Re: Generalizing JSX: Delivering on the Dream of Curried Named Parameters

#26

A certain portion of programmers seems convinced that currying offers a huge amount of power, and we just haven't unlocked it yet. But I don't think I understand why they feel that way.

Curried: map (f . fst)

Uncurried: \xs -> map (\x -> f (fst x)) xs

Now comparing this to js would just be unfair (edit: ES6 lambdas are probably ok).

Re: Generalizing JSX: Delivering on the Dream of Curried Named Parameters

#28
FYI, your tonicdev code runner doesn't seem to be working for me.

Whenever I run a code example, I get 5 403 errors one after the other trying to make PUT requests to http://tonicdev.com/new

Sample request:

{"model":{"content":{"package":{"engines":{"node":"4.x.x"},"lastEvaluatedDependencies":{},"dependencies":{}},"title":"","cells":[{"_id":"cells/3f4e1137-79ee-4dbd-b201-ba404a056e0f","content":{"type":"source","text":"/* @jsx console.log */\n\n// Now this is the same as console.log(\"div\", { \"id\":\"my-element\"}, \"hi\");\nhi"}},{"_id":"cells/fd8deede-cfeb-48df-ac0f-740397f61e47","content":{"type":"rich-text","text":"Created from: http://tolmasky.com/2016/03/24/generalizing-jsx/","tag":"p"}...},"evaluationCount":0},"fromNotebook":null,"fromLocation":"http://tolmasky.com/2016/03/24/generalizing-jsx/","embed":tr...}

And response:

{ "message": "CSRF token failure", "csrf": "4fa7f4dc-c906-4561-92dd-2489cc53c7f7" }

Safari on OSX, Chrome doesn't have the problem.

Re: Generalizing JSX: Delivering on the Dream of Curried Named Parameters

#29
post #22

Does this go far enough that we can invoke Greenspun's Tenth Rule? > Any sufficiently complicated [Javascript] program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp. https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule

Definitely on the road to Greensunning, but nowhere near half of CL
Post reply on HN