3 ms·
> Good luck having a designer mockup/write HTML. What you are looking at was designed by a designer. Maybe you think another designer you know could make some
by geocar 9y ago
> Good luck having a designer mockup/write HTML.
What you are looking at was designed by a designer.
Maybe you think another designer you know could make something that looks better if only they could use their own tools, instead of tools that this designer liked to use.
I remember an age when I would receive photoshop "designs" that I would have to re-code in HTML. Then they got dreamweaver and thought they didn't need me to code their stuff up anymore, just to debug their stuff and tell them why it didn't work in X/Y/Z browser combination.
When the lisp programmer is writing their login panel, they start out writing "code" like this,
(defun login-panel ()
(pbox "login/register"
then decide they need some HTML. `pbox` recognises HTML as long as it looks like lisp so:
(:form :id "logform" :class "nomargin"
(:table :style "border-collapse: collapse"
(:tr (:td :colspan "2" "username:"))
(:tr (:td :colspan "2" (:input :id "loguser" :class "txt" :name "user" :type "text" :size 15)))
(:tr (:td :colspan "2" "password:"))
(:tr (:td :colspan "2" (:input :id "logpass" :class "txt" :name "pass" :type "password" :size 15)))
(:tr (:td :colspan "2" (:input :id "logmem" :type "checkbox" :name "mem" "remember me")))
(:tr (:td :colspan "2" (:span :id "logerror" :class "error" "")))
(:tr (:td (:input :id "logbtn" :class "btn" :type "submit" :value "Login" :onclick "login(); return false"))
(:td (:input :class "btn" :type "submit" :value "Register" :onclick "register(); return false")))
(:tr (:td :nowrap t :colspan "2" :align "center" :class "little" (:a :href "/password" "what's my password?")))))))
can be transformed into the much more complex:
<form id="logform" class="nomargin">
<table style="border-collapse: collapse">
<tr><td colspan="2">username:</td></tr>
<tr><td colspan="2"><input id="loguser" class="txt" name="user" type="text" size="15"></td></tr>
<tr><td colspan="2">password:</td></tr>
<tr><td colspan="2"><input id="logpass" class="txt" name="pass" type="password" size="15"></td></tr>
<tr><td colspan="2"><input id="logmem" type="checkbox" name="mem">remember me</td></tr>
<tr><td colspan="2"><span id="logerror" class="error"></span></td></tr>
<tr><td><input id="logbtn" class="btn" type="submit" value="Login" onclick="login(); return false"></td>
<td><input class="btn" type="submit" value="Register" onclick="register(); return false"></td></tr>
<tr><td nowrap="t" colspan="2" align="center" class="little"><a href="/password">what's my password</a></td></tr>
</table>
</form>
But what is the alternative? To embed the html so that it still looks like HTML means making a string of some kind, and running the risk that there's some kind of variable expansion or XSS or other thing that will bite them in the butt. Maybe not in this simple example, but the need to get into the display-language is very common in a web application, so there are lots of fragments like this to answer to:
Maybe this one and bigger we could move into a file and either read it every request or add some extra code to save the contents to a global variable. But we haven't gained very much for all that complexity -- this hypothetical "when" we get a designer who knows HTML and not Lisp, and can contribute in a way that meaningfully moves the project forward without making more work for other programmers is far away at this point, and the reddit developers are just going to rewrite the whole thing in Python anyway.
- mratzloff 9y ago> But what is the alternative? I mean, templates are a thing people use.
- geocar 9y agoCan you explain what you mean, if it's not one of the things I mentioned (that are often called "templates") and how it doesn't have the drawbacks for a small team that I mentioned?
- testb 9y agoI'm guessing they meant something like jinja,ejs,jade,etc. where you have your html in a separate file and your lisp code would just render said html file with the necessary variables. I think you implied that in your last point but I'd be curious to find a designer who knew lisp better than HTML.
- geocar 9y ago> I'm guessing they meant something like jinja,ejs,jade,etc. where you have your html in a separate file and your lisp code would just render said html file with the necessary variables That doesn't benefit our designer who knows lisp well enough, and it doesn't benefit our programmer who knows lisp very well (or they would have done it). > I'd be curious to find a designer who knew lisp better than HTML. Well, if your team is a handful of lisp developers, then all of them. Perhaps buried is the assumption that hiring/resources are free, or that there is some kind of gatekeeping for the term and title "designer". If it helps to make the point clearer: I program and I design, and I know lisp better than I know HTML.
- armandososa 9y agoThat's why I like JSX so much. After 10+ years of trying different ways to output dynamic HTML, JSX is by far my favorite. I wanted to elaborate why, but I just figured that I don't know. I just like it better than everything else I've ever used.