News for hackers. Stuff that matters.
Re:Languages Which Almost Became CSS by Grue3 on Tuesday June 28, 2016 @12:26PM (#11995073)
DSSSL looks amazing. Truly a shame it didn't catch on. Maybe we'd have a client-side Lisp instead of Javascript too.
Re:Languages Which Almost Became CSS by peatmoss on Tuesday June 28, 2016 @01:14PM (#11995520)
Can we have a do-over on the web? I've seen (and even nominally participated) in something of a resurgence of Gopher as something of a shadow web for nostalgia-addled geeks. Gopher isn't an awesome protocol, but I love anything that recaptures the spirit and decentralized nature of the old web.

At my curmudgeon-iest I like to imagine we carve off our own web where S-expressions reign, there is no Google, and a million timecubes bloom.

Re:Languages Which Almost Became CSS by TheOtherHobbes on Tuesday June 28, 2016 @04:24PM (#11997235)
That may yet happen.

Although CSS sucks more than a very sucky thing, and the text+markup idea barely makes sense in 2016, I can see how we got here - and how CSS needed to hit the classic "worse is better" sweet spot that allowed designers to play, and not just people who code.

But that was then. If someone invents a meta-protocol now and implements a meta-browser/meta-server for it, I'd expect cult/niche status at least.

Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @03:17PM (#11996663)
And such a web would be far slower. Restyling is usually the slowest part of the rendering pipeline in an optimized implementation. Throwing arbitrary tree transformations made with a Scheme interpreter into the mix would be totally irresponsible without looking at what the consequences would be for performance.
Re:Languages Which Almost Became CSS by jguegant on Wednesday June 29, 2016 @02:10AM (#11999817)
Isn't it the way Qt + QML works?

Last time I checked, this stack wasn't particularly slow. I would also express the same style in much less lines of code than HTML + CSS.

Re:Languages Which Almost Became CSS by girvo on Wednesday June 29, 2016 @02:25AM (#11999845)
When I was 6 years old, in 1996, my parents gave me a book about "Cyberspace" to go along with our dial-up internet connection (on our Pentium 100mhz Windows 95 computer!). This book showed me Gopher, and MUDs, and changed my life! I wish I could remember the name of it, it was a bright yellow cover with a superhero on it, I think.

I miss Gopher, in a rose-tinted glasses nostalgia-driven way

Re:Languages Which Almost Became CSS by wolfgke on Wednesday June 29, 2016 @05:49PM (#12005084)
> I wish I could remember the name of it, it was a bright yellow cover with a superhero on it, I think.

Could it be Computer Lib/Dream Machines by Ted Nelson:

Cover of the 1974 edition: http://blogs.brandeis.edu/sarahw/files/2011/03/cover1.jpg

Front cover of the 1987 edition (in yellow): https://www.amazon.co.uk/Computer-Lib-Dream-Machines-Tempus/... (sorry, I have no image of the back cover, but I have both editions in my book shelf: Also the 1987 edition shows a superhero on its back cover (cover of Dream Machines)).

EDIT: If you want to order a reprint of the 1st edition (very difficult to get): Ted Nelson sells them again: http://hyperland.com/LibPage

Re:Languages Which Almost Became CSS by dTal on Friday July 01, 2016 @08:34AM (#12015474)
I'm pretty sure I had the same book! The "superhero" was called "CyberSarge", yes?

https://www.amazon.com/Internet-Kids-Ted-Pedersen/dp/0600590...

Re:Languages Which Almost Became CSS by girvo on Friday July 01, 2016 @09:18AM (#12015752)
YES!!!! That's the one! Holy crap, well done, I never thought I'd see it again! Oh man what a nostalgia trip:

"GEEK: A geek is someone who is really excited by computers and proud of it" -- this is the reason I was proud to call myself a geek from 6yo onwards :)

Re:Languages Which Almost Became CSS by gagege on Tuesday June 28, 2016 @03:01PM (#11996515)
Really, all you need to do is make your own browser and then popularize it.
Re:Languages Which Almost Became CSS by Kinnard on Tuesday June 28, 2016 @03:24PM (#11996725)
1 step ahead of you . . . but this staircase seems really long . . .
Re:Languages Which Almost Became CSS by patrickmay on Tuesday June 28, 2016 @12:31PM (#11995129)
The engineering management that prevented Scheme in the browser should never be forgiven: https://brendaneich.com/2008/04/popularity/
Re:Languages Which Almost Became CSS by PeCaN on Tuesday June 28, 2016 @01:31PM (#11995696)
In some alternate universe the management didn't stop Eich:

Scheme became the lingua franca of the web. Smug Array Weenies criticize Scheme for being “insufficiently APL-like”, while pure functional programmers criticize APL for being “insufficiently Haskell-like”. Legions of Scheme programmers write mutually unintelligible code, though still manage to criticize Haskell for being “insufficiently Lisp-like”. Prolog fails to catch on. Brenden Eich announces that continuations are considered harmful. C programmers maintain that continuations are the most reasonable way to handle errors in C. This happens in spite of C not having continuations. Douglas Crockford invents s-expressions as a data interchange format. Douglas Crockford writes “Scheme: The Good Parts”. Guy L. Steele sues Douglas Crockford for copying the Scheme standard. Hipsters begin using Node.Scheme to write their backends and are criticized for a nonsensical package management system and “using a web language on the server”. This happens in spite of Scheme having been a server language before it was used on the web. Microsoft invents a compiler with type inference and optional type annotations for Scheme. Facebook invents a compiler with type inference and optional type annotations for Scheme. GNU Guix is promptly ignored for “using a web scripting language for package management”. Facebook invents React, which uses an extensive set of macros to write HTML components in Scheme. This is criticized in spite of having been done a few hundred times before. Guy L. Steele angrily removes string-pad-left from the Scheme standard. This breaks many packages. Non-Scheme programmers laugh and wonder if Scheme programmers have forgotten how to program, suggesting that “proper design minimizes dependencies on the language standard”.

In all seriousness, Scheme would make a really good lingua franca.

Re:Languages Which Almost Became CSS by kowdermeister on Tuesday June 28, 2016 @03:02PM (#11996530)
Wonderful write-up, you deserve a HN Gold. Umm, sorry wrong site, but still, I rarely stumble upon such a witty comment in my space.
Re:Languages Which Almost Became CSS by Ygg2 on Wednesday June 29, 2016 @05:25AM (#12000421)
That, or it ends up with several different Scheme flavors. And you get "Works best with MSScheme and IE" in 2016.
Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @03:18PM (#11996666)
Scheme in the browser would have been fine. Scheme in the hot path of every single restyle, not so much.
Re:Languages Which Almost Became CSS by talideon on Wednesday June 29, 2016 @11:25AM (#12002216)
I don't follow you. If, say, browsers used Scheme rather than JS, they wouldn't be any slower. If a CSS-equivalent used s-expressions but was otherwise CSS, that's just syntax.
Re:Languages Which Almost Became CSS by panic on Tuesday June 28, 2016 @06:59PM (#11998255)
Why not? Modern JIT compilers generate very fast code.
Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @08:27PM (#11998661)
"Very fast" in this case is not enough for restyling. It is incredibly performance sensitive. A 2x slowdown over the optimized C++ (for example) would be unacceptable.
Re:Languages Which Almost Became CSS by agumonkey on Tuesday June 28, 2016 @12:28PM (#11995099)
When I die, my first question to god will be 'sir, why the hate on lisp?'. I expect the answer to involve testing of some kind.
Re:Languages Which Almost Became CSS by marcosdumay on Tuesday June 28, 2016 @01:11PM (#11995488)
My take is that metaprogramming does not scale to teams.

Or maybe it's just the historical artifact that everybody claims to be, and if the PDP-10 supported a lisp environment, things would be different. But if I had to bet, I'd bet on metaprogramming not scaling.

Re:Languages Which Almost Became CSS by junke on Tuesday June 28, 2016 @02:57PM (#11996476)
> whether we like it or not, each project effectively creates its own dialect of the language

(http://ithare.com/cpp-guidelines-made-to-measure-s-one-size-...)

Each project has its own coding guide and idiosyncrasies. That is not restricted to Lisp. Macros allow you to express some rules in a domain-specific language, not in a separate document or tacit knowledge. This is more manageable than ad-hoc approaches. Abusing macros is definitely bad and can lead to ghetto-languages.

Lisp is interactive, call "describe" on whatever you don't understand. Under Emacs, if you encounter a form you don't understand, point to it, "C-c C-d d" and you get the documentation; "M-." and you go to the definition; "C-c M-m" and you call macroexpand.

Re:Languages Which Almost Became CSS by jdmichal on Tuesday June 28, 2016 @02:37PM (#11996295)
This is pretty much exactly the argument made by The Lisp Curse:

http://www.winestockwebdesign.com/Essays/Lisp_Curse.html

That basically every program written in a Lisp becomes its own programming language. It has mechanisms which are vaguely-familiar-but-different from all the other programs. The mechanisms are 80% of a complete solution, but a different 80% each time, depending on the needs of the program.

Re:Languages Which Almost Became CSS by TheOtherHobbes on Tuesday June 28, 2016 @04:27PM (#11997269)
Anyone can write js.

Some humans can write Lisp. But Lisp production code can only be maintained and updated by AIs who are more intelligent than we are.

Re:Languages Which Almost Became CSS by mordocai on Tuesday June 28, 2016 @01:51PM (#11995884)
Ruby and Clojure are doing decently (though obviously not as popular as say C and Java) and have pretty advanced metaprogramming.

For that matter C++ templates are metaprogramming from what I understand, and C macros are a really really primitive form of metaprogramming. Java also has reflection which is metaprogramming-ish.

I don't think the problem was metaprogramming.

Re:Languages Which Almost Became CSS by marcosdumay on Tuesday June 28, 2016 @03:35PM (#11996826)
When I see people talking about Closure, I don't see them talking about the power they get from metaprogramming. It's almost the opposite, people talk about the safety of FP, and power from Category Theory.

For C++ templates, you get that impression and multiply by a few googols.

Now, Ruby and Python communities do claim to gain power from metaprogramming. I can say that Python metaprogramming is something completely different from Lisp's one, but Ruby's is more similar. Yet, both communities put a hard limit on the amount of "magic" you should use on your programs (where Ruby's limit is way higher than Python's), so it can not become the panacea that it is in Lisp.

Metaprogramming is one of the main selling points of Lisp, the only other being how easy it is to implement. Other languages have other features to show.

Re:Languages Which Almost Became CSS by kenko on Tuesday June 28, 2016 @07:25PM (#11998388)
What people talk about category theory w/r/t Clojure? Since it has almost no type system to speak of, I'd be very curious to know what in the world they're on about.

Macros and the repl were, to me, the best part of clojure.

Re:Languages Which Almost Became CSS by marcosdumay on Wednesday June 29, 2016 @08:11AM (#12001093)
I see people talking about monads and applicatives all the time. I don't know Clojure, but I got the impression it has a powerful implicit type system.
Re:Languages Which Almost Became CSS by agumonkey on Tuesday June 28, 2016 @02:28PM (#11996215)
Not the same level of metaprogramming. Ruby Python try but it's less idiomatic or batshit crazy. C macros are glorified sed scripts, you're at the byte buffer level; it's cute but not good either. To me lisps sit at a nice middle ground where metalevels are as close as possible while still being usable. That's my take based on what people said in the 60s, after all sexps weren't supposed to be used.
Re:Languages Which Almost Became CSS by lisivka on Tuesday June 28, 2016 @03:26PM (#11996745)
Metaprogramming scales very well. Every high-level program + compiler is metaprogram for assembler code.
Re:Languages Which Almost Became CSS by TheCoelacanth on Wednesday June 29, 2016 @10:22AM (#12001781)
That has a much higher barrier of entry, though. If I work on a project written in Blub, I won't be able to do any metaprogramming unless I can get everyone else to adopt my Blub++ compiler. If the software is written in Lisp, all I have to do is get it through a code review.

In effect, it's not really scaling; it's being limited to the small portion of developers who work on compilers.

Re:Languages Which Almost Became CSS by agumonkey on Tuesday June 28, 2016 @01:19PM (#11995567)
Possible that most people really like to have distinct level encoded as syntax.
Re:Languages Which Almost Became CSS by wtbob on Tuesday June 28, 2016 @08:41PM (#11998721)
I love Lisp, and I love s-expressions, and I honestly can't viscerally understand why others don't. From listening to my teammates' comments, I think that it has something to do with how they register visual patterns in code. Lisp really does seem to be lots of irritating silly parentheses to them: where I just see sculpted code-shapes, they see a mess of undifferentiated parens and symbols.

I wonder if there really are mental types well-suited to Lisp and types ill-suited to it.

Re:Languages Which Almost Became CSS by agumonkey on Wednesday June 29, 2016 @03:58AM (#12000137)
It also comes from which system they used. Writing lisp outside of supporting editors is indeed a nice pain. People prefer to think in terms of blocks of lines rather than (nested (groups)). Culture shock.
Re:Languages Which Almost Became CSS by talideon on Wednesday June 29, 2016 @11:26AM (#12002226)
Here's your answer: https://xkcd.com/224/
Re:Languages Which Almost Became CSS by _vya7 on Tuesday June 28, 2016 @01:19PM (#11995573)
Maybe not such a shame. Having something (mostly) static like CSS has lots of performance advantages. Imagine the web being even slower than it already is, that's what DSSSL probably would have resulted in.
Re:Languages Which Almost Became CSS by chriswarbo on Tuesday June 28, 2016 @02:01PM (#11995974)
I'm mostly in favour of the "principle of least power", but I think the requirements for CSS would be a good fit for something like DSSSL:

- Designers/developers will, as a general rule, always max-out the system; as long as the performance is at an acceptable level, the features and bloat will increase. If it becomes unacceptable, those features and bloat will be trimmed accordingly. Hence, no matter the underlying technology, performance will almost always hover around "barely acceptable". The difference would be how much "bang for the buck" we would get for that performance; presumably a "barely acceptable" page using CSS would be capable of more than a "barely acceptable" page using DSSSL, since DSSSL would exhaust the performance budget more quickly.

- Trying to dictate which stylistic elements can/cannot be used seems like a thankless task, since many will disagree and either come up with awkward workarounds or lobby to get their desired features included (which may or may not disrupt the coherence of the provided elements). Providing a full programming language is effectively pre-empting those workarounds, and giving the community control over the available elements (e.g. via libraries). This would lead to lots of awful code, but some good ideas would emerge and become widely adopted. Browsers might specialise their evaluators to speed up common usages, etc. Very similar to Javascript, polyfills, etc.

- CSS is, after all, "just" styling information, and is applied progressively on top of HTML. The document is still machine-readable, even if we might not be able to answer particular questions about its layout and visuals. It's conceivable that some people might, for example, obfuscate their document content, and re-assemble them using styles, e.g. to prevent crawling; that's more of a cultural/social issue than a technical one though, and that cat's already out of the bag with Javascript, single page apps, etc.

In any case, the current trend of working around CSS's limitations with Javascript is the worst of both worlds. At least we might attempt to evaluate DSSSL, to see what it might look like, whilst any attempts to evaluate Javascript will quickly run into barriers like side-effects (should we run AJAX calls? What should "alert" do? etc.)

Re:Languages Which Almost Became CSS by smitherfield on Tuesday June 28, 2016 @01:27PM (#11995657)
Well, slower and then faster. Virtual selectors mean that CSS is now also Turing-complete (in a horrible, horrible way). And DSSSL would've been able to handle much or maybe even all of what's currently handled by Javascript.
Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @03:25PM (#11996729)
CSS is only Turing-complete in pathological cases. Pathological cases do not make a good basis for policy decisions. In reality, the loss in performance from losing the style sharing cache alone would probably swamp any gains you'd get from DSSSL.
Re:Languages Which Almost Became CSS by smitherfield on Wednesday June 29, 2016 @02:51PM (#12003757)
The point is virtual selectors and using Javascript for styling both have very poor performance characteristics, and both are A. ubiquitous and B. hacky kludges driven by the excessively limited nature of CSS as originally designed.

I'm probably out of my depth here, but what do you mean by the style sharing cache? I mean, any kind of file can be cached by the browser, including Javascript. And presumably browsers could've implemented optimizations (with or without the aid of hinting annotations) to identify those DSSSL functions that need only be evaluated once.

(BTW, like the author of the article seems to, I actually think that PSL looks like the best of the CSS alternatives he lists).

Re:Languages Which Almost Became CSS by sdegutis on Tuesday June 28, 2016 @02:02PM (#11995984)
> And DSSSL would've been able to handle much or maybe even all of what's currently handled by Javascript.

I severely doubt that. JavaScript can inspect attributes of anything on the entire page, run remote HTTP queries and inspect their attributes, and make styling decisions based on those, on the fly, and in response to user GUI events.

Granted, I'd probably be really okay with these features no longer existing. Just saying, I don't think any DSSSL could have taken them on.

Re:Languages Which Almost Became CSS by smitherfield on Tuesday June 28, 2016 @02:20PM (#11996149)
I should've been more clear — DSSSL might've been able, possibly in conjunction with later extensions (just as XJAX was not originally part of Javascript), to provide a similar end-user experience in many cases as CSS+Javascript currently does, albeit with very different semantics for the developer.

Not sure it would be better (it probably erred on the side of too much mixing of program logic and styling rather than too little), but it would certainly be different.

Re:Languages Which Almost Became CSS by naasking on Tuesday June 28, 2016 @03:05PM (#11996552)
Stylesheets would be smaller, and only execute slightly slower on the client due to the expansions needed. Trading rendering speed for network speed is a good choice.
Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @03:21PM (#11996702)
Not only do I think the stylesheets would not end up appreciably smaller after gzip, I also disagree with that argument. Rendering performance (animations, scrolling, etc.) is one of the key reasons why native is perceived to be winning vs. the Web. Making the Web even slower at rich interactive apps is not doing the Web any favors.
Re:Languages Which Almost Became CSS by naasking on Tuesday June 28, 2016 @04:49PM (#11997443)
> Rendering performance (animations, scrolling, etc.) is one of the key reasons why native is perceived to be winning vs. the Web.

Except this is an argument against JavaScript driven behaviour, not against a restricted styling language slightly more expressive than CSS. The fact that we would be able to move some of this dynamic behaviour from a general purpose language where optimizing redraw is difficult, to a domain-specific language where optimizing redraw is loads easier would yield performance improvements, not regressions.

Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @05:41PM (#11997804)
> The fact that we would be able to move some of this dynamic behaviour from a general purpose language where optimizing redraw is difficult, to a domain-specific language where optimizing redraw is loads easier would yield performance improvements, not regressions.

No, it wouldn't. "Optimizing redraw" isn't difficult, and to the extent that it is it has nothing to do with the expressiveness of CSS.

Re:Languages Which Almost Became CSS by naasking on Tuesday June 28, 2016 @08:19PM (#11998628)
You've seemingly ignored the main thrust of my point in order to quibble over what I meant by optimising redraw. Seems dishonest at best.

Do you agree or disagree that a domain-specific layout language with would be faster to render and animate than a general purpose programming language interacting with the DOM? This seems like an undeniable yes.

Do you agree or disagree that such a layout language could supplant some of the uses of JavaScript over the years? This too seems to be an undeniable yes.

So it seems undeniable that modern browsers would be faster than they currently are on the metrics you criticised them as compared to native apps, which seems to be your primary concern.

And you can claim gzip is good enough to eliminate any space savings a more expressive language would yield, but the fact is people still minify their JS and CSS for significant savings, which means even small differences matter; further, domain specific optimisations have significant effects, and a precompiler could perform advanced common subexpression elimination passes to further compress beyond what gzip could dream of without affecting the semantics your layout.

So theoretically and empirically it seems my point that trading off rendering speed for network speed is not only well motivated, but already settled in my favour.

Re:Languages Which Almost Became CSS by pcwalton on Tuesday June 28, 2016 @08:25PM (#11998654)
> Do you agree or disagree that a domain-specific layout language with would be faster to render and animate than a general purpose programming language interacting with the DOM? This seems like an undeniable yes.

No. I don't believe this is true. With CSS as a declarative language, we can do global optimizations that are much harder to do than with a general programming language (especially one that's as hostile to static analysis as Scheme!)

> Do you agree or disagree that such a layout language could supplant some of the uses of JavaScript over the years? This too seems to be an undeniable yes.

Sure, but that's not worth slowing down so many Web sites for.

> And you can claim gzip is good enough to eliminate any space savings a more expressive language would yield, but the fact is people still minify their JS and CSS for significant savings, which means even small differences matter

Sure, but it's not worth trading off the rendering performance.

> a precompiler could perform advanced common subexpression elimination passes

Not with Scheme, it sure can't! You can do those dynamically, but not statically.

Re:Languages Which Almost Became CSS by naasking on Wednesday June 29, 2016 @05:57PM (#12005130)
DSSSL is not Scheme, it's a domain-specific language, which solves nearly all of your objections that aren't conjecture. Domain-specific languages are obviously much more amenable to optimization. Such a stylesheet language can be trivially cache JIT compiled stylesheets, and because they're more expressive, you'd see more reuse across pages, and possibly even across sites. The bandwidth savings are non-linear.
Re:Languages Which Almost Became CSS by ldng on Tuesday June 28, 2016 @02:18PM (#11996131)
A DSSSL implementation on desktop still exists : openjade [1]. Could probably be ported successfully to JS today. Heck, someone could try to compile it with Emscripten.

[1] http://openjade.sourceforge.net/

Re:Languages Which Almost Became CSS by SteveLAnderson on Tuesday June 28, 2016 @03:02PM (#11996531)
DSSSL was amazing. Mr. Clark did some truly outstand work, and I benefited from using it with SGML and FrameMaker back in the day.

It was hard to learn, though, and the documentation wasn't good.

Re:Languages Which Almost Became CSS by pwenzel on Tuesday June 28, 2016 @02:01PM (#11995968)
Looking at the structure, the DSSSL language looks reminiscent of modern-day Sass.