Maralorns Blog - All Posts in Englishhttps://blog.maralorn.de/2023-06-17Malte Brandyblog@maralorn.dehttps://blog.maralorn.de/static/img/my_avatar.pnghttps://blog.maralorn.de/post/lack-of-democracyA Lack of Democracy2023-06-17<p>There are many ways to tell the story of humanity. One way to tell it is to talk about power. Let’s use the following definition of power: Power is the ability to make stuff happen in the way you want. It starts with taking a breath and deciding what to have for breakfast. And it can scale up to deciding where to build your fancy castle (be it on Earth or on Mars) and what wars to fight, which people to kill.</p>
<p>About a thousand years ago power was distributed relatively simple. There is a local lord, and he (yep, basically always a he) decides what happens. He ruled, he had the money, everyone worked for him. Over time things changed. Humans made progress, the economy grew. While the lord was busy being stuffed with turkey, hard-working citizens started to accumulate wealth on their own. This gave them a bit of power and people started thinking about the ecomony and the state as separate things. Then democracy came and these days in quite a few countries it is the people who are allowed to decide about the matters of state.</p>
<p>What was not democratized? The economy. And this is kinda understandable. Civil liberties and personal freedom (which is basically the same as having power over your own life) are great success stories (insofar as they have been achieved). And this is connected to declaring the economy “the private sector” instead of a matter of public interest. But I’d argue we went a bit over board with it. Imagine the state (be it democratic or not) forces you to do whatever they want for 40 hours a week. Sounds outrages? The state shouldn’t have that power! Weirdly, we are completely used to being told what to do for 40 hours a week, we just have the freedom to choose by whom, and then it’s apparently okay.</p>
<p>I don’t want to say, that working for money is generally a bad thing. I just want to emphasize that having money means having power and quite a lot of it. Not in the “rich people have it easier to influence politics” kind of way, which is of course also an issue. I mean the direct, “with enough money you can make nearly anything happen” kind of way. And by the way “making anything happen” here very much means telling other people what to do.</p>
<p>Now, one could argue that this is not necessarily a bad thing. After all someone needs to decide. Why not let the people with the money do it? There is a reason they have the money, right? Well, we weren’t okay to have that with the lords and kings for the matters of state. We replaced monarchy by democracy and while it’s arguably not always going great there is a large consensus that this was an improvement. So why do we have it with the lords and kings of economy? And we do have it. Most of the wealth today is not earned, but inherited. Of course some people increase their wealth by a lot more than they inherit. But a lord could also increase their power much more than his father had, e.g. by winning a war or something. It’s still a monarchy and a peasant had basically no chance to do it.</p>
<p>So yeah, the way we structure huge parts of our society is fundamentally undemocratic. While I have probably at this point lost the conservative and liberal leaning parts of the readership, I want to admit that this does not have to be a bad thing. Coordination problems are hard and democratic decision procedures are imperfect. Maybe the economy not being democraticly controlled could be a good thing? I personally would perhaps be okay with it, if it made everyone better of. On the other hand a no-go for me would be … if it kills all of humanity.</p>
<p>Okay, this is a hard twist. I admit I am mixing up two topics here, but I believe they are deeply intertwined. We are currently witnessing that a lot of the world’s wealth and therefor power accumulates in Silicon Valley. And they use it to develop new technologies. They do it fast-paced and without much of oversight. They do it because they can and admitedly some of their output is pretty nice.</p>
<p>These days though the voices become louder that we are running in the direction of a cliff. That shortly AI will become very powerful and maybe kill us all. I have no clue if that’s true. But I find it deeply unsettling when people talk about this like a force of nature. Like there is no way that AI won’t happen. No! It’s the economic lords in their silicon castles who are making it happen.</p>
<p>Again, I don’t know how big the danger is. I just think this serves as a great example. These people believe they have the fate of humanity in their hands, and they very well could. If not because of AI then because of something else, after all they have a lot of power and decide where we are heading in quite a few ways. Do we trust them to make that decision? Are they the ones who should decide it?</p>
<p>They do not ask anyone for permission, because they don’t have to. They have the power. And people talk about it like it couldn’t be any other way …</p>We are used to a lot of decisions in this world being made by people with money. I think this is bad, especially if it kills us.https://blog.maralorn.de/post/tough-choicesTough Choices and Disappointment2021-12-23<ul>
<li>Imagine you are eight years old, and your dad takes you to the bakery. They have all sorts of tasty cakes. You really like the one with chocolate crème, and another one with strawberries looks wonderful, too. You want to have both, but your dad says you can only have one piece of cake. What do you do?</li>
<li>Imagine you live on a planet which is hit by a pandemic. Scientists tell you it is pretty dangerous. After a while they make a vaccine which works well. You personally have some risk factors which mean that the virus would be bad for you, but you also can’t be sure that the vaccine causes no problems for you. You get offered the vaccine, and whatever choice you take, you run a risk of complications. What do you do?</li>
</ul>
<h3 id="tough-choices">Tough Choices</h3>
<p>These are two examples of a tough choice. What do I mean with a tough choice? A decision you have to take, where every option has negative consequences, e.g. getting no chocolate cake or risking an infection with a potentially deadly virus. When we think in terms of opportunity costs probably most decisions fall under this definition, but that’s okay. Important is that every option feels like it has a downside. If not getting strawberry cake doesn’t feel like a downside to you, that’s fine. I am sure you know what a tough choice is anyway …</p>
<p>The problem with tough choices is that they are hard to make. (Dough.) We don’t want to decide because it feels that however we decide we do something wrong. We feel like we are worse off after making the decision, and we don’t want to be worse off.</p>
<p>One way I like to think about situations like this is, by trying to tell myself that the damage to your emotions is already done. Choosing an option feels like being worse off, but you actually already lived in a world and a mind where you had to accept some negative consequences.</p>
<h3 id="dis-deception">Dis-deception</h3>
<p>The German word for disappointment, Enttäuschung, is beautifully literal in my opinion. Because Ent-täuschung, if you try to translate the spirit of the word, means something like dis-deception. You were in a deceived state about the world, but you got some new information which made clear to you that you were wrong. And if you were wrong in a way that you like your new view less than what you previously thought the world is like, you are disappointed … or dis-deceived, if you will.</p>
<p>In our example you thought that you can maybe have two tasty pieces of cake. Turns out you can’t. That’s disappointing. Or you thought you can have a nice few years meeting friends and not getting sick. Turns out it’s not that easy. How disappointing. You have heard there is a vaccine now, but people on the internet say it could be dangerous. Your doctor tells you those people are crazy, but she can’t promise you that there won’t be rare complications. How disappointing.</p>
<h3 id="1-get-disappointed-2-decide">1. get disappointed 2. decide</h3>
<p>The point I am trying to make here is that you already know that your situation sucks. In the moment you realize that you have a tough choice to make you have already been disappointed, and it’s totally understandable if you feel bad about this. But maybe you can find a way to acknowledge this,and now you choose the option which sucks the least. From this perspective deciding what to do doesn‘t make you worse off.</p>
<p>I like to think this way, when I think about the pandemic. When I learned about the fact that a dangerous virus was afoot my live expectancy got adjusted a bit downward. Obviously that’s not how I thought about it really. I was just very disturbed. But it certainly felt disappointing in a way. When I learned there will be an effective vaccine my live expectancy adjusted a bit upward again, most of the way really. Getting a vaccine also includes a little risk, so it technically also means a little reduction in live expectancy, but only compared to a hypothetical world of which I already know that I don’t live in it.</p>
<p>So yeah, getting vaccinated or not might feel like a tough choice, but it might get easier if you accept that you have already been disappointed. Don’t hesitate to act just because every option feels bad. Try to accept that you already know there will be some badness, and choose the least bad option.</p>
<p>Like I said in the disclaimer, I don’t think this is easy, and I am not even sure that trying to think this way would be helpful. But it is how I would like to think.</p>
<p>By the way the answers are obvious: You get the chocolate cake, and you get vaccinated!</p>When you are confronted with a tough choice, it might be helpful to accept that you have been disappointed. Disclaimer: This post contains ideas about how one could think. I do not claim that reading this article will help with thinking this way.
https://blog.maralorn.de/post/programing-language-visionMy Vision for the Future of Programing Languages2021-06-20<p>People who know me closer know that I have an obsession with finding the perfect programing language.</p>
<p>This obsession goes through phases: Sometimes I am disillusioned about the state of affairs. Then I hear about a new exiting language and read the whole reference in one night. Then I realize that compromises have to be made and go back to writing Haskell.</p>
<p>Currently I am a little bit in the disillusioned state. Yeah, no programing language is perfect … But to cope with it I thought I could try some cherry-picking and tell you what I hope the future of programing should look like.</p>
<h2 id="the-criteria">The Criteria</h2>
<p>I would like to have a programing language, that is</p>
<ul>
<li>strongly, statically and dependently typed</li>
<li>purely functional</li>
<li>uses immutable, semantic hashed, content-addressed code and dependency management</li>
<li>and has automatic, static memory management.</li>
</ul>
<p>Of course what you also always want from a programing language is a nice community, a rich ecosystem, good tooling and obviously a fast execution, but I won’t be talking about those here …</p>
<h3 id="the-type-system">The Type System</h3>
<p>I think in the last years static, strong typing has increasingly become mainstream. Examples include type annotations for Python, Typescript and Rust. Of course it is not enough to have static types, they also need to be sufficiently expressive. For me that means that you at the very least need Algebraic Data Types.</p>
<p>Still, in this post I am dreaming, and so I would like to have dependent types (with type erasure). I know a lot of people are apprehensive of the “dark type level magic” Haskell offers today. But I am quite convinced that type level programing will get easier and more intuitive once reasoning on the type level works exactly the same as on the term level.</p>
<p>One application for which I personally would like good dependent types support is tracking matrix dimensions at the type level, this is currently possible but tedious in Haskell. But of course there are lots and lots of other use cases for dependent types.</p>
<h3 id="purely-functional">Purely functional</h3>
<p>I wont argue much for this. But in my opinion it is absolutely a must have. Tracking side effects and having referential stability change how you think about a program and enable declarative programing.</p>
<p>I remember, when I first heard about functional programing I was very confused about this and wondered what use a language without side effects can have. But the aim is of course not to avoid any side effects but have an explicitly way of tracking were they happen. Of course you need a type system which can support this.</p>
<h3 id="content-addressed-code-and-dependencies">Content-addressed Code and Dependencies</h3>
<p>This is an exiting one. I have only programmed a few hours in <a href="https://unisonweb.org">Unison</a> but the experience was amazing. You work with a database of functions. Every functions tracks all other functions it uses by hash. When you change a function you create a new one and change the name to point to the new function. Unison records all your changes so that you can later update other code depending on yours by changing the hashes and guiding you through semantically resolving conflicts. This work flow solves so many problems with programing that I especially disliked:</p>
<h4 id="dependency-conflicts">Dependency Conflicts</h4>
<p>As a nixpkgs maintainer I am haunted by the conceptual difficulties of finding a working build plan and packaging it. With content-addressed code and dependency tracking on the level of single functions packaging this is a solved problem. Conflicts will rarely happen and always be resolved by the author of the code, when they decide to update.</p>
<h4 id="text-based-merge-conflicts">Text based merge conflicts</h4>
<p>Git merges can only do so much to help you with creating working code. If version tracking is built into your code database merging will happen on a semantic level.</p>
<h4 id="naming-stuff-and-code-organization">Naming Stuff and Code Organization</h4>
<p>Naming stuff is hard and prone to bike shedding. Deciding in which file which function goes is also hard. Renaming and moving code to other files needs at least very good tooling. (Haskell is not there yet, for example.) And when you have a public API you just can‘t do it. With content addressed code that’s a thing of the past.</p>
<h4 id="import-management">Import Management</h4>
<p>Every Haskell Module starts with a ton of import. You always have to decide if you want to import everything into scope, import qualified or import single functions. With content-addressed code this becomes much less important, much like formating it becomes something the database manager takes care of for you.</p>
<h3 id="automatic-static-memory-management">Automatic static memory management</h3>
<p>Now this one is maybe the most futuristic. One of the reasons Haskell is not suited for very resource constrained scenarios is the fact that it’s garbage collected. On the other hand while I think that Rust is a great language, and one reason for that is its safe static memory management, it is my opinion that for most use cases the developer shouldn‘t be bothered with manual memory management. That’s why I prefer garbage collected languages. In a perfect world the developer should never be bothered with manual memory management, but currently that won‘t fly for quite a few use cases. So why not have our cake and eat it too? There is this promising thesis about <a href="https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-908.pdf">As Static As Possible Memory Management</a> by Raphaël L. Proust. It basically suggest to have the compiler generated a small garbage collector optimized for each individual program via static code analysis. If this approach could actually bring a real benefit in practice is an open research question, but I recommend having a look in there anyways, because it neatly lays out the problem space.</p>
<h2 id="uncertainties">Uncertainties</h2>
<p>Now, there are a lot of properties, which I am unsure about. Should the language be strict or lazy, do we need typeclasses, linear types, what’s the best syntax? And don‘t get me started on the right effect system …</p>
<p>I am pretty sure to have strong guarantees and good runtime performance a compiled language will be desirable, but I am not 100% certain about that. (But using ASAP memory management and talking about type erasure implies a compiled language.)</p>
<h2 id="how-far-away-is-this">How far away is this?</h2>
<p>How could we get there?</p>
<p>Haskell is great and soon it will hopefully have dependent types. The very promising <a href="https://grin-compiler.github.io/">GRIN Compiler Project</a> could bring us closer to better runtime performance and maybe even static memory management. Also it has the potential to bring interopability between functional languages. Maybe Idris, Haskell, Unison and others could share an ecosystem of libraries? That would be great and would maybe make it easier to profit from the dependent types in Idris.</p>
<p>Unison has a beautiful concept with going all in on the content-addressed idea and I really like the syntax, but it’s still very young and I am not sure, that it will move in the direction of dependent types. Still if Unison could oneday be compiled with the GRIN Compiler that would be pretty amazing.</p>
<p>Another project to be aware of is <a href="https://github.com/fragnix/fragnix">fragnix</a> which implements content-addressed code for Haskell, but it is also in a very early stage.</p>
<p>Still all the puzzle pieces are there and I am exited to be there when they will all come together.</p>A description of a fictitious future programing language.