2017-03-21

Rust is beautiful

I've invested some time to learn in detail about Rust, which means reading the excellent online book here. And it is beautiful. It makes me wish I could pause the world for a few years, to convert some 500,000 lines of C++ that exist under my purview into Rust, and continue from there.

Rust seems to take all the little design lessons I've learned in 20 years of C++ programming, and consolidates them into one language:
  • It's not best that everything is mutable by default, and const if the programmer points it out. It's healthier the other way around.
  • The fundamental string type is a sensible, immutable string slice (in Rust, a &str). This is great for zero-copy parsers, such as nom. Our code has had that for a decade – I named it Seq, or SeqPtr. C++ is adding std::string_view in C++17.
  • Elegant built-in variant with pattern-matching (in Rust, this is an enum). C++ is adding std::variant in C++17.
  • Type traits solve the problems of abstraction and generics, providing both static and dynamic dispatch, in an apparently more elegant manner than C++ inheritance (which is dynamic-only) or templates (which are static-only). Traits seem similar to concepts, which for now (unfortunately) remains a glimmer in Bjarne Stroustrup's eye.
  • Universal function call syntax. Something else Bjarne would like to introduce to C++.
  • Macros. Gawd, better macros (though not ideal – too templatey).
  • And of course, the crown – which sadly can't be brought to C++: compile-time memory safety!
If I were to start a programming career right now, I would use Rust. Hands down. I wish our major operating systems – let alone software we use – could be rewritten in it.

2017-03-17

Limitations of Central-American pronunciation

OK, pet peeve.

We (probably) know how native English speakers have trouble pronouncing Spanish – and most other languages – in a way that doesn't sound silly. English uses Latin in legal contexts, and I personally cringe how it's pronounced. I was brought up on classical and ecclesiastical Latin pronunciation, and Latin pronounced by English speakers sounds like none of that. To me, it sounds most like pig Latin.

But interestingly, the vocal range of Central American Spanish speakers – in my experience, Costa Rican and Nicaraguan – is even more restricted. "How could that be?" you ask. "They can pronounce rolled Rs!"

Yes they can. But here are a few words that Central Americans I've met cannot properly pronounce:

EnglishCentral American
pizzaPronounced pixa.
shortsPronounced chor, as in "el chor" (masculine singular: short pants).
sushiPronounced suchi.
Marshall (the name)Pronounced Marchal.
MitsubishiPronounced Mitsubichi.
Yency (name)Pronounced Jen-see.
Jana (my wife)Pronounced either Hah-nah or Jah-nah, with a "j" sound.
Correct pronunciation, Yah-nah, has not been achieved by anyone.

To clarify – this is not just a style that speakers prefer, but can deviate from. They cannot:
  • Try to teach them to say "sushi". They keep repeating "suchi", with a clear "ch" sound.
  • Try to teach them to say "Yah-nah". They keep repeating "Jah-nah", with a subtle "j".
  • Try to teach them to say "pizza". They keep repeating "pixa", with a clear "x".
This is not even to mention the constant confusion between "b" and "v". In Central America, it's as though these two letters produce the same sound. They can't tell the difference.

Let me not get cocky, though. I can't really tell (or pronounce) the difference between č and ć.

And then there's Cantonese, where the word we'd spell maa has at least 5 very different meanings, depending on the tone of the "aa", and we'd catch none of them without training. :-)

2017-02-08

"May prosper all the nations"

Jana recently wanted to share with the world – or at least, Facebook – the Slovenian national anthem, because it is a rare hymn that doesn't over-celebrate national pride; or call for indiscriminate bloodshed; but instead...
May prosper all the nations
who long await to see that day,
when over Earth's creation
all fight and strife shall be at bay;
when all men
shall be free;
no devils, only neighbors;
no devils, only neighbors 'll be!
Alas, that's not a widely recognized translation. In fact, it's very new. It's... my today's take on it. If it sounds a bit archaic, like in "all men"... Well, the original was published in 1848. It's supposed to be!

The official translation, though... By Janko Lavrin, from 1954... It starts like this:
God's blessing on all nations ...
Cue screams from Jana across the hallway.

"Who saw it fit to insert a god in this?!"

The whole point of Prešeren's stanza is coexistence and peace; free of religion and ideology. Yet Janko Lavrin chose to go with a concept that has historically divided and killed.

To his credit, Janko didn't know this was going to be a national anthem. He died in 1986.

Oh, and by the way: today is Prešeren Day.


2016-12-19

Righteous predators

I have come up with a word. Righteous predators.

OK. It's two words. But the world is full of them.

Righteous predators are the opposite of sexual predators; but perhaps equally harmful.

Whereas sexual predators harm with physical abuse; by forcing sex on someone who doesn't want it; righteous predators harm with psychological and legal abuse, against people who violate their "morals". These violations are perpetrated, not to help anyone; but to achieve a sense of righteous gratification.

For example, you got raped, and are now pregnant? The righteous predator will prevent you from seeking an abortion.

Do you need to abort because the fetus is going to have a birth defect, and is not going to survive? The righteous predator will make you look at pictures of aborted fetuses, and force you into a formal burial.

If you are 13, and you're propositioned by someone who's 35, you are a victim of sexual predation. But if you're 13; and your first time is with someone who is 14; and you both think it was nice, and beautiful, and consensual; then it's the righteous predator who's going to tell you you are damaged, and speculate about sexual abuse that certainly must have happened to you, since otherwise, how could you have been interested in sex at an earlier age than 18.

If you're 17, and exchange naked selfies with a boyfriend of the same age, it is the righteous predator who is going to prosecute you both for possession of child pornography.

If you go to a swingers' club, where couples engage in consensual sex – it is the righteous predators who are going to raid it.

If you want to sell physical intimacy in exchange for money, it is the righteous predators who are going to put you in prison for it. And it's the sexual predators among the righteous predators who are going to force you to have sex with them for free; otherwise, they put you in jail.

Righteous predators are plentiful, and inflict emotional and physical harm. Many people suffer from it; much like many people suffer from sexual predation.

2016-11-29

The $20 billion puppy, and "The buck stops with you"

On further reflection of the $20 billion puppy, I realize I subscribe to a "The buck stops here" principle. Which is to say, a person is not responsible to seek out and eliminate all suffering. But when a person can stop wrongdoing in a decision that's in front of them, the person is responsible.

The law takes a similar point of view. If someone offered you $20 billion to torture and murder an orphan, and you did it, you're going to prison. It does not matter if you spent all of it to save millions of orphans elsewhere. Your responsibility is to stop the buck when the decision is in front of you.

When you realize that something is an important principle, it becomes increasingly hard to justify ever violating it. It's not your duty to seek out and stop all suffering. But if you integrate the principle that, when a buck is being passed, it must stop somewhere; and that it must stop with you; then violating this principle comes at the cost of integrity. Even if no one catches you, you know what you did. If previously, you did not have to lie to the world – now you do. But if you maintain honesty, then everyone knows that you are for sale. For a big chunk of money, you stepped on a puppy. What else are you happy to do?

Outside of the values we infuse it with, life does not seem to have an intrinsic meaning. In this sense, it is similar to an open-ended video game; a game such as EVE, or like World of Warcraft, which does not have an obvious goal. Your initial purpose is to explore the game. But once you've done that, what's your goal? If you pick one, then whatever it is – it gives meaning and fun to the game. But if you do not choose one, there's nothing; there remains no incentive to play.

So it is with life. There seems to be no intrinsic goal, but you have to choose one for yourself, otherwise it is pointless to live. If you have chosen goals for yourself; and one of them is that the buck stops with you; then violating this has an intrinsic cost that cannot be measured in any amount of in-game currency.

Your goal cannot be to stop all suffering, everywhere. That involves coercion. That is not entirely up to you. But you can make it your goal that the buck stops with you. And that is a principle worth defending.

2016-11-28

Rationalists and control fetishists

Let's talk about sadism.

Sadism is an expression of service-to-self. Service-to-self is a spiritual and philosophical orientation whose fundamental trait is that only one's own subjective experience matters. The conscious experience of other persons and creatures is not perceived to be a thing. Instead, such other creatures are perceived to be phenomena, which are judged in good shape if they serve the individual's self; and are in need of control and coercion when they fail to serve properly.

Sadism, in particular, is the enjoyment of the practical application of the methods of control and coercion, whose purpose is to obliterate the individuality of the other-self. The ultimate goal is to force the other-self to accept that it is only an object in the mind of the sadist. The sadist believes he or she is all that exists. Their pleasure is in taming you so that you too accept that they are everything. The climax of this experience for them may involve destroying you physically; but by far more important is destroying you psychologically. You no longer exist as a person, and the pleasure is when you're forced to accept this.

Now, consider Eliezer Yudkowsky. He is a self-taught polymath and an AI enthusiast who has single-handedly founded a rationalist community through his blogging with Robin Hanson on Overcoming Bias, and later started a quite successful offshoot in Less Wrong. Eliezer is concerned with optimizing the world, ostensibly for the benefit of everyone. He is also, I was told, a sadist – which he has kinda confessed:

BDSM didn’t exist in dath ilan. I don’t really know why. Maybe everyone in dath ilan who realized that they wanted to be hurt, categorized themselves as having the stereotypically nonvirtuous quality of self-destructiveness, and kept quiet about it, or met only other people who thought the same thing. I’m very worried, in retrospect, that they all managed to cure themselves via standard self-modification techniques. It’s *very* obvious that if I’d realized in dath ilan that I was a sexual sadist, I would have treated this as an error and probably not told anyone before I fixed it. It would not have occurred to me that sexual masochists were a thing or that I could find a willing victim to be sadistic at, I would have thought I was being sick and selfish. Having been to Earth, this strikes me as a genuine failure of dath ilan culture, and even worse, I have to confess it’s the sort of thing that Earth’s Hollywood Vulcan stereotype might lead someone to expect [...]

He writes fiction where he praises an imaginary rationalist culture, and their superior approach to solving problems. Yet he builds into it a complaint that they have also "solved" sado-masochism. He appears to think of this as a loss.

And then, he posts things like this on Facebook:




Eliezer may not realize it, but this only makes sense if you're already a sadist; if you're confused; or if you're trying to rationalize yourself into service-to-self, where you're the only consciousness that matters.

The fundamental problem with this is that $20 billion has no other use than to control what other people do with their time. In order to want $20 billion, you must have a desire to control.

Eliezer, of course, has this desire in spades, and so he thinks it's rational to assume that everyone else has it, too. But this is not the case. For most people, $20 billion is more of a curse. After they've catered to their whims – what does the average person know about using $20 billion responsibly? I wouldn't know how to use it.

If you ask most people if they want their mortgage paid off now, at no cost, I suspect everyone would say yes. The way we structure our economy makes almost everyone a slave. I can see how most people would step on a puppy in order to no longer be slaves. I can imagine plenty would do so, even as they beg the puppy's forgiveness.

But $20 billion is more than a personal liberation. Even one 10,000th of that – certainly one 1,000th – is sufficient. All of the rest is enabling control. If you already feel personally liberated enough, this whole situation is whether you're the kind of person who feels a compulsion to inflict their will on others.

Which Eliezer is. And he cultivates a following who are these types of people. And he encourages thought that justifies being this way, and rationalizes becoming this way even more so.

This is, fundamentally, the wrong type of person to be – if you want to live in a universe with other people. This is because, if you want control – this can ultimately only be had in a universe consisting of one person. As long as other people exist, they can do things to thwart your control. And you don't want the control just for kicks; you want it for reasons that seem existential. The ultimate end-game of this concept is a realm where one person dominates all others, to an extent that all other persons nearly cease to exist. And the way to this end-game is ever-increasing commitment to service-to-self: a direction of mind where your consciousness is the only thing that matters; and you come to perceive other people only in terms of their usefulness to you.

This includes people you love. It includes your partner and your children. At some point, it leads to the realization that loving people is in counter-position to your desire to control. Because love does not control.

The desire to control is rooted in fear. For Eliezer, this fear is existential. He has experienced a heart-rending death of his brother. So he seeks to eliminate death.

But the only way death can be eliminated is through control. And the only way a sufficient amount of control can be imposed is by de facto killing everyone's individuality. If one wishes to deny the ways we can put each other at risk, this extends to everything, including thought. Because thought can lead to words; and words can lead to actions; and actions can cause death. This can be negligent or intentional death of others; or suicide on purpose; or suicide through risky or unhealthy habits or drugs.

The result is a universe where death has been eliminated, but only because there is nothing left to die. There is only one individuality remaining. That of the controller.

There is another path, and it is at odds with control. It is to let go. Help other people if you can. Absolutely, if you can – research cures and improvements. But don't try to clutch. Love everyone to the extent that you can; accept things as they come and go. Grieve your loved ones when they leave; but also let them go. And then accept new ones.

Do not fear death. It is almost certainly not the end of things. But most of all: do not be too afraid to live.

Life is not about clutching things in a fist. You either open the palms of your hands, and accept what freely flows out and into; or you clutch what you're holding right now, and scare or squeeze most of it away.

If something fails to escape your grip, the squeezing for sure will kill it.

If you already believe you are free, there's nothing you can buy with $20 billion that's worth stepping on a puppy. If the things you want people to do are good things, they can already do them themselves. If they do not, there are reasons for this other than money, and words will go further than bribery. Billions can free you from perceived enslavement – but all you get beyond that is an exercise in the futility of control.

If your ideas to improve the world are so great, they will have an effect. It does not involve killing puppies. Unless we're talking clinical research – in which case, it might. But not just for no reason.

2016-09-26

Is the internet ready for DMARC with p=reject?

No.

DMARC is an email policy that builds on DKIM and SPF to provide a way for email senders to declare: "All email from this domain comes from this set of servers (SPF), and is signed using these public keys (DKIM)."

It's nice and well that we are finally able to do that, but DMARC comes with 3 modes of operation: p=reject, p=quarantine, and p=none. These modes suggest what a recipient should do if an incoming email doesn't match the sender domain's DMARC criteria, either due to signature failure (DKIM) or incorrect sending server (SPF). The default mode, p=none, boils down to "do whatever, maybe this helps you guess if the email is spam". The mode p=quarantine treats the email as spam, and p=reject is supposed to cause the message to be rejected at the point of ESMTP delivery.

Well, I tried p=reject, and it kinda works. Mostly. Except in the following situations:
  • If you send to any mailing lists from your domain. Your messages may be DKIM signed, but when the mail server forwards them, they will be sent by a mail server that does not have authority to send messages for your domain according to your SPF criteria. Message headers may also be modified so that the DKIM signature does not validate. This will cause your messages to the mailing list to be rejected by many subscribers at the point of ESMTP delivery. This in turn may cause the mailing list to frown on you.
  • If you send to anyone with a multi-layered mail server setup. In this case, your message is received correctly by the front mail server, which is configured to forward it to a back mail server. You cannot control this because it's a setup specific to the recipient and unknown to you in advance. But the back mail server is poorly configured to verify DMARC criteria, and rejects the message because it violates your SPF policy – from the perspective of the back mail server, it is coming from the wrong IP. The message may then be deleted silently, or sorted into trash.
This means you pretty much can't safely run a mail server with DMARC policy set to p=reject. For the same reasons that p=reject is not safe, p=quarantine also makes no sense. There's not much difference between causing your outgoing mail to be bounced and/or deleted, or causing it to land in spam.

DKIM and SPF are good ideas, but it's unfortunate that the policy has to be "none".

2016-09-08

Lock-step refactoring

This may seem obvious, but I am biased to avoid saying things that are obvious to me, and then things don't get said that are worth saying.

A nice thing about statically typed languages, like C++, is how you can use the compiler to help refactor.

Code often needs to be refactored. If it is not, it gets harder to fix issues and implement new features. When this happens, the temptation arises to throw the code away and write new code, but this is almost always a mistake. The correct process is to refactor code that works, to disentangle anything that needs disentangling, so that improvement becomes easier.

When there is existing code you can use, you should only ever write new code if you're willing to go through the entire years-long process of how it needs to work, and why it needs to work that way. Otherwise, use existing code, and keep improving it.

Refactoring is scary. It is scary because you have this hairy code, and you're concerned that any change you make to it will break it.

Behold, the beauty of a statically typed language. By leaning on the compiler, you can refactor in such a way that code will not compile until it is fully updated – and ideally, correct:
  1. Start with code that compiles and passes any unit tests you might have. Write unit tests if there aren't any. Focus on functionality you're worried about, and want to fix and/or preserve.
  2. For each modification you want to make:
    1. Find a way to make this modification so that the code will not compile unless all parts that need to take this modification into account are updated.
    2. Repeat the build as many times as necessary to identify all parts you need to update.
  3. When the code builds, if you used the compiler to aid you correctly, you should have found all the places that required updates. Unit tests should not fail because of missing an update. They should only fail if an update you made was incorrect.
For example:
  • If you change parameters accepted by a function, make sure no possible call using the previous signature will compile with the new signature.
  • If this cannot be achieved, rename the function, so that references to the old name will not build.
  • If you change the behavior of a function in a way that requires callers to update, change its signature in a breaking way, or change its name.
  • If you change the rules regarding a widely used data member, change its name.
  • If you change the rules regarding a widely used type, change its name.
Aspire to perform all changes in such a way that, if you're not 100% done, the code will not even compile. Don't make changes that allow the code to compile if you're only 1%, or 40%, or 99% done.

2016-08-28

Loyalty to group vs. principle

Principles, nearly by definition, are rules that when they are adhered to, lead to good results. Group loyalty, then – loyalty to specific preferred people over principle – necessarily produces worse results. The two are not the same, so to maintain loyalty to a group, one must depart from principle.

Countries differ on the ubiquity of group loyalty over principle. Prosperous countries tend to be more loyal to principle; shittier countries tend to have more loyalty to groups. It takes a prosperous environment to be able to afford to be loyal to principle, but loyalty to principle also makes a prosperous country. In comparison, people in shitty places feel like they need to be loyal to their families and local groups, but it's also the group loyalty – and lack of principle – that makes those places shitty.

You can find shitty subcultures where group loyalty dominates even in prosperous countries. Compare inner city ghettoes with the "snitches get stitches" mentality. Or the lifestyles of gypsies in Europe, whose loyalty is only to their group. Poor people often have high loyalty to family – because they must, their family is struggling – and this is what helps keep them poor.

To the extent that group loyalty exists among the elite – the rich, the police – it serves to bring down the rest of the country. Group loyalty among the rich results in an economy that benefits them, instead of most other people. Group loyalty among the police results in them mistreating, often killing people, and finding no wrongdoing among themselves.

It needs to be accepted as an ethical standard that people need to be loyal to principles. Loyalty to a group, ignoring principles, needs to be viewed as a form of corruption.

2016-08-24

Limitations of single-payer health care

The US runs a degenerate health care system, with abhorrent symptoms that are too many to enumerate. I offer a small tasting sample:
  • Drug companies that lobby to ban older inhalers whose patents are running out, so they can continue selling new patented ones at high markup.
  • Drug companies that lobby Congress to create demand for a product, then jack up prices to $609 per unit to deliver $1 worth of a drug.
  • Private insurance companies created as an accident of history, lobbying to perpetuate a system that routinely denies health care to people who most need it. Before the Affordable Care Act, they would deny coverage to people who they knew would be a net loss. Now, they offer poor people plans costing $1,000 per month, where they don't even cover anything under $5,000.
  • Health insurers may engage in shady practices. Just one, now deleted comment:
    [Insurance company] had my parents sign a bunch of stuff that absolved them from paying for my burn unit bills just days after [I] was burnt. My parents [don't] even remember signing them since they themselves were in shock.
  • Insurance bargaining causes providers to keep list prices of 5x what services actually cost. If you lack insurance, you will not only pay out of pocket, you'll pay 5x the price and go bankrupt.
  • No dental care for the poor. I estimate at least tens of thousands are left with decaying teeth they can't afford to fix. Most Americans can't afford a $500 surprise bill, and dental care is not covered by the ACA, so they don't have insurance. Tooth infections are left to deteriorate, with chronic pain that lasts for years, until the infection enters the bloodstream and the person visits the ER. Once there, it depends on the provider whether they will do what they can to save the person, or neglect to look at them seriously (so they die) because no one pays for it. Young people (with work, and young children!) have to rely on charity to not die due to their teeth.
Since this is unjust and causes pain, people talk about single-payer health care. This is a good idea, but it comes with problematic assumptions. A frequent one is that, under single-payer health care, the same money we're paying now will get everyone all the health care they need. This is not the case.

There are countries where single-payer systems appear to work, but have complaints. Complaints arise because no such system works by addressing all of their populations' health care needs. The potential cost of that would be infinite. It is in fact not the budget of the system that stretches to cover health care, it's the other way around. A budget is established, which is as much as people are willing to pay; then health care is made to fit within that budget.

When I say health care is "made to fit", I mean people are having to wait for health care in certain cases, and some of them die before they get it, or they can choose to pay for it themselves. This goes especially for the elderly. If you're old and need heart surgery, you get put on a queue that's 18 months long. If you survive by then, you get the surgery. If you do not, that's a saved cost for the system. If the queues are structured sensibly, this does not end up really affecting average life expectancy: people who end up not getting treatment are those who would die soon, anyway. However, it makes it appear as though the system is heartless, because it has to economize, and somehow ration access to health care.

If single-payer care existed in the US, it could not work any differently. Infinite amounts of care cannot be paid. If tax payers are willing to pay $4k per capita, that would be the budget, and the health care would be rationed out. This means not every obese diabetic necessarily gets treatment, and may die.

This differs from private health care, not in that care is not rationed, but that it is rationed so everyone gets something, instead of some people getting nothing, and others getting maximum possible care. Under single-payer, health care access is simply not completely based on the moneybags you have.

2016-08-17

Why software patents are counter-productive

I've said this before, but I need to keep saying it until the US patent system is reformed. This may mean forever, if necessary.

The existence of patents for software is not okay. There may be a so-so argument for patents where things cost $1 billion each to develop. Even there, publicly funded research could deliver solutions that focus on more real problems, and help more lives.

But there is no argument for things where the cost of development is cheaper than defending a patent, or even filing for one. For software, there is no reason to have patents. It's a pure intellectual land-grab.

Software that takes years to develop will not be founded on a single idea. It will rest on tens of thousands of ideas.

Each individual idea in a software product is low value on its own. The value is in building software that combines the ideas, and then maintaining that software to respond to users' needs. Most of the value of software development is in this process.

All software is protected by copyright. This is more so true for software that takes several years to write.

The presence of patents in this process does not act to preserve the crown jewel that's at the core of your software, because you do not have that type of crown jewel. Your crown jewel are your developers and your process.

If you now introduce patents to this process, all of the above is still the same, except now you can tie up your competitors in court on the basis of each of the ten thousand ideas used in their software, claiming that you own some form of right to that. In return, they must have a portfolio of patents themselves, so they can counter-claim that you violate their patents in your software.

This acts to remove small developers from the field, and divert resources from the work. The net benefit is negative.

It is generally most useful for ideas to be public. The main justification for the patent system is that it's a way for useful new ideas to become public, by way of granting their originators limited monopolies. This way they might not keep their best ideas secret, which is seen as a lesser evil than risking good ideas to be lost.

This system is only worth it for ideas that would not otherwise become public, or would not otherwise be discovered because discovery requires too much effort if not rewarded. The patent system is specifically not worth it where developing the idea requires less work than filing for a patent, or defending it.

This criterion is generally not met for any idea in software. Virtually all ideas that make software work are individually small and non-unique.