Popular Culture:

Nerd Culture:

Science, Software, Hardware:

Zeroth World:

Comics/Images/Audios/Videos:

Quotes:

Two persons sitting at a table. Person 1: "You don't seem to use your computer, may I check my mails?" -- Person 2: "Go ahead. You know how to open Xterm." -- Person 1: "Hm. It only opens context menus." -- Person 2: "The mouse is in left hand mode." -- Person 1: "Ew. Strange things happen when I type." -- Person 2: "Sorry, dvorak. Here. Now it is qwerty again." -- Person 1: "Where can I enter the address?" -- Person 2: "Press :go and then type it." -- Person 1: "Hm. The website looks strange." -- Person 2: "Ah, CSS, JavaScript and cookies are disabled. I'll enable them for you." -- Person 1: "I followed a link to a video, but it isn't showing." -- Person 2: "Hm. No Flashplayer. Try youtube-dl." -- Person 1: "Ok. Hm. Something still doesn't work." -- Person 2: "Wait a minute, I'll just set up a virtual machine for you."

There are only two kinds of languages: the ones people complain about and the ones nobody uses.
— Bjarne Stroustrup

JavaScript is the new C. Similar claims have already been made, but not only do I want to claim that JavaScript is the new C, I also claim that this is not as bad as some people might think.

Now, what most people agree upon, and what might be the reason for the existence of emscripten, is that JavaScript is widespread. Most computers will somehow support it. Is this a coincidence?

It is my observation that a programming language spreads only if it sucks sufficiently, but not too much, and has a single advantage. PHP sucks, but it doesn't matter: It was easy to deploy simple web applications with PHP. C++ sucks, but it is fast, a bit more abstract than and mostly compatible with old C code. Java sucks, but it was the first really practical and portable GUI framework, and the first really widespread web plugin, even before Flash. And of course, we don't have to talk about why C sucks, but its great advantage is its pointer arithmetic and that it can be used as a portable typed assembler.

On the other hand, looking at Haskell, I know many fanboys, but I also talked to people who hate this language or are at least not interested in it. For some people, it sucks too much, while for some people, it fits perfectly — I think this is a general pattern: The broader your audience, the worse your fit for an individual problem. And by evolutionary processes, while the languages that only fit a specific audience will stay inside that audience, the languages that fit all needs somehow will spread, especially if they happen to have one feature that makes them distinct from everything else.

And I think that this is the case with JavaScript. Many programmers appear not to like it much, but it gets most of the jobs done, and it runs everywhere, and it is trivial to deploy - the one feature that makes it distinct from everything else. Yes, C can be compiled for every platform, but deploying applications to people is a lot harder than just telling them to follow your link.

So, JS has many things that make it hard to use. I can totally agree with that. Its possibility to add stuff to objects at will, and just default everything to undefined until something bad happens, is annoying, for example. But so is C: A simple off-by-one-error in an array access can have consequences at a completely different part of the code, that is why there are frameworks to debug and test code. C and C++ use a type system to cope with these problems to some extent. JS does not enforce this, but there is a framework that allows you to do so.

That is pretty much the way it is done in Lisp: You can add type annotations to make the code more efficient and easier to debug, but you do not have to. Not adding type information can be extremely useful in the cases when the actual types are not clear from the beginning ("prototyping") and for small code snippets and simple hacks. Every larger project should utilize types. I would even argue that they should use dependent types, but this is (mostly) tightly coupled with purely functional programming.

By the way, this is not the only parallel to Lisp. And while many Lispers will probably object to JS being a Scheme in C clothes, there is some truth in this: JS has a comparably simple data serialization format (almost as simple as Lisp's), and it has runtime compilation of Strings – which can be used to build a macro system and local domain specific languages. There are even REPLS for JavaScript.

A main difference to Lisp dialects is that it has a richer Syntax that is closer to the commonly used programming languages nowadays, and (except for Common Lisp) it is more complicated to implement, therefore not prone to the Lisp curse.

You can work with it as you would with C/Java and basic structs, but you can as well implement algebraic types. It is probably not particularily good at eiter of these jobs, but also not too bad – it gets the job done. And like Java, it gets the job done without offering too much space for security critical bugs (even though there are things like XSS exploits, of course).

The problem with Java is, that it has the repute of being slow and memory hungry. In my opinion, this was the main disadvantage of all similar languages over C and C++: They are not "on the metal". I would argue that neither is C (and especially C++), but the correspondence to the underlying machine is more direct. JS still has the same problem – even though the JS engines are doing a very good job – but there is a new way people try to address it: Asm.js. It is amazing how fast stuff becomes, and how easy it is to embed it into other JS code. As an example, here is a probabilistic approximation of a Sierpinsky-4-simplex, written mainly in asm.js (notice that you can drag the zero-point and the endpoints of the four axes with the mouse):

On Firefox 36, this still lags a little, but the reason seems to be the rendering engine rather than JS. On Chromium and most WebKit-based browsers, this has no lag at all. Look at the code: it is a portable assembler that runs on every relevant platform. It is compatible with a lot of "legacy code" through emscripten - a killer-feature of C++. And it can be embedded in a programming language with already installed bindings for almost everything, especially, for many things that users get in touch with now. While other languages still bother with libraries for accessing and parsing websites, files, the user's configuration, networking, everything that really matters to most users can be done with JS. There is an API for binary file access, a preliminary API for push notifications, APIs for 2d and 3d graphics, realtime communication.

Of course, I am not saying that C will completely vanish. It did not vanish in favor C++, it did not vanish in favor of Java, and it will not vanish in favor of JavaScript. The Linux Kernel is still written mainly in C, and I do not think that this will change. But the design of shared libraries still bases on C mostly, and the standard library of C is the only thing that is usually taken for granted. My guess is that an increasing number of libraries and other languages will target embeddability in JS rather than C.

Furthermore, I want to make clear that I do not like JS, especially as it is often used superfluously on bad websites, or breaking originally good websites. But remember, we could have ended up with Visual Basic Script. Or CFML. Or XSLT.

Popular Culture:

Nerd Culture:

Science, Software, Hardware:

Zeroth World:

Comics/Images/Audios/Videos:

No Bock to draw a comic this week, but here is a 4d Hilbert Curve (you can drag the coordinate axes and zero-point, JavaScript required):

The coordinates were generated using this software.

ℐ¢н ♭ḯᾔ ∂αṧ Ш☤℮ṧεł √øм ℳαґ

Popular Culture:

Nerd Culture:

Science, Software, Hardware:

Zeroth World:

Comics/Images/Audios/Videos:

Quotes:

External Content not shown. Further Information.

Es wird Ʒeit mal wieder etwas auf deutſch ʒu ſchreiben, ʒumal mir kein Analogon in der engliſchen Sprache bekannt iſt. Es geht um einen ganʒ beſtimmten Neologiſmus, naͤmlich „jein“, manchmal auch „jain“ – offenbar eine Miſchung aus „ja“ und „nein“. Es ſcheint irgendwie ein trend ʒu ſein, das in Chats inʒwiſchen ʒu benutʒen.

Nun habe ich generell gelernt, offen gegenuͤber neuen Trends ʒu ſein. Wurde ich am Anfang meiner Schulʒeit noch genoͤtigt, Texte von Leuten ʒu leſen, in denen ſie ſich daruͤber aufregten, daſs es jetʒt Angliʒiſmen wie „cool“ gaͤbe, die man korrekterweiſe ja „kuhl“ ſchreiben muͤſſte, entwickelte ſich dann eine Abneigung gegenuͤber Internetkuͤrʒeln wie „LOL“, und es kamen Buͤcher wie „Der Dativ iſt dem Genitiv ſein Tod“ heraus. Oh, und nicht ʒu vergeſſen, wie viele traͤnen ſind gefloſſen wegen der Rechtſchreibreform⸮ Und wie viele Leute weinten dem ſcharfen S nach, das ja angeblich abgeſchafft wurde⸮ Ein Geruͤcht, das ſich uͤbrigens tapfer ʒu halten ſcheint, dabei haben wir inʒwiſchen ſogar ein großes ẞ, alſo mehr als vorher. Und wie viele Leute trauern noch heute dem rhetoriſchen Frageʒeichen nach⸮ Alles eher unintereſſant fuͤr mich. Ein biſſchen nerviger finde ich da dann, daſs man Anfuͤhrungſʒeichen nutʒt, um Dinge hervorʒuheben. Und Deppenleerʒeichen ſind auch irgendwie unſchoͤn. Und was ich im Grunde garnicht leiden kann iſt es, „nen“ ſtatt „ein“ ʒu ſagen, denn dies iſt nicht einmal eine Abkuͤrʒung. Dennoch, Sprache entwickelt ſich. Was will man alſo machen⸮

Jedenfalls nutʒe ich durchaus auch gerne moderne Kuͤrʒel wie „-v“, um ausʒudruͤcken, daſs ich gerne mehr wuͤſſte. Beſonders haͤufig benutʒe ich dieſes Kuͤrʒel, um auf „jein“ ʒu antworten. Und hier wird klar, warum ich dieſes Wort nicht nur haͤſſlich ſondern auch unhoͤflich finde: Es ſagt uͤberhaupt nichts aus, außer, daſs man wohl irgendwie teilweiſe etwas richtiges geſagt hat, und teilweiſe nicht. Es bedarf aber immer weiterer Erklaͤrungen. Wenn dieſe nun immer prompt folgen wuͤrden, waͤre es nicht mehr als ein nerviges Fuͤllwort. Dummerweiſe ſcheinen diverſe Menſchen davon ausʒugehen, daſs ihr „jein“ fuͤr ſich ſtehend in irgendeiner Weiſe hilfreich ſei, ʒumindeſt muſs man ſie nicht ſelten auffordern, genauer ʒu werden – „-v“ eben. Ob man dann eine ſinnvolle Antwort kriegt iſt die Frage; nicht immer jedenfalls.

Freilich iſt niemand im Ʒwiſchennetʒ verpflichtet die eigenen Fragen ʒu beantworten. Aber wenn man ſowieſo nicht vorhat, dies ʒu tun, woʒu dann mit „jein“ antworten? Und wenn man antworten will, wieſo dann nicht gleich ſinnvoll? Wenn man auſdruͤcken will, daſs man eine Antwort geben will, die nur etwas laͤnger dauert, kann man auch kurʒ „moment…“ ſchreiben, oder – wie ich es gerne mache – den Satʒ anfangen und an einer Stelle mit „…“ unterbrechen, an der klar iſt, daſs noch mehr kommt.

Wie dem auch ſei: Bitte hoͤrt auf, dieſes graͤſſliche Wort ʒu benutʒen!

Panel 1: A person is falling in the water. -- Panel 2: He is diving below the surface. -- Panel 3: A big whale swallows him. -- Panel 4: He sits inside the whale's ribcage, and looks sad. -- Panel 5: "∀tv" is placed in the upper left corner, similar to text overlays in television. He looks confused. Around him, some stars, megaphones and a rotation light appear. A quizmaster appears, holding a microphone and a notepad, and sais: "Welcome to the Cash Whale!"

Did you know that LaTeX indents all paragraphs, except for the first one in a section? Combined with the uselessness of \nopagebreak, this gave me headaches today. I wanted LaTeX not to break the page at a certain point, because the line after it broke was introducing the formula, which was then on the next page. And somehow, all possibilities failed, except the sledgehammer that always works: a minipage.

So I used a minipage. The problem with minipages is that they seem to be actually considered as pages. And therefore, my paragraph was the first paragraph on this page, which is why LaTeX did not indent it.

Of course, explicitly using \indent was also useless. Because LaTeX knows best. And of course, there is a package for that.

I ended up with ... rephrasing my document. And I was wondering: Why do so many people let themselves control by this F60.5-religion?

Popular Culture:

Science, Software, Hardware:

Zeroth World:

Comics/Images/Audios/Videos:

Quotes: