Xah's Programing Blog

On programing, languages, functional programing, Unicode, keyboard, hacker culture, ….

Want to master JavaScript in a week? Buy Xah JavaScript Tutorial.

Programing Language: Polymorphism, Dispatch, and the Tale of Poly-Tinting

Logitech G502 Proteus Gaming Mouse. Look at it again. Analysis. Verdict: no buy.

What Does Formal Proof Mean?

the word “formal” in formal proof/grammar/lang, is sloppily used. Most people mean “rigorous”. It should mean: in a form of math formulas.

internet speed growth
How Fast Does Internet Speed Grow?

A Class of Computer Languages: Math Lang

A Class of Computer Languages: Math Languages

《Code Complete: A Practical Handbook of Software Construction, Second Edition》 amazon

This i read parts in 1990s. Don't recall much about it except that this is about the only science based appoarch on the questions of software engineering methodoligy questions. Am taking a look again.

this is in contrast to other voodoo in programing, such as the {agile, extreme programing, unix philosophy}

Voodoo of Software Engineering

SVG pain. inverted y axes; text default scale is absolute

inverted y axes

the y coordinate is inverted from normal

Solution, attach all your drawing to a group, then apply transformation, like this:

gp.setAttribute("transform", xd.translate(0, 2*ymin+ywidth) + xd.scale(1,-1) );

but, the problem is, if you have text, the entire font gets inverted upside down too.

So this means, there isn't simple solution to work with “not invert” y axes. Maybe there's a attribute to make text not invert or something. Still don't have a nice solution.

the inverted y axes is a major pain, because it drains brain when you work with “normal” y-axes, such as in math plots. Either twist your brain, or, you need to remember to attach a transform to every of your drawing primitive. Or, group them and transform.

text default scale is absolute

you can use svg viewBox to specify your drawing's coordinate range. that is, xmin, xmax, ymin, ymax

this makes it convenient. For example, if your app is plotting basic math functions, you can work with coordinate x from -10 to 10, y from -10 to 10. Instead of pixels and whatever is the current width and heigh of view port

but, if you add text in your drawing, such as axies labels, the text default to font size 16px. So, you have to manually figure out what's the scaling from your view box to view port, and rescale all your text elements.

〔➤ SVG Coordinates, Viewport, viewBox

Linux: How to Set Default App? (repost)

researched continuation whole day. it should be ban'd, together with closure.

continuation, is functional programer's version of goto. As such, it is not FP by definition. Similar is closure. #lisp

iterator, the worst shit in langs. It exits in shits like java, python. While function programers are laughing, but continuation, closure, is deeper shit.

closure, continuation, are the roads to Objects of OOP, and then onto complexity spaghetti lala land. #lisp #haskell

closure, continuation, are functional programer idiot's byproduct of computer engineering, similar to imperative's references and pointers.

continuation is like goto, but 100 times worse. Does it actually make things convenient & useful? If so, it's because the lang sucks. #lisp

closure, continuation, are concepts that doesn't exist in algorithm, or, math.

if closure is useful, it's because the language sucks. Same with #lisp macros.

What is Math? when things are stripped down to the minimal essence, it's called math.

Learning Notes on Goto, Continuation, Coroutine

suger syntax is no suger syntax

in all languages i know of, sugar syntax is no sugar syntax, but with slightly different semantics. The only language i know of with true sugar syntax is Wolfram Language, with syntax transformation before compiling.

Even lisp, with using macros to perform syntax transformation, is significantly different semantics than if the programer were to type what the sugar syntax is for.

Programing Language Syntax Soup

JavaScript prototype inheritance system, is inevitably confusing. It's impossible to get a sense of hierarchy. goto comes to mind.

JavaScript: Understanding Prototype & Inheritance

Microsoft Universal Foldable Keyboard is now available. For your phone or tablet.

logitech g910 keyboard key closeup 14
Logitech G910 Keyboard. New key switch: romer-g.


this earphone, AKG K3003i, $1k. Buy it. amazon

Google Gmail Blocks Mozilla Thunderbird

html5 hip hand sign
html5 hip hand sign.

This sign, signifies all that's wrong with the web. Coolio, bro!

Displaying Chinese Results Ugly Mixed Font (updated)

Linux: How to List & Install Font

How to Download Source Code of Firefox Addon

Firefox extention is usually a XPI file. That is, a file with name ends in “.xpi”.

in the “+Add to Firefox” button, right click to save.

then, rename the “.xpi” file to “.zip”, then unzip it.

Python vs OCaml

Python to OCaml: Retrospective By Thomas Leonard. @ http://roscidus.com/blog/blog/2014/06/06/python-to-ocaml-retrospective/

OCaml: What You Gain By Thomas Leonard'S Blog. @ http://roscidus.com/blog/blog/2014/02/13/ocaml-what-you-gain/

a new lang. ATS (programming language)

golang no exceptions 2015-07-14 13208
golang does not have exceptions. Screenshot from golang FAQ @ https://golang.org/doc/faq .

Programing: Why I Hate Exceptions

remember in the 1990s, perl claims to make programing fun again? most of these scumbags are dead.

in this day and age, are there coders who don't know 3,4 language?

in 1990s, mastering 4 langs is god. In 2000s, you are super. Today, if you don't know 4 languages, you a idiot.


1990s, 精通4个语言是神。2000s,是厉害。如今,你不会4个语言,你是渣渣。

Programing Languages Suger Syntax: Compiler Level vs User Level

JavaScript language syntax design f().g().h() vs h(g(f()))

so, am writing a JavaScript lib.

in design, there's 2 choices of syntax.

the popular is this, as in JQuery and just about any lib:


alternative, is traditional


I have to make a decision. You see, for most people, it's no brainer. Choice 1, done. But, i depise the hackers and fashions and youngsters. I want to use choice 2.

so, let's dig in to the advantage analysis.

choice 1 is convenient. Because it's linear. with choice 2, you have more nesting happening. Tends to be less readable.

But choice 1 brings in a semantic complexity. That is, in JavaScript, it does not truely have a postfix notation. Rather, the f.g.h works is because f returns a libX object, and g is a method libX object, and it also returns a libX object. Basically, your functions all returns a libX object, and you can thus dot it with a libX method.

with choice 2, it's simple. It's just functions. Functions return results.

Now, the lib am writing is XahDraw.js, so my namespace is xd. Let's look at the syntax again. It'd be actually like this:


alternative, is traditional


as you can see, choice 2 is actually more less readable. But again, choice 2 got simplicity. The “xd.” is purely a namespace. While with choice 1, you've got this ambiguity, where, to know that g is a method of xd, you actually have to look (trace) to what xd.f returns.

for detail, see

ok. What else? is it possible to write xd.h(xd.g(xd.f())) without nesting.

the answer is no. Because JavaScript doesn't have postfix notation, nor prefix notation.

see Concepts & Confusions of {Prefix, Infix, Postfix, Fully Nested} Notations

for example, if it does, say the post fix notation is |, then it can be written as

xd.f() | xd.g() | xd.h()

ok. So far, am pretty much consider choice 2 is superior.

also, if you go with choice 1, then, note that object sometimes have properties that's not a function. So, for example, let's say g is a property, so you might have

xd.f().g = 3

(for example, the xd.f() returns a svg dom object, and g is color, so you are setting the color. ⁖ var myCircle = (xd.drawCircle().color = "red") )

but in choice 2, this would be

xd.f().g = 3

now you can see this is quite interesting. Same syntax! Do you see a paradox? The 2 choices have different syntax, but now they have the same syntax! what's going on?

this actually illustrates the confusing point of the choice 1…. basically, with choice 1, it's “abusing” object inheritance as syntactical postfix notation.

now am not in a state to think of this thoroughly…

comment at https://plus.google.com/+XahLee/posts/Tw6pdF7v9nr

theres no cloud just someone elses computer
there's no cloud, it's just someone else's computer
language java doc size comparison
computer language doc size comparison

computer languages = decades of backward compatibility cruft problem

computer languages have a major problem. That is, backward compatibility. Basically all languages, are hit with decades of backward compatibility cruft. And, that seems to the the main problem of languages.

so, how to solve this?

it seems, one way, is to somehow magically automatically change all existing code. When old code run, it automatically generates new code, and that source code is run. Βut this doesn't seem to solve the problem. Because the lang still holds all the old cruft. It only reduces the problem, by making it trivial to update code.

perhaps another way, is to declare, that the language will forever be unstable. That, by using the language, you assume to continuously update your code. Google's web products, seems to be taking this approach. (even though it's not languages, per se. But lots of Google's API are like that, and comes and go.)

Keyboard: What's the Most Efficient Layout for Numbers?

What's the Use of the ▤ Menu/App Key? (minor update)

finally, we have a keyboard with a any key

keyboard.io model 01 right-side closeup
Keyboard.io Keyboard Model 01 ⌨

Happy Hacking Keyboard Gallery

List of Keyboards with Mechanical Switches (major update)

what's the characteristics of best language?

the best language, is one where every function f(arg) produce output. No closure, no macro, no object, no exception, no references points, no statements, no whatnot unnamed syntax. But 1 million such functions.

and language of this characteristics are: Mathematica, PHP, APL.

Programing Language Syntax Soup

comment at https://plus.google.com/+XahLee/posts/7VqkBTHeW4H

Mechanical Keyboard: what's Kailh Switch?

in mechanical keyboard community, in this year there's mysterious kailh switch. Here's a introduction. Mechanical Keyboard: Kailh Switch

Logitech G910 Keyboard design review.

Why Python Sucks collected index. Minor update.

Python: Function to Get Number of Args of Function (on its own page)

The KBC POKER keyboard, is now on amazon. KBC Poker Keyboard, Ducky Keyboard

Short Survey of Keyboard Shortcut Notations (repost. minor update)

Microsoft Sculpt Ergonomic Mouse 6000

Agile is a cancer that we have to eliminate from the industry. — Erik Meijer

Erik Meijer on Xtreme Programing and Agile

The Elements Of Style: UNIX As Literature (old article, dated around 2001)

What is a Tech Geeker? see comment by Peter Johnson What is a Tech Geeker?#comment-2044408048