Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

CSS would have been so simple if it had just adopted a plain LISP syntax. It is so difficult to memorise all the special and inconsistent syntax for every new thingamajig that browser vendors choose to introduce. Need to painfully look up a CSS reference if you haven't used that special rule in more than a week as it just doesn't seem to get retained (at-least for me) into long term memory.


The syntax is pretty simple. The problem is all the available attributes and values. I don't see how lisp syntax would help.


I guess you could then just plop in a small lisp (scheme!) function instead of units and values in order to place things as you like them.

You could then have standard functions that did what a lot of the keywords did.

On the other hand, It could get incredibly complicated too...


Could you give an example of how such a Lisp-like syntax would look, to show the improvement?


Not the one you asked, and purely for historic reasons, but DSSSL, the precursor of XSLT and CSS, was Scheme:

    ; rule associated to document's element class
    (element (section header)
       (make paragraph
          font-family-name: "Helvetica"
          font-weight: 'bold
          font-posture: 'oblique
          (process-children)
       )
    )

    ; rule associated to a particular element uniquely identified with an id:
    (id ("ref34")
       (make paragraph
          font-family-name: "Helvetica"
          font-weight: 'bold
          font-posture: 'oblique
          (process-children)
       )
    )
[1]: http://dsssl.netfolder.com/DSSSL-markup-Rules.htm


And how is that making it better than CSS? It looks more complicated and still has to use all the same attributes.


I don't advocate using it, I just posted it for historical reference (actually I'm hesitating to post anything LISP here because that will easily derail a thread into becoming off-topic).

But what the snippet shows is how eg. the DOM is traversed explicitly, as opposed to CSS's multiple implicit measurement and layout passes over the DOM. CSS sure is more compact, but doesn't begin to reveal anything like the above snippet.


For one thing, if the rest of the representation of the document (the HTML and script part) was in the same language, maybe the CSS could be condensed with macros, or otherwise procedurally generated on the client side, all in the same syntax.


Figures Schemers would put the colon on the wrong end just so that the property indicators wouldn't translate to Lisp keyword symbols.


Yes, if there a model of how to make something so easy and intutitive that anyone can pick it up and be productive, it is definitely Lisp.


Ha ha, but is it more confusing than javascript actually - removing the factor that what you already know is less complex than a new thing.

(Especially scheme is rather rigid in my humble opinion.)


Some sort of uniform, same syntax for representing all of HTML, CSS and the browser-side scripting language would have been a good start instead of this hodge podge of different notations clumsily embedded in each other.

Lisp for just CSS with all else same: lukewarm idea.


CSS would be nothing more than built-in functions to traverse nodes and change attributes. The latter of which would have already existed by virtue of having a programmatic interface with the DOM structure, and the former would have been invented in some form to build on whatever primitives existed, a la jQuery.

Kinda makes me wish I lived in that alternate universe.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: