The current implementation is writing out the DB to `/tmp` then reading the resulting file back and writing it to the column.
So on the bright side updating 1k rows takes the same amount of time as updating one row. On the other hand every write is a full table write (actually two).
I don't think there is a way to do this efficently with the current API as PostgreSQL is MVCC so it needs to write out each version separately (unless it has some sort of support of partial string sharing, I don't think so). Maybe a better version of this would write every page of the SQLite DB as a separate row so that you only need to update the changed pages.
I am Russian, and the grandparent comment rings very true to me. To me, personally, it reads less like snark and more like just a pretty existential comment on banality of how dynamics like this seem to have been always so prevalent in Russian culture.
I see it as a self-sustaining stereotype only prevalent in what people tend to read. Who wants to read about a normal life of a normal russian, frankly? It’s likely not a snark, but it is nothing more than just a complex sort of klukva^ either. Subj is a completely non-standard story of a single person from early 20th century. You can find similar hopelessness in London, Hemingway, Le Guin. The prevalent dynamics in Russian culture is that you get education, skip draft, go to work, have kids, buy some things and die from bad healthcare at 60-70. Pretty normal shit that is too boring for a narrow-font-magazine headline.
Personally it doesn’t offend me, but it’s just cringe(?) most of the time. Off, odd, klukva. Nothing rings true to me in this subthread, which is just a pile of stereotypes. I think that these “and american, but american” comments come from the fact that people can and get tired of it but cannot express it clearly.
^ en: cranberry, an absurd stereotype about russians
I see your point but my Russian teacher had taught me exactly the same. She made me watch Skazka Skazok which won many awards (and I loved it btw) and read stories that also had this feeling. I'm happy that today Russia is not the same as before and there is also hope in people's lives, not only sadness. Or so it seems.
"Could you please remind me of historical cases the civil society prevented their rulers waging a war?"
History is a big book, but what I personally witnessed, were the peace demonstrations in France and Germany against the invasion Iraq and in the end we did not take part in that war.
And the Vietnam war was largley stopped because of the civil unrest and demonstrations back at home.
More about democracies, sure, but even dictators have to mind the masses.
Or maybe it was the other way around? Exactly like in Ukraine? Who knows…
If NATO is not against Russia then why Russia is the only “soviet” state that NATO refused to accept? Divide Russia in many equivalent regions: how many of them can join NATO before NATO refuses to let them join? Or is it that only regions that are not under filo-Putin leaders’ control are accepted?
Well instead of applying Russia invaded a sovereign country. So, I guess we won't know will we? Probably something to do with their post soviet inferiority complex.
Please do correct me: the wars in Georgia, Moldova, and Chechnya never happened?
1991–1993 - Georgian Civil War /
1991–1992 - South Ossetian War /
1992–1993 - War in Abkhazia /
1992 - Transnistria War /
1999 - War of Dagestan /
... so conflicts where Russia occupied territory, shouldn't be of concern to any former Soviet states? You don't think played a role in the decision to defend themselves from a neighbour known for their invasions and genocide?
That’s an existential threat to Russia. If Ukraine succesfully made a change more Russian sattelites would get the idea that it’s possible to escape the Russian grip. Second is the power projection on the Black Sea Russia was set to lose.
This is repeated over and over again, but doesn't make it true: it is an existential threat to a corrupt regime, not to Russia.
Russia will be fine without the regime. It may have some rough times, but in the long run, it will be fine. Putin's regime isn't Russia, and Russia isn't Putin's regime.
Just like the propaganda narrative: "Oh Russia tried democracy for a couple of years and it was awful! Democracy doesn't work in Russia!"
Reforming institutions and culture isn't something you do in a few years. Look at the process Ukraine is going through to join the EU. It takes time, and thankfully, we have frameworks for what works nowadays.
What matters is that the EU has the mechanisms, frameworks, controllers, and auditors that monitor this process.
It has worked well for most European countries, with the only exception being Hungary, which, from the looks of it, won't last much longer in the EU.
Joining the EU isn't a theatrical display of a man singing a piece of paper, that has no value, at a big table with all the state-controlled media cameras pointing at him.
But now it's my turn to guess... you're observing Ukraine from the Russian side, and you think you know the process better than the Ukrainian... and the EU... while not living in a democracy or knowing what it takes to make a democracy work properly.
>Why does it matter where I'm observing this from?
Because the processes that are happening in Ukraine has nothing to do with democracy, human rights, religious freedoms, rights for private property, courts independence etc. And yes, I'm well aware that EU propaganda tells beautiful stories of how all of the above prospers in Ukraine, but reality on the ground is total opposite.
>But now it's my turn to guess... you're observing Ukraine from the Russian side, and you think you know the process better than the Ukrainian... and the EU... while not living in a democracy or knowing what it takes to make a democracy work properly.
Man, I have relatives living in Odessa since Soviet times. I have multiple friends in Ukraine that I studied in University with, that are living in Kiev and Kharkov. I've been in Ukraine many times over the 43 years of my life, and while I haven't been there since 2022 for obvious reasons, I have a good clue of how life there looks like if you're actually there, not listening to your local propaganda. What's going on there has nothing to do with democracy or human rights, and it's a pain for me for every day this war keep going.
> Because the processes that are happening in Ukraine has nothing to do with democracy, human rights, religious freedoms, rights for private property, courts independence etc. And yes, I'm well aware that EU propaganda tells beautiful stories of how all of the above prospers in Ukraine, but reality on the ground is total opposite.
And you know this because your... propaganda told you so?
You're accusing me of being gullible for the EU ascension process, which enrolled 27 countries, many of them thriving. But we should believe you because of anecdotes of someone who apparently doesn't know the institutions and functions of a democracy.
Or you're expecting a country that is being annexed in a genocidal war, with Martial Law in place, to be thriving? +10 million Ukrainian refugees.
> I have a good clue of how life there looks like if you're actually there, not listening to your local propaganda.
Of course, you know - and Russia knows what's best for Ukraine - everyone else, including Ukrainians, doesn't know?
Well, more an existential threat to the current regime running the place. I imagine the Russian people would be quite happy to have a regular democracy. Which is one reason Putin isn't very keen on one in Ukraine.
Ukraine never had any glimpse of regular democracy. For 30 years it was just a state when one or the other oligarchical clan was able to install its puppet on the throne to decide who's looting the majority of profits in their pockets.
Right now Zelensky totally usurped power, his political opponents were either killed of forced to flee the country, total mass media control installed, everyone who tried to argue were raided and taken under control or had to flee the country, religion rights are taken away, churches are raided and the right people are getting installed. Borders are crossed and mined, everyone who's trying to flee the country are getting hunted and killed if there's no way to catch them to send in trenches. Russian language, that is the mother tongue for 80% of population and Zelensky himself is forbidden in schools, and any other public services. We have a classic case of nationalists dictatorship being installed and turned the country in the same shit hole that Germany became in the late 1930's with storm troops having population under control by force. That's why Putin isn't very keen on what's going on in Ukraine.
Well, yes, Putin is attemptng to revive the whole shebang and these countries don’t want it any longer. The threat is more countries breaking apart from the sphere of influence and Putin’s plan falling apart completly.
Had there been another plan, make prosperity by other means then yes, this whole thing would not be any threat, they’d have embraced it and played along and won on different fronts: they almost had the entire Europe dependent on gas. But then Mr Putin blew it.
What do you expect when you murder civilians and level cities with artillery? More genius rhetoric. Keep it up!
edit for above edit: A mutual defense alliance is neutral. Don't attack and you won't have to deal with it.
Edit for below edit: Well we're far past that. Ukraine will be joining NATO and there's nothing you can do about it.
Another edit for below: This is what you don't get for your last edit. It simply doesn't matter. The world where Russia can act with impunity with nuclear sabre rattling isn't a world worth living in. I know that makes you so very upset, but you're just going to have to accept it.
And yet again edit: Correct, the state reserves the right to violence.
>What do you expect when you murder civilians and level cities with artillery? More genius rhetoric. Keep it up!
see above
> edit for above edit: A mutual defense alliance is neutral. Don't attack and you won't have to deal with it.
edit cubed: you logic leaks everywhere, don't join NATO and you will not have to deal with it
> Edit for below edit: Well we're far past that. Ukraine will be joining NATO and there's nothing you can do about it.
edit for the edit games: if so, we are past world-end then, and there's nothing you can do about it...
> Another edit for below: This is what you don't get for your last edit. It simply doesn't matter. The world where Russia can act with impunity with nuclear sabre rattling isn't a world worth living in. I know that makes you so very upset, but you're just going to have to accept it.
edit for the last edit: Funny because, USA is the _only_ country that _actually_ used nukes with impunity... twice
> And yet again edit: Correct, the state reserves the right to violence.
I guess that's true for every state in the world...
If you don't want to live in such a world, go ahead, but you can't think everyone will follow you.
> Especially when you can't project your military power a few hundred km over your own border.
Quite a lot of western commentators were just as surprised as Putin to discover that Putin commanded a force that managed to lose its own tanks to local farmers.
The difference is we got out the popcorn, and he got filmed anxiously gripping his own desk for 12 minutes.
Since then Putin has put his country into a war economy, and now it is a war of attrition because Ukraine is given just enough support to not lose but not enough to win either — Biden is both afraid of Russia winning and also of Russia escalating it if they lose too hard.
This war will go on until the west gets tired of supporting Ukraine or decides that escalation is a risk they're willing to take or Russia collapses under the weight of the war economy or Ukraine develops nukes; but I don't mean "the USA" when I say "the west" despite the fact that most current support comes from the USA, as many European countries have been building up their militaries both in reaction to what Putin did and in anticipation of Trump taking the US out of NATO.
I count that under "decides that escalation is a risk they're willing to take". We can all see the claims and threats made by the Russian government, we know they want us to fear their nukes, that's why the US government has been concerned about escalation.
I personally think there's a 75% they can't use any of their nukes and a 92% they can't use a strategically decisive number of nukes.
But I'm doing armchair analysis here, and even if I wasn't those odds are only sufficient for me privately to not worry, they're not enough for a government to not plan for the worst. I'd be more worried if the US was more hawkish and cavalier about this.
Though that's even assuming Putin (etc.) actually tries to use them — as I said, Biden's deliberately not given enough aid for Ukraine to win hard precisely because he doesn't want to risk it.
He's limiting support to enough to not lose, which is different than winning; he doesn't want Russia to keep rolling tanks to the line of the old Iron Curtain either.
"Whataboutism" is when you say "what about them?" not when you say "what about us?"
The Soviet dissident Andrei Sakharov, for example, did not treat every atrocity as identical-he had nothing to say about American atrocities. When he was asked about them, he said, "I don't know anything about them, I don't care about them, what I talk about are Soviet atrocities." And that was right-because those were the ones that he was responsible for, and that he might have been able to influence. It's a very simple ethical point: you are responsible for the predictable consequences of your actions, you're not responsible for the predictable consequences of somebody else's actions.
He could have joined the Soviet protests against American Jim Crow laws like a good little model Soviet citizen, shaming that other empire but instead he bravely stood up to his own.
I think the point OP was making is that a response to “this is a very X attitude to things” does not find a direct response in a follow up which is “this is a very Y attitude to things”, and completely fails to address the X.
>Accusing an interlocutor of whataboutism can also in itself be manipulative and serve the motive of discrediting, as critical talking points can be used selectively and purposefully even as the starting point of the conversation (cf. agenda setting, framing, framing effect, priming, cherry picking). The deviation from them can then be branded as whataboutism.
^^ pay special attention to this bit, it refers directly to us.
It's because the current state propaganda pressures people with constant "they are same bad just hide it better" rhetoric, which itself is copied from Cold War era whataboutism.
My parents and relatives say the phrase "America has all the same..." literally every time anything political comes up, which is a pretty odd thing to say for people who aren't even able to read English-language media, least of all been here, which they admit but the next time say it again anyway. It intensified after 2013-2014 and hasn't been true at all during ~1995-2010.
It clearly comes from Putin's government insecurity about their comparative performance, rather than from any Russian cultural trait.
So if america wouldn't have invaded iraq, russia wouldnt have invaded chechnya and the cause comes before the effect and the excuse for bad behaviour comes before the whataboutism and it all makes way more sense.
Yeah but. Why the USA? If I say "Russia invaded Ukraine", why do I always get the response "but the USA.." and now any one of many other countries that also invade. What is the connection? The USA has nothing to do with this.
No, let me explain to you what is actually going on. What's going on is that Russians have a chip on their should the size of Texas. A deep rooted sentiment of inferiority, that triggers every time you say something bad about their country, which they hate, and respond by attacking the country they admire but can't admit.
Without looking at polls, what do you think is the percentage of the Russian population that answered Yes to the question: if given the chance to move to the USA, would you? If you believe what you're saying, you probably think this is a very small number.
Because 1. It's an easy and the most glaring example of lecturing people to do one thing, but doing the opposite themselves. 2. It was actually the country, that Russia wanted to be like during 80s and 90s, USA was a role model, but turned out to be full of shit. And the waking call happened, when USA bombed and shred to pieces Yugoslavia.
>If I say "Russia invaded Ukraine", why do I always get the response "but the USA.."
Once again, reasons are obvious if you're aware of the history.
1. USA can't lecture anyone about invading or annexing other countries, as USA invades one country after another just in the last few decades, and right now occupies Eastern part of Syria that's full of oil, and publicly brags that it's their oil. BTW, not o hard to notice a recent rhetoric in USA mass media and among politicians, that it's all about Ukraine resources and who gonna get what depending on the outcome of the war.
2. The war in Ukraine is a direct result of USA meddling in their elections in 2004 and 2013-2014, and desire to bring their military bases after the puppet government was installed. Russia was fine with sovereign Ukraine, even with a puppet like Yushchenko we were able to negotiate and live more or less peacefully, but military bases idea, kicking Russia out of Sevastopol is what spiralled this into violence.
>A deep rooted sentiment of inferiority, that triggers every time you say something bad about their country, which they hate, and respond by attacking the country they admire but can't admit.
Russians do have some sentiment on inferiority, and that's why we actually really glad when some respected and knowledgeable foreigner arrives and intend to cooperate, even teach us. For centuries such people were getting really rich working in Russia, even if they were mediocre back in their countries. But you're totally misguided on the attack part. Attack or self defense phase initiated only in the case of demonstratively refusal to make any reasonable compromise and direct hostile actions. Russian history is full of wars, we do not enjoy violence and know very well the cost in lives.
Coming back to Ukraine, it's not so hard to remember, that Putin tried really hard to avoid this war. Crimea was peacefully annexed specifically to block any attempt to bring Ukraine into NATO legally, and secure our interests in the Black Sea, after it was obvious, that newly installed puppets gonna do exactly this (later Ukraine changed their constitution and replaced their intention to be a sovereign and neutral state to be a NATO member). Then Minsk agreements were introduced, for Ukraine government to get in touch with reality, but as we know now, from public admissions, USA, Germany and France intentionally sabotaged these agreements, pushing Ukraine into a military resolution (and at the same time they were introducing more and more sanctions towards Russia, lying that we do not respect our part of the deal). Then, Ukraine finally started to move their heavy equipment to Donbass in the early Autumn of 2021, and Zelensky publicly announced, that he won't respect Minsk agreements (it meant escalation in Donbass). Putin then spent several month in the Winter of 2021-2022 trying to make a deal with USA, to prevent direct war. But USA declared, that they can do whatever they want, build their bases wherever they can etc. So, we got an initial invasion of Feb 2022, when Russian army pushed to Kiev and Putin immediately proposed just another plan of how to stop all this. Ukraine government was ready to sign it, but Boris arrived and told them that they have to fight (also a public knowledge now, with multiple admissions of people involved in the process). It's not so hard to notice, that up to this day, Putin is ready to negotiate and stop this violence, it's Ukraine and the NATO countries behind their back are refusing to. And it's very easy to target USA and Western propaganda in general, that publicly lies up to this day, that "mad Vlad just woke up and invaded a sovereign country without any reason, because he's evil".
>Without looking at polls, what do you think is the percentage of the Russian population that answered Yes to the question: if given the chance to move to the USA, would you? If you believe what you're saying, you probably think this is a very small number.
I don't know if it's a very small number, small number or anything else. What I do know, is that there's still a myth in some countries, that Russia is some country that is behind an Iron Wall, that is hard to escape. Reality is different. Russia is open to the whole world, you can buy a ticket to fly to any country. We have millions of foreign tourists and migrants for decades. Anyone who really wanted to leave Russia did it already, or can do it today, for example. And a lot of people who did, returned already, because they learnt, that what they thought about some countries is not equal to how life there actually is. Reality is, that in the last 20 years Russia made a huge leap in quality of life in every sphere, and for me personally there's no desire to live in any other country, because I like it here.
It's interesting to me how you say "war" here on an English speaking and mostly American website.
But what is the official Russian position on it? Can it be called a war there? It can but with repercussions. Why don't you use the official terms for it or would that not play over so well when trying to drum up support for what this really is. Aggressive Russian expansion.
The "peaceful" annexation of Crimea also came with Russian funding of separatist groups in eastern Ukraine and the shooting down of civilian aircraft. How peaceful is that?
Ive seen RT call it a war. When Russian propaganda calls it an "SMO" it's not because theyre allergic to the word "war" but because they legally didnt declare war.
This is not unusual. The US, for instance, didnt declare war on Iraq when it launched its unprovoked invasion.
>The "peaceful" annexation of Crimea also came with Russian funding of separatist groups in eastern Ukraine and the shooting down of civilian aircraft. How peaceful is that?
Not very, but neither was the Andrey Parubiy led terrorist attack from Hotel Ukraina which kicked off this civil war.
Kiev could have put him in prison for taking a sniper rifle to the top of the hotel and committing mass murder against peaceful protestors but instead he was elected to the Rada.
The Ukrainian war hero Nadia Savchenko who identified him - she is still, ironically, the only person to be convicted and imprisoned in relation to the terrorist attack which kicked off this civil war.
RT is a propaganda organization. They say war because it's intended for an English speaking audience. Notice I haven't said anything about Ukraine being or not being "perfect."
And the US didn't shy away from calling it a war in their media when talking to their own public.
> I encourage you to read this
More whataboutism telling me the US is bad which is supposed to distract me from what Russia is doing.
It's probably illegal or is illegal? Be honest, does the Russian government arrest people for holding a sign that says "No War" or even signs that are blank? Pieces of paper that are blank?
RT using the term war for English speaking audiences is allowed because it is state sanctioned propaganda so you can come here and point to how they say it. Well, they also come here and pay people like Tim Pool to say things too that they won't say in Russia.
>Russian government arrest people for holding a sign that says "No War" or even signs that are blank?
Yep, but coz theyre protesting against the war not coz theyre calling it a war.
It's exactly like that time British police threatened protestors in London with arrest for holding up a blank sign. They were threatened with arrest for the expression of their implied beliefs as well, at precisely a time that the government was feeling overly sensitive.
There are certain specific things that can happen in most countries that really bring out the authoritatian side of the government.
How can you protest something that's not officially happening? It's just an SMO after all. Honestly you and all your bot account friends should just go crawl back into whatever kremlin gutter you came out of.
RT is no more propaganda than CNN or any other Western mainstream media. It's just different people who set the narratives.
>And the US didn't shy away from calling it a war in their media when talking to their own public.
Once again, so called SMO is called war in Russia, just not in official documents and announcements, because juridically it's not a war, at least up to this day.
>But what is the official Russian position on it? Can it be called a war there?
Of course it can and is called war in Russia. You just missing the point: war is a juridical term. Technically neither Russia nor Ukraine are in war with each other. That's why officially it's called "Special Military Operation", and in Ukraine it was for years "Antiterrorists Operation", and recently rebranded as "armed aggression of Russian Federation against Ukraine sovereignty".
>The "peaceful" annexation of Crimea also came with Russian funding of separatist groups in eastern Ukraine and the shooting down of civilian aircraft. How peaceful is that?
Your should learn some history and geography. Crimea is a peninsula in Black Sea, majority of population are ethnic Russians. Russian special forces entered Crimea after the coup in Kiev, and peacefully blocked Ukrainian military there and let referendum happen, so it was annexed. Most of Ukrainian soldiers stayed in Crimea and were from Crimea, got Russian citizenship just like all the other population. Those who refused were peacefully allowed to return to Ukrainian territory.
Donbas is an Eastern region of Ukraine. First of all, how coup in Kiev happened? Ukrainian nationalists, driven by the idea of Ukraine dropping sovereignty and joining EU and NATO, attacked multiple military and police headquarters, got armed, entered Kiev, and after several weeks of riots in the capital that ended with mass shooting there, managed to force elected President of Ukraine and his government to flee. If you're unaware, this president was installed mostly by people in the Eastern Ukraine, opposing to previous one, that was voted in by Western part of Ukraine. So, basically, Western oligarchs (Ukraine during its 30+ years of independence was ruled by several oligarch clans originating from either Western (agricultural) or Eastern (industrial) part of Ukraine), their nationalists backed by USA embassy and Viki Nuland herself seized power in Ukraine. So Donbas with some help from remaining Eastern oligarchs started the uprising in Donetsk and Lughansk, and declared, that they want their rights for their language, religion etc be preserved (Most of Eastern Ukraine population are ethnic Russians and basically was part of Russia until 1922 or so, when Lenin gifted this territory and people to Ukrainian SSR). These people also started to raid police and military bases, got armed. So, coup government in Ukraine, instead of talking to these people, announced "antiterrorists operation" and moved army to get Donbass under control, and they started from bombing Lughansk. That's basically how it turned to war.
As to civilian plane, it was shot down many weeks after direct confrontation started, and it's up to this day very arguable who actually shot it down, as the court in Netherlands turned this case into the same farce as investigation of Nord Stream sabotage, where they were using only facts that suits their version, and ignored everything, that didn't fit the picture.
I'm not missing the point at all and I know the difference between Crimea and other parts of Ukraine.
So let me make sure I understand your story perfectly. Russia was so concerned about Ukrainian sovereignty that they sent their military into Crimea. And instead of allowing Crimea to exist as a sovereign state with what Russia viewed as the rightful president/government of Ukraine... it instead annexed it and said this is Russia now?
Quite interesting. It's almost as if Russia didn't care about the "integrity" of the elections and just wanted more land for itself.
>So let me make sure I understand your story perfectly. Russia was so concerned about Ukrainian sovereignty that they sent their military into Crimea.
Not really. Russian military was already in Crimea. If you're unaware, Sevastopol is a major Russian fleet base since 18th century, and both marines and regular soldiers were stationed there based on signed agreement with Ukraine government.
>And instead of allowing Crimea to exist as a sovereign state with what Russia viewed as the rightful president/government of Ukraine... it instead annexed it and said this is Russia now?
Those people, who Nuland and K installed as government of Ukraine after the coup were declaring as their political goal to kick Russia out of Crimea, broke the 50 years long deal and turn Sevastopol to a NATO fleet base. So yes, as soon as they were installed and declared by the West as the legitimate government of Ukraine, Putin annexed Crimea, to create a territorial dispute, that will not allow NATO to legally accept Ukraine.
>Quite interesting. It's almost as if Russia didn't care about the "integrity" of the elections and just wanted more land for itself.
Another interesting fact to you: Crimea was an Autonomous Republic, and it actually tried to separate from Ukraine in the 90's to rejoin Russia by referendum, but Kiev government sent troops there and rewrote Crimean constitution to prevent any separation.
They had a lease at, and were restricted to a specific military base there.
They were definitely not "in the Crimea", in terms of the peninsula at large, as you are perfectly aware. To suggest, in response to someone pointing out the 2014 invasion, that it's "not really" an invasion because they were "already in the Crimea" -- is just weird semantic head games.
Let's imagine a thought experiment. Imagine you tell an american "the USA did X", what's he gonna respond. I know what he won't, he won't say "but Russia...". That's because Russia is a culturally irrelevant country.
I take your comment was meant to be funny, but pink is one of the easiest colors to obtain from natural ingredients. Beetroots, strawberries, chochineal, cherries, radish, raspberries, pomegranate, guava, peppers, tomatoes, watermelon, cranberries, blood oranges, blood, shrimp…
Even more unfriendly-yet-typical line is where you create an allocator, and few lines further you run allocator() method on it, to get ...an allocator (but you had it already! Or maybe you didn't ?) Same: you create Writer, but then you run a writer() method on it.
Here is the code to illustrate:
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
var visited = std.BufSet.init(arena.allocator());
var bw = std.io.bufferedWriter(std.io.getStdOut().writer());
const stdout = bw.writer();
So.. what are the entities we use, conceptually? "allocatorButNotReally" and "thisTimeReallyAnAllocatorIPromise"? Same for the writer?
Plus, the documentation isn't much explaining wtf is this and why.
The answer is probably buried somewhere in forums history, blogs and IRC logs, because there must have been consensus established why is it ok to write code like that. But, the lack of clear explanation is not helping with casual contact with the language. It's rather all-or-nothing - either you spend a lot of time daily in tracking all the media about the ecosystem, or you just don't get the basics. Not good IMO. (and yes I like a lot about the language).
std.mem.Allocator is the allocator interface. For that struct to be considered an interface, it must not contain directly any specific concrete implementation as it needs to be "bound" to different implementations (GenealPurposeAllocator, ArenaAllocator, ...), which is done via pointers. An allocator implementation holds state and implements alloc, free and resize for its specific internal mechanisms, and then pointers to all these things are set into an instance of std.mem.Allocator when you call the `.allocator()` function on an instance of an allocator.
File and Socket both offer a `.writer()` function to create a writer interface bound to a specific concrete "writeable stream".
BufferedWriter has both extra state (the buffer) and extra functions (flush) that must be part of a concrete implementation separate from the writer interface.
> The answer is probably buried somewhere in forums history
That's just how computers work, languages that don't expose these details do the same exact thing, they just hide it from you.
Well, your explanation doesn't really tell why do I call .deinit() on a structure before alllocator() call and calling all the rest important stuff on a structure after such call. I think you guys, while doing great job by the way, are kind of stuck in a thinking from inside language creators' perspective. From outside, certain things look so weird.
I need also to be a picky about "that's just how computers work" phrase, you know uttering such a phrase has always a danger of bumping into someone who wrote assembly before you were even born and hearing this makes a good laugh..
> Well, your explanation doesn't really tell why do I call .deinit() on a structure before alllocator() call and calling all the rest important stuff on a structure after such call.
That's because the Allocator interface doesn't define that an allocator must be deinitable (see in the link above the fn pointers held by the vtable field). So just like you have to call flush() on a BufferedWriter implementation (because the Writer interface doesn't define that writers must be flushable), you have to call deinit on the implementation and not through the interface.
Fun fact, not all allocators are deinitable. For example std.heap.c_allocator is an interface to libc's malloc, and that allocator, while usable from Zig, doesn't have a concept of deiniting. Similarly, std.heap.page_allocator (mmap /virtualalloc) doesn't have any deinit because it's stateless (i.e. the kernel holds the state).
I don't know about the deinit thing, but I think this allocator/writer stuff has nothing to do with "inside language creators' perspective". To me, even though it wouldn't be my first guess as someone who's never used Zig, it does make sense to me that it's done this way since apparently Zig does not really have interfaces or traits of any kind for structs to just have. In fact when Googling about Zig interfaces I found another post from the same blog:
which says that an interface is essentially just a struct that contains pointers to methods. In other words when you call the .thing() method on your SpecificThing, that method is producing a Thing that knows how to operate on the SpecificThing, because functions that accept Things don't know about SpecificThings. You can't manufacture that Thing without first having a SpecificThing, and a SpecificThing can't be directly used as that Thing because it's not. There's essentially no other way to do this in Zig.
> why do I call .deinit() on a structure before alllocator() call
This is explained right in the documentation about arena allocator. Arena allocator deallocate everything at once when it goes out of scope (with defer deinit()). You need to call .allocator() to get an Allocator struct because it's a pattern in Zig to swap out the allocator. And with this, other code can call alloc and free with out caring about the implementation.
This is just how arena allocator works and not related to Zig's design. You may take issue with how Zig doesn't have built-in interface and having to resort to this implementation struct returning the interface struct pattern, but I think the GP clearly explained the Why.
The zig allocators used to use this because it enabled allocator interfaces without type erasure, but it was found to have a minor but real performance penalty as it is impossible for any compiler to optimize for this in scenarios that are useful for allocators.
Other interfaces might actually have the opposite performance preference
If you control every implementation (ie you aren’t writing a library where others will implement your interfaces), then tagged unions are a simple way to accomplish this. See the bottom of this page: https://www.openmymind.net/Zig-Interfaces/
IMHO the Zig stdlib (including the build system) by far isn't as elegantly designed as the language. There's more trial-and-error and adhoc-solutions going on in the stdlib and there are also obvious gaps and inconsistencies where the stdlib still tries to find its "style".
I think that can be expected of a pre-1.0 language ecosystem though. Currently it's more important to get the language right first and then worry about cleaning up the stdlib APIs.
All languages have these problems. Even Go with famously excellent std has many rough spots that either were not available (such as context) or was just a bit poorly designed.
The most important job of std is not (contrary to popular belief) to provide a “bag of useful high quality things” but rather providing interfaces and types that 3p packages can use without coordinating with each other. I’d argue that http.Handler, io.Reader/Writer/Closer are providing the most value and they are just single method signatures.
When there’s universal agreement of what shape different common “things” have, it unlocks interop which just turbo charges the whole ecosystem. Some of those are language, but a lot more is std and that’s why I always rant about people over focusing on languages.
This is a naming convention problem. In a certain other language that zig is trying hard to not become one of those things would be called an AllocatorFactory.
Sci-fi is useful that way, extending a platform of base familiarity upon which the readers may then more quickly comprehend new advances and novel events. Love the stuff
Btw, $MAIN-CLASS is a terrible name to be used in the examples, its idea was to resemble shell variables I guess, but they can't have minus sign inside.
Few paragraphs below there is another example of multi-word token and this time done properly with underscores.
This is bad, because readers might get the wrong impression that such syntax can be used for real variables. Also there's a chance for this article to be an input for various llms, thus increasing the confusion in the future.
LLM output will be used at places beyond your control and then information coming from it will be placed as legitimate, because people generally don't care about the outcomes of their actions. So talking about which individual deserves what is IMO misleading; we, as society, don't deserve such sh*t in general.
That's intentional. It should signal "placeholder", but ideally not work when copy-pasted (so they're replaced with correct values). Bonus points for confusing LLMs.
Some commits are by `nicholascc` (https://github.com/nicholascc); via Twitter, he seems to be Nicholas Charette. Nicholas is a first year student at Stanford. For such a young group, this is a really impressive effort!
Main and often repeated argument against Electron is that it has a browser embedded inside, and that's why it's so bloated, slow and taking up so much memory.
Yet you give counterexample of using... a browser as a client/frontend to vscode.
Well it doesn't remove the exact main problem with Electron, does it?
what makes you think that current direction of AI development would lead to making less mistakes than humans do, as opposed to repeating same miskates plus hallucinating more?
How long does it take to update a table of, say, 1k rows? 1m rows? Same when subqueries and joins are involved to calculate what's to be updated?