Game Awards? More like

Dec. 12th, 2025 12:22 pm
dorchadas: (Autumn Leaves Tunnel)
[personal profile] dorchadas
Clair Obscure - Festival Expedition

My gift to the rustdoc team

Dec. 13th, 2025 10:00 am
[syndicated profile] fasterthanlime_feed

Posted by Amos Wenger

About two weeks ago I entered a discussion with the docs.rs team about, basically, why we have to look at this:

My browser showing a docs.rs page for a crate that I published myself, which contains a lot of different code blocks with different languages but they're all white on black. It's sad.

When we could be looking at this:

My browser showing a docs.rs page for a crate that I published myself, which contains a lot of different code blocks with different languages. this time it's colored.

And of course, as always, there are reasons why things are the way they are. In an effort to understand those reasons, I opened a GitHub issue which resulted in a short but productive discussion.

I walked away discouraged, and then decided to, reasons be damned, attack this problem from three different angles.

[syndicated profile] acoup_feed

Posted by Bret Devereaux

This is the second half of the third part of our four-part series (I, II, IIIa) discussing the debates surrounding ancient Greek hoplites and the formation in which they (mostly?) fought, the phalanx. Last week, we discussed the development of hoplite warfare through the Archaic period (c. 750-480). Our evidence for that early period of development is very limited, but what we have points to an emerging shield wall formation which neither resembles the rigid shoving-matches of the orthodox school on hoplites, nor the fluid skirmishing of the ‘strong’ heterodox vision. Instead, it seems likely that hoplite equipment developed for a shield wall that already existed, which worked to a significant degree in conjunction with skirmishers and cavalry, acting as a ‘base’ as well as an offensive striking force.

This week we’re going to move into the better attested Classical period (480-323), where we begin to get literary sources describing Greek warfare in some detail. What I want to accomplish here is basically two-fold: first to address the definition question of what a phalanx is and then second to outline in a broad way how it seems to have worked in this better-documented period.

As always, if you like what you are reading, please share it as I rely on word-of-mouth to find readers! And if you really like it, you can support this project over at Patreon; I don’t promise not to use the money to buy a full hoplite panoply, but I also don’t not promise to do that. And if you want updates whenever a new post appears, you can click below for email updates or follow me on Twitter and Bluesky for updates when posts go live and my general musings; I have largely shifted over to Bluesky (I maintain some de minimis presence on Twitter), given that it has become a much better place for historical discussion than Twitter.

Battle Definitions and Definitional Battles

Followers of this debate will note a major chronological question left unanswered in the previous section which is often given quite a lot of definitional import: when are the non-hoplites excluded from the shield wall? That question in turn takes up new significance because of the definitional fight over what a ‘phalanx’ is and thus when it developed. Generally, both the orthodox and heterodox scholars accept that a definitional component of the ‘phalanx’ in its mature form is that it excludes light infantry and cavalry, being an all-hoplite formation.

For the ‘strong’ orthodox school, the answer to this question is easy: their developmental model essentially requires that light infantry were never much integrated into the phalanx and swiftly excluded. From this perspective, the achievements of light infantry at Sphacteria/Pylos (425) and cavalry at Delium (424) and during the Sicilian Expedition (415-413) all in Thucydides, represent the early beginnings of a tactical revolution away from pure hoplite fighting. In this model, ‘the phalanx’ – defined by a fairly rigid adherence to the orthodox tactical model (very tight files (c. 45-60cm file widths), charge to collision, shoving othismos, standard depth of 8, exclusion of light infantry and cavalry) exists and is the standard method of war for Greek polis societies no later than 640 with the Chigi Vase.

By contrast the heterodox school favors much more gradual development, with light infantry still fighting in the same formation as the hoplites very late, often well into the fifth century.1 Since the segregation of light infantry and cavalry from the hoplites is taken as a definitional element of the phalanx, that in turn pushes back the development of the thing called ‘the phalanx’ into the fifth century, with a mature phalanx that excludes all other kinds of soldiers only emerging potentially in the mid-fifth century. It is worth noting this sort of definitional vision is somewhat reliant on the vision of light infantry being basically scattered within the formation (thus rendering the whole thing something more of a loose skirmish line), but as we’ve already discussed, I don’t think that was likely to have been the case even in the seventh century, much less the late sixth.

Instead I think this date-of-the-phalanx debate suffers from an excessively rigid definition. That rigid definition is, I should note, by no means required by the ancient sources themselves. While we tend to use ‘phalanx’ to mean only two specific Greek heavy infantry formations (the hoplite phalanx and the sarisa phalanx), the ancient Greeks were happy to use the word of almost any regular formation of combatants. As we’ve noted, the term gets used for hoplites, sure and also sarisa-carrying phalangites, but also Roman legions, ‘barbarian’ infantry (including Gauls), formations of ships, chariots, and even elephants. In ancient Greek, φάλαγξ just means any battle line or array, similarly flexible to its Latin equivalent acies. It has, I’d argue, an implication of some kind of regular order – it is a battle line, not a mob or a mass – but beyond that it isn’t some kind of technical term.

Now of course we often use a generic word in another language as a technical term to indicate that specific culture’s version of that concept, especially in military contexts. German Messer just means ‘knife,’ but in English it has come to mean a specific family of German swords (sometimes more precisely Großes Messer or Langes Messer or – for two-handed versions – Kriegsmesser) defined by a knife-style hilt construction. Likewise in English katana, a generic Japanese word for ‘sword,’2 means generally ‘Japanese sword’ and very specifically the uchigatana. And of course the Roman word gladius (itself a loanword from a Celtic language) simply means ‘sword,’ but in English is used to mean specifically a family of Roman swords descending from the gladius Hispaniensis. So we do this all the time, taking a general term in a given language and making it a technical term in our language, usually a technical term for the other language’s culture’s version of the general idea.

From that framework, I would argue that the current definitions of ‘phalanx’ in use in these debates – demanding often very tight formations, the complete exclusion of light troops and a rigid tactical system (more rigid, probably, than most phalanxes actually were) – is excessively specific and overly inflexible. Instead we ought to think of ‘phalanx’ as closer to ‘a shield wall with ancient Greek characteristics. That fits better the way we use the terms: ‘phalanx’ is the general Greek word for battle-order and so it can describe in English the distinctively Greek battle order. Such a definition would not be infinitely plastic: it has to be an at least somewhat regular battle order, but as we saw last time, I think the Greeks had a somewhat regular battle order for their hoplites from at least the mid-seventh century. Say what you will about the impression of formation depth on the Chigi Vase, the intention of the artist is clearly to show a regular battle order, with figures all neatly the same distance apart and close enough to be shown overlapping. Consequently, this broader definition largely obviates efforts to back-date the phalanx to the fifth century, because it does not require the full exclusion of light infantry in all cases altogether.3

That said, I think there is (as we’ll see below) a meaningful difference between the earlier hoplite phalanx, which seems to operate much more tightly integrated with its light infantry and the later hoplite phalanx which increasingly excludes those troops. Paul Bardunias distinguishes, in terms of his tactical models, between an Archaic Phalanx that is something of a hybrid – shield wall in front, skirmishers behind – and a Classical Phalanx that is ‘all hoplite’ and a more exclusively shock formation and as we’ve discussed previously, while I suspect there are most places for the skirmishers ‘to go’ in the battle order (I suspect Paul suspects this too), those models seem to me to make the most sense.

What I would propose then is a three-part division: first, a proto-phalanx (or Archaic phalanx), in which skirmishers can be present but where the core of the formation is pretty clearly a shield wall of hoplites, which is clearly in use in the seventh and sixth century. Next, there is a hoplite phalanx (short for ‘all-hoplite-phalanx’ or also ‘Classical Phalanx’), which is the formation that seems to be in use for most of the fifth century, in which light infantry have been fully segregated out into other battlefield roles (discussed below). There is clearly a process of transition involved between these two forms happening around the turn of the sixth century into the fifth which we can see only imperfectly. Arguments about that transition are fundamentally going to turn around interpretations of Herodotus – and in particular how much of Herodotus one is willing to gainsay or discard. For my own part, I think Herodotus clearly intends us to understand an all-hoplite-phalanx at Marathon (490) (but, interestingly, not at Plataea (479), where he attests lots of light infantry – it makes sense a transitional period might involve different poleis operating at different points in the transition) and I find efforts to gainsay Herodotus writing within or just beyond living memory4 of the events with Pausanias,5 writing six centuries later pretty unconvincing. Personally, I suspect, given the presence of Greek artwork – again, as early as the Chigi Vase in c. 640 – of images depicting solid, uniform lines of hoplites in close formation that the ‘all-hoplite-phalanx’ probably co-existed with the proto-phalanx for quite a while during the Archaic and that both approaches were available on the ‘tactical menu’ by the Greco-Persian Wars.

Finally, there is the sarisa-phalanx, the third sort, which we need not dwell on here except for me to note that it is a clear extrapolation out of the all-hoplite-phalanx (as an all-phalangite-phalanx, in effect, albeit with supporting light infantry on its flanks and possibly operating in the intervals between its regiments), which I feel is necessary to justify calling the Archaic phalanx a ‘proto-‘ phalanx, since means that this military system is going to spend several centuries iterating on the idea of an all-heavy-infantry ‘phalanx’ block.

In my view, this sort of schema lets us understand – as I think we ought – not a question of ‘when the phalanx’ (which we now answer with ‘no later than the mid-seventh century and probably earlier’), but rather tracking changes within the concept of the phalanx, from a proto-phalanx that may put all of the hoplites together (perhaps in the front several ranks, or in a block at the center of the army), but is still expecting to be fairly tightly integrated with non-hoplites, to the all-hoplite -phalanx that has fully segregated those troops.

With that in mind, we can now turn to the question how did the all-hoplite-phalanx function?

Spacing and Depth

We’ll start with how I think our evidence suggests that the phalanx formation functioned itself – individual spacing, the nature of its charge, the style of its engagement and so on – and then we’ll move towards larger picture questions of the organization of whole battles or campaigns.

As you may have noticed, the orthodox and heterodox ‘schools’ do not necessarily agree on spacing. Traditionally, the orthodox vision – and this has tended to inform a lot of modern artistic reconstructions – often assumed something close to shoulder-to-shoulder spacing, which would come out to a file width of about 45cm. We’ve discussed the concept of file width before – file width can be a tricky concept because there are several ways of measuring it – but what we’re measuring when we say file width here is the distance from one man’s left shoulder to the left shoulder of the right man, so a space that contains one body and one interval of open air.6 When considering the question more carefully, orthodox scholars often resorted to Polybius’ report (18.29) of the (sarisa)-phalanx’s spacing which comes out to about 90cm, though as we’ve discussed before this figure is also not without its debates which are wound around questions of the length of the sarisa since Polybius does all of his math for the sarisa-phalanx in units of two cubits. The problem there is there’s no real reason to suppose the sarisa-phalanx must use the same combat spacing as the hoplite phalanx: after all, the sarisa-phalanx is using a different weapon (a two-handed pike) and a smaller (c. 80cm) shield.

Hans van Wees, meanwhile, in Myths and Realities, suggests a much looser spacing, with six foot intervals (c. 180cm) and expresses skepticism that even at this wide spacing was the vulnerability of any man’s right side (the one without the shield) a real problem in that way that, I must stress, Thucydides explicitly says it is (Thuc. 5.71).7 My sense is that many heterodox scholars have backed off of this sort of wide spacing as being typical (though of course there might be circumstances where you’d want it), but since Myths and Realities hasn’t been revised or superseded as the monograph treatment of the heterodox model, that wide spacing remains ‘in the air’ for students and enthusiasts alike.

Of course the challenge here is that, as you may be picking up from the above, no source explicitly attests the file intervals for the hoplite phalanx. We do get such attestations for Macedonian and Roman armies (from Polybius, above), but not for Greek hoplites.

I think there are two ways of attacking this problem. The first is to think about how a formation comes together and the latter is to think about how it most optimally fights and in both cases I am not breaking new ground here, but following others (Peter Connolly in the first case, Paul Bardunias in the latter). In the first case, Peter Connolly observed quite rightly that armies do not line up men with rulers.8 Instead they are going to use some easy measurements available to them in their context to quickly get men at more or less the right intervals. Connolly uses that to explain what Polybius is doing: while the cubit, a unit of length measurement, varied a bit from one place to the next in its ‘official’ length, it always had as its common sense the length of an adult man’s forearm. So when Polybius says men line up with a file width of ‘two cubits’ what he means is they line up with a file width of ‘roughly one full arm-length.’

And that’s easy to pull off in practice: you are marching in column into position (your marching width will be your file depth in a second), you have every man put out his arm to touch the back of the man in front of him. Then everyone pivots 90 degrees to the left and there you are: each man has basically one forearm (plus a handful of centimeters for the back-to-chest space) of space, giving you a roughly two-cubit, 90cm spacing. As Michael Taylor9 has pointed out, if you are the Romans and want slightly wider spacing, you simply have the men pivot first and then do the arm trick second, so that the file interval instead of being one arm-length is now one arm-length plus shoulder width (which comes out to roughly 135cm).

A reminder of the easy and standard way to form from Column into Line, which uses marching width as file depth. I suspect for the 8-deep ‘standard’ (see below), the marching width was probably half-files (4 men wide).

Given that method of accomplishing regular intervals, you can see that you aren’t going to have an infinite number of interval choices, but a handful based on the size of things you have to line up with. Half an arm’s length (one cubit) is clearly doable, as is a super-wide full-arm-length-plus-full-arm-length-plus-shoulder-width (five cubits, 225cm). Alternately you could use objects – lining up spear-length (c. 2.5m) apart, for instance. Or, of course, you could use the aspis, lining up, say, an aspis width apart. Which is 90cm. And you see, perhaps where I am going with this.

We have an easy interval to create and a shield that is exactly as wide as that interval. This seems intentional.

From there we can hop over to the second approach which is to instead look at combat dynamics, do some group sparring and ask how formations at the different widths fare. After all, the one thing we can be reasonable sure about the hoplite phalanx is that it worked. The Greeks were remarkably militarily successful in the Late Archaic and Classical periods, establishing and defending colonial settlements all over the Mediterranean and holding off the local Big Damn Empire, the Achaemenids.10 Paul Bardunias has done exactly and presented the work in this video I am just going to keep linking because I think it is very good and it turns out that to a point, tighter combat spacing (60-90cm in Bardunias’ experiments) is really beneficial because it is really hard to defend with an aspis effectively if you are opposed by multiple enemies due to their tighter spacing.

Of course there are limits. Even turning one’s body to the side, it is really hard to get any tighter than 45cm – any tighter than 90cm, of course and you have to angle and overlap shields – and really anything below 60cm or so seems solidly ‘unfightable.’ I’m struck here that the Greeks sometimes reference a formation synaspismos (‘shields together’) which seems to be a special, ultra-tight formation (though references are few and separated by a lot of chronology, so this term may have shifting meanings). As we discussed before, I suspect this is a special ‘ultra-tight’ formation, probably to resist ranged attack, similar to Roman close-order formations: you don’t fight this way, you close up to get through (ranged) ‘fire’ and then widen out again to fight. This would be easy to do because your ultra-tight interval is neatly half of your regular interval: you just have the back half of each file move up into the gap (though a formation might also just cluster together under pressure more organically).

We can then take this thinking back to our best evidence, which is the representation evidence. From the 640s onward, when hoplites are represented in formation groups, they are generally presented in a line, with regular spacing and shields touching or overlapping, much as on the Chigi Vase.11 Now, if we’re familiar with other cultures’ artwork of massed infantry formations, we know to be immediately skeptical here: artists often compress infantry in artwork to make them look more impressive or simply fit them in the space. We see medieval and even Roman infantry so compressed all the time, so we can’t take this depiction literally and try to measure spacing from it. But what we can assume, I’d argue, is that the assumption here – at least the ideal – is a formation with regular spacing and relatively tight spacing. These fellows are near each other, if maybe not so close as depicted.

None of that evidence is as strong as we’d like, it’s all, in a sense, ‘circumstantial.’ But it all points the same way: the combat testing and the forming up process both seem to suggest something like a 90cm interval,12 which in turn brings the idea that the Macedonian phalanx inherited the spacing of its predecessor hoplite phalanx back with a little more foundation, and that spacing is consistent with the artwork, especially when we consider the strong tendency in many artistic cultures to cram close-order infantry together. And then of course there is the aspis itself, which at roughly 90cm intervals would have their rims just touching, thus presenting a solid line of protection when drawn close.

Although I should note here, I don’t think they always were drawn close – you absolutely can extend an aspis out in front of you (albeit not as far as a center-grip shield) and I suspect this was often done in fighting, I imagine it was probably the standard stance when fighting out of formation and in the ultra-tight synaspismos formation, some degree of angling the shield forward would simply be mandatory.

The other question about the formation is depth: how many men deep was it? We simply have no basis to estimate the distances front-to-back of the men (though further extrapolation from Polybius might suggest 90cm as reasonable, but the evidence here is paper thin), but how many men in a file we are sometimes told. The orthodox school says the standard depth is 8, whereas heterodox scholars sometimes doubt a standard depth at all (amateur warriors, after all). Roel Konijnendijk put all of the figures together to argue that there is no rigidly standard depth and I suppose I take his argument halfway.13 He is correct that depth varies. On the other hand, of his 20 examples, eight have a depth of 8, two more a depth of 16 and two more a depth of 4. The remainders are 1, 2, 9-10, <10, <12, 25, and >50 (2x). But we’re also looking at a simple majority of examples (13/20) are clean multiples of four, which to me really suggests that the most common half-file (perhaps a standard marching width) was four, with armies sometimes forming up half-file to stretch the line or double-file to narrow it. The classic eight-deep formation is four times more common than any other choice, which really does suggest it was ‘standard,’ especially keeping in mind that we’re more likely to be told a formation’s depth when it is unusual (that is, our authors are going to report every 50-man-deep column, but not every 8-man-deep standard formation).

So it seems fair to say ‘standard depth may have varied, but 8 was by far the most common.’

We also have to discuss various attested ‘ultra-deep’ formations and their purposes. The orthodox view on this often recalls Napoleon’s attacking columns with the idea being that a deep formation provides impetus to an attack which of course fits with the ‘shoving’ model, the idea being that a deep formation has more men shoving. The problem with this, as Roel Konijnendijk notes (op. cit., 134) is that no classical source explicitly says this (as opposed to Hellenistic sources talking about the sarisa-phalanx, which do; e.g. Polyb. 2.69.8-9, 18.30.4-11; Asclepiodotus, 5.2); instead he argues – drawing on the work of previous scholars – the most likely purpose here is reinforcing a key point in the line and adding a psychological pressure: reaffirming the cohesion of the men in front of them while demoralizing the enemy with their seemingly unstoppable numbers.14 And here I think Konijnendijk is clearly correct. After all, thinking back to the analogy of gunpowder attack columns, Napoleon’s Imperial Guard were not physically pushing each other on to Austrian bayonets either, but a deep formation is naturally intimidating.15

Then we also have various attested ‘ultra-deep’ formations, which have always recalled for historians Napoleon’s attacking columns, the idea being the deep formation provides impetus to an attack, but such formations are treated as unusual, innovative or compelled by terrain (though, as Konijnendijk notes (134), no classical source explicitly says this so some caution is required). Konijnendijk supposes rather than adding momentum or impetus to an attack, depth was a way to improve cohesion and avoid collapse: an ultra deep formation was harder to break and I think that is probably right.

So there is roughly our formation: probably eight(-ish) men deep, and as many men wide as you can make it, with each file occupying probably around 90cm of space or so.

There are, within that force, unit divisions, though in most cases these tend to be big and pretty unwieldy. Xenophon advocates strongly (Xen. Lac. 11) for the Spartan system of officers and Konijnendijk assumes this means that other poleis lacked equivalent systems, although we do hear of lochagoi and taxiarchoi.16 Assessing those is tricky: when Xenophon details the Spartan system, a lochos is a unit of 640, but in the Macedonian system, a lochagos is the leader of a file-unit of 16; clearly the term has drifted somewhat. Plato also briefly implies wealthy men might τριττυαρχοῦσιν, “they might command a trittyes” (a ‘third’), suggesting a trittyarchos (Plato, Rep. 5.475a-b), which implies an officer perhaps for the trittyes, which would have been roughly one-thirtieth of the army, which might have not been too far off from a half of a lochos.17 I might not be as strong as Konijnendijk in asserting there are no subordinate figures here, but it certainly does seem to be the case that hoplite armies tended to have large unit divisions and relatively limited officers to provide for command and control, which is going to play into their tactical function here in a moment.

Battle Tactics

Now we can start thinking about a how a hoplite phalanx of the classical period functions in a larger battle.

And here I want to contrast three positions, a ‘strong’ orthodox position (which I think is wrong), the heterodox position (which I think overcorrects) and a ‘weak’ orthodox position that I think is closer to accurate. If you recall the historiography from our first part, you may imagine how we got here: seeking to understand how hoplite warfare generally worked, those first ‘Prussians’ created a generalizing model, a sense of what was ‘typical,’ which subsequently hardened into a set of ‘rules’ that the ‘strong’ orthodox position assumes were always followed. And then the heterodox scholars respond with every exception to those rules – Konijnendijk (2018) very ably catalogs essentially all of them – to argue that there was no rule.

So the ‘strong’ orthodox position is that battles were often ‘by mutual consent’ (a Polybian expression), with armies lining up in relatively open and flat ground, with the position of honor on the far right, with the general on the right, where they then charged to impact, after which ensued the ‘shoving’ othismos we have already dismissed; after one side collapsed, pursuit was limited because these battles were to some degree ‘agonal’ (honor competitions) and so the matter was concluded by the victors setting up a trophy and allowing the defeated to recover their dead as part of a truce. By contrast the ‘strong’ heterodox position challenges all of these ‘rules’ as being regularly broken: war wasn’t ritualized, but absolute and intended to produce maximum slaughter. Terrain was used, as was trickery or any other tactical devices. Charge was not to impact but to ‘spear’s reach,’ there is no shoving match and pursuit might be a lot less limited and a lot more focused on casualties. To this end they pile up all of the exceptions to the rule.

Whereas to me, the truth of the matter is somewhere around where we started, rather than where we ended up: there were expectations for certain kinds of battles, which were sometimes violated, but very often followed. There is actually a really useful discussion of this relationship between the ‘reality of war’ and the ‘discourse on war’ cross culturally in John A. Lynn, “Discourse, Reality and the Culture of Combat” IHR 27.3 (2005), which I assign to students. Of course generals and soldiers are always ‘breaking’ the ‘rules’ (really, defying expectations) to try to win but that doesn’t mean the expectations have no force. Instead, the discourse on war shapes the reality of warfare to a degree, however when the two diverge – when the ‘exceptions’ begin to swallow the rules – the loop alters in one of a few ways. First, violation of the ‘discourse’ can create an ‘extreme reality,’ an escalation spiral of brutality, which is almost explicitly what Thucydides presents himself as describing in the Peloponnesian War, a series of ruptures with his discourse (which leaves aside the question of how old that discourse is – it need not be very old!).

Via Wikimedia Commons, a combat scene on a lidded amphora (c. 540). The figures here are represented as hoplites, but they are intended to be heroes from the Trojan War fighting (they are labeled on the amphora), which makes it tricky to try to tease out formation fighting from what they are doing, since they are heroic figures fighting in individually heroic fashion, even if they are presented in the equipment of the sixth century.
That said, I have sometimes thought these scenes, if we imagine them as a kind of surrealistic composite, might not give a bad impression of the utter chaos and brutality that would have existed between to fighting lines of hoplites as they fought with essentially everything – victory, defeat, survival, death – happening all around all at once.

Alternately, breaks in discourse can be compartmentalized by a given kind of violence being segmented away from ‘war’ or ‘proper war.’ We see this all the time today with ‘military operations other than war.’ In history this often happened with counter-insurgency operations, colonial conflicts and distant imperial wars: soldiers operating outside of ‘real war’ were free both to dispense with the expectations of ‘real war’ but also to discard the lessons of such conflicts as they prepared for “war as it should be” to use Lynn’s phrase.

Both ‘discourse breaches’ are at work in the Classical period in ways that complicate efforts to read exceptions against expectations. The Greeks even have a category to explain this idea, the notion of war “without heralds” or “without truces” meaning war conducted outside of the normal expectations that govern ‘real war.’ Likewise stasis within a polis or colonial warfare against ‘barbarians’ at the edges of the Greek world operated with different expectations. The tricky problem is that in arguing against the ‘rules’ heterodox scholars often include these examples, even when it seems that even the Greeks at the time recognized them as a discourse ‘other than war’ (and that such distinctions, while perhaps trivial to us, meant something to them). Likewise, the expectations for pitched battles – in the Greek context, clearly the most culturally important (if perhaps not strategically important) kind of violence – were not the same as expectations for the raid, the ambush or the siege.

To cover all of these points in detail would mean essentially rewriting Roel Konijnendijk’s Classical Greek Tactics (2018) but coming to different conclusions, so I will simply hit what I view as the ‘high points’ that I think synthesize the rules with the exceptions. First, we must take all of the things which are not pitched battle and not ‘war’ in Lynn’s sense and set them aside for now. Colonial wars had different expectations, as did civil wars, as did sieges and so on. We may imagine a single category of ‘violence,’ but the Greeks did not (and we don’t really do so in practice either), as their discourse about war without truces or heralds shows.

While ‘encounter battles’ (where armies blundered into each other) could happen, for the most part hoplite battles largely followed an ‘offer battle’ model: one army formed up on terrain it preferred and the other army could either accept the offer (and attack) or decline (and form up on their own terrain). We’ve discussed this sort of ‘negotiation’ (in the sense of offer-counter-off, not that they’re talking to each other) before. Greek armies seem generally to have preferred relatively open ground in offering battle (famously noted, Hdt. 7.9b.1), but did at times offer battle in narrows or on hills; the use of terrain for advantage was not ever unknown to them (as Konijnendijk rightly notes).

Generally they formed up with the position of honor and thus the general on the right. Konijnendijk presents a list (op. cit., 121-2, table 3) of general placements, 12 on the right, 7 in the center and 10 on the left with one either center or left, which is already right-heavy. But if we sort out the conjectures, things like generals caught mid-speech out of position (Athens at Delion) or ambushed (Sparta at Stratos) or non-leading states given positions of honor because the battle was in their country (Argives at Mantinea) and the like, we end up with something like 12 right, 5 center and 6 left. In short it seems there is an expectation that the right is the position of honor, but an expectation that could be deviated from if needed for tactical or diplomatic advantage. So I find myself taking a softer version of Konijnnedijk’s view: there was an expectation that the right was a position of honor, but it was not an infinitely strong expectation.

The role of light infantry and cavalry at this point – in the Classical period – is more complex. On the one hand, light infantry and cavalry are simply not reported in a lot of these battles. For all of the battles in Thucydides only once does a light infantry skirmish explicitly proceed a pitched hoplite battle (6.69.2-3) and this is in Sicily. Regional distinctions here clearly matter, of course: non-polis regions like Aetolia were mostly light infantry, while Boeotia was famed for its light infantry and Thessaly for its cavalry. By contrast, from Attica southwards, we seem to see the classic very hoplite-heavy armies. The Athenian expedition to Sicily – country in which it would turn out light infantry and cavalry were really important involved an initial wave of 5,100 hoplites, but just 1,300 light infantry and thirty (30!!) cavalry (Thuc. 6.43); later reinforcements would bring up the cavalry numbers to 460, for an army that by then had roughly 10,000 hoplites in it and perhaps 2,600 lights.18 By contrast, we’d expect a standard Roman army of the Middle Republic to have 12,000 heavy infantry (two legions, two alae), 4,800 light infantry and something like 1,200 to 1,800 cavalry.19 The Syracusan cavalry is both better and more numerous but the overall balance of their forces is also remarkably hoplite heavy as presented to us. That is not to say polis armies had no light infantry, far from it. But it is clear that in the poleis south of Boeotia, the trend towards deemphasizing cavalry and light infantry had gone quite a long way.

Determining what these fellows do is also tricky because, as noted, our sources often don’t tell us what they are doing very clearly. That is reflective of a belief by our sources (note Thucydides’ dismissive tone, 6.69.2) – one which continues through to the Hellenistic period and is sometimes made explicit – that while light infantry are very important in irregular engagements (ambushes, sieges, etc; actions like Sphacteria/Pylos), in pitched battles they generally were not decisive.

Konijnendijk, in an effort to understand the role these fellows might have, explores the idea of a ‘cascading charge:’ with cavalry attacking first, followed by light infantry, followed by the youngest, fittest hoplites, followed by the main force. I fear I do not think this point goes as far as Konijnendijk thinks. As has been elsewhere noted, none of the examples given save for an interpretation of Leuctra, involved pitched battles.20 More to the point, Konijnendijk points to Aeneas Taktikos to provide a description of this method, but I don’t think Aeneas is Tacticus is actually describing a pitched battle tactic. What he says is:

For when your supporting force is ready at the appointed place, and the enemy has already scattered for plunder, then and only then you should anticipate [προκαταλαμβάνω, ‘to preoccupy, apprehend before, anticipate, surprise”] their retreat with cavalry, make ambushes [ἐνέδρα] with picked men, and, displaying [ἐπιφαίνω] your light-armed troops, lead your heavy-armed men in formation not far behind those already sent.
(Aeneas Tacticus, 16.7; trans. Illinois Greek Club, with some modifications for clarity)

This is not a recipe for a pitched battle but rather ambushing a force that is looting or foraging in the context of a siege. Moreover, it is also not a cascading attack! The cavalry and picked men are not charging ahead of the main line, but rather heading off retreat or lying in ambush, while the light infantry is displayed or presented [ἐπιφαίνω], which is to say that you are demonstrating with a weak force (perhaps to invite attack) while a far heavier and more formidable force is coming up and your other troops are in ambush positions.

The other reason I have to doubt the regular employment of cavalry or light infantry in this fashion is that Greek hoplite armies were not constructed to this purpose nor well-suited for it. The obvious parallel here is the Roman legion which did imagine a ‘cascading’ attack: light infantry, then the youngest heavy infantry, then men in their prime. But as you will recall from our discussion of it, making that tactical structure work demanded a remarkably complex, ‘fussy’ tactical system with dozens of independent maneuvering units in order to create the lanes to allow each stage in the attack to retreat effectively without disrupting the formation of the line behind them. Greek hoplite armies do not have any of that organization, as Konijnendijk rightly notes.

Instead cavalry and light infantry seem to have had a mostly screening role. Hoplites were potentially vulnerable, after all, to light infantry harassment, but a modest screening force of your own light infantry could prevent this and then get out of the way when the ‘real’ battle was joined. Likewise, light infantry and cavalry were important for foraging and scouting, though it is worth noting that scouting arrangements in polis armies seem to have been pretty modest, reflecting, I’d argue, the meaningful expectation that another polis army is likely to meet them in an offered, pitched battle in a relatively open place, not lie in ambush.

Finally, we have the question of stratagems and trickery. Ruses of war and trickery were certainly not new to the Greeks, but neither are they new to us and yet our ‘discourse’ around the rules of war is so strong we went and codified it into an international legal system far more rigid than anything the Greeks could have constructed. But such tricks and surprises worked precisely because there was an expectation for what war was supposed to look like and there was a lively discourse in antiquity as to if they ought to be practiced or shunned.21 Konijnendijk is thus absolutely correct to note that the ‘Prussian’ ‘rules’ were not absolute, but just because they were not absolute does not mean that they were unreal.

The hoplites’ code, like the pirates’ code, turns out to be more guidelines, or as I prefer the framing here, expectations. Those expectations persisted because many battles did, in fact, resemble them, even as they were occasionally ruptured by trickery which did not and even as the Greeks understood there were zones of warfare either beyond the polis (colonial wars) or within it (civil wars) rather than between poleis, where the expectations did not apply.

The Collision At Last

Finally, our field clear of light infantry and cavalry, our ruses used (or not), our formations drawn up, we are ready to smash together two opposing lines of hoplite heavy infantry.

How did that work?

As we’ve already discussed, the ‘shoving’ model of the orthodox is simply not workable here. Likewise, if hoplites did not fight as skirmishers in the Archaic period when such light troops still seem to have been quite active on the battlefield, they surely cannot do so now. This must be a shock engagement but therein lies the trickiness because we do not have a good sense of how shock engagements work: modern military writing was very young when the last major shock infantry engagements were being waged and of course film was farther off still.22

First, we need to be aware that practices differed between poleis. Most poleis charged at a run, while the Spartans famously did not (Thuc. 5.70) and we have to imagine – this is a topic for next time – that the emergence of more training and semi-professional mercenaries may have meant different approaches as well.

But it seems like what we might imagine would be typical for a pitched battle (again, that’s an important category; there are other kinds of fight, but the hoplite is, I’d argue, built for this kind), the general would offer a final pre-engagement sacrifice before sounding a charge (using a trumpet). As far as we know, once that order was given, the general – who more often than not was fighting as a hoplite with his men – basically lost control of the battle. The only other easily available signal was ‘retreat.’ Generals could make last minute adjustments (or try to) to their formations – Konijnendijk again (op. cit., 149) very ably catalogs all of the examples (and they often don’t go quite right) – but the phalanx was a ‘dumb-fire missile’ once launched: it went straight forward and broke things. As we’ll look at later, part of this is because of the relative (lack of) training for our hoplites.

Beyond this point, we actually have fairly few details about the mechanics of charge and contact. That may seem strange, but it is actually very typical for pre-gunpowder cultures: what happens in the moment of contact was evidently hard to describe and in any case their intended audience had experienced it and so a detailed, mechanical description was unnecessary. Once the advance was sounded armies might join in a song or chant in the advance called the paean (παιάν); evidently different poleis had different songs.23 Finally, probably right before breaking out into the final charge, the soldiers issued a war-cry, which we can actually somewhat guess at the sound because it has an onomatopoetic word: ἀλαλή (alale, a-la-lay) and an associated verb ἐλελίζειν (elelizein, e-le-li-zane, ‘to issue the war cry’), suggesting it was something like a high-pitched keening or ululation sound.24 It was in this advance that Thucydides reports (Thuc. 5.71.1) the rightward drift of the formation began as men sought to protect their unprotected side; of course however a hoplite stood while fighting, while marching he was head-on to the enemy. Then came the charge.

The orthodox school assumes these men charged into collision, either hoping to physically push through the enemy or else to use their charge to add such impulse to their spears – like ‘horseless lancers’ – to stab through shields and armor. No infantry works this way and we’ve been over the reasons this is not very plausible.

Via Wikimedia Commons, the Chigi Vase again. Notice how they are not shoving, but instead things to fight with their spears in an overhand grip?
That is how hoplites fought.

By contrast, Hans van Wees argues hoplites slowed to a stop eis doru (εἰς δόρυ ‘within spear’s reach’). It is striking to me that van Wees offers this specific phrase to underline his point, because both of his examples (Xen. Hel. 4.3.17 and 7.1.31) share something in common which is no one is doing the thing he is describing. Instead, both cases describe an army doing what we would call ‘routing on contact’ – soldiers losing their nerve and turning to run in the split-second before impact. That is not an uncommon moment for cohesion to fail (indeed, in the last period of regular shock warfare scholars regularly observe that infantry almost never actually received a bayonet charge because they would rout on contact or before it).25 Xenophon is not describing hoplites slowing to contact at spear’s reach, he is describing one group of hoplites, seeing that the incoming enemy is not stopping losing their nerve and turning to run at spear’s reach.

That, in turn, is a psychological response that, at least to me, only makes sense if it seems to the soon-to-be-running opponent that the incoming charge will be delivered, not that it will politely stop six or seven feet short. Once again, training for bayonet charges is instructive: quite a lot of generals knew that bayonet charges did not usually result in lots of ‘bayonet fencing’26 but they trained to charge with bayonets, shouting, at full tilt anyway because you needed the other guy to think you intended to plow into him, even if you didn’t, in order to get him to run away.

At the same time, the same psychological pressure is working on the man charging: the same pressure that makes his opponent flee encourages him to slow down. And now we have to remember that both lines are advancing: hoplite armies almost never patiently ‘received’ charges.

I would thus suggest that the outcome at impact probably varied a lot: in some cases both sides lost their nerve and started to slow and the van Wees ‘slow to stop at eis doru‘ probably happened. But I suspect in most cases there is an effort to maintain momentum and cohesion so that the formation at least looks like it is going to crash into the enemy and thus in many cases if neither side blinks it must have done so; at the very least individually brave or foolhardy fellows must have considered putting their shoulder into the dish of their shield and simply impacting to try to throw an enemy down. Given that hoplites were – again, next time – relatively untrained, I imagine you had a bit of all of these options – men slowing to a stop, men slowing and colliding at lower speeds and full speed collisions – all happening up and down the line.

The danger, of course is that this produces something like crowd collapse (once again, Paul Bardunias discusses this) but for formations that are only 4 to 16 men deep and have nothing behind them the release for that pressure is easy enough: the formation can ‘accordion’ back out as men naturally back out of the pressure.27

So we might imagine the two formations first accelerate towards each other. As they near ‘spear’s reach’ one might collapse-at-contact from the psychological pressure, but ideally both are seeking to deliver the charge. That doesn’t mean everyone slams into each other full tilt – most men probably slow down at least somewhat, but we certainly get descriptions of men fighting ‘shield on shield’ suggesting to me that sometimes guys got close enough to make shield-to-shield contact (Tyrtaeus fr. 11 West). Shield-to-shield contact, especially with aspides that can’t extend as far, is a lot closer than ‘measure’ with thrusting spears (and thus a more dangerous place to be) but one can imagine a hoplite carried forward by the momentum of his charge clashing shield-into-shield before pushing back out. I know I keep bringing it up, but watching the movement patterns of Paul Bardunias’ experimental fighting line (below, on the left) I think gives a good sense of how these ranks might close up and accordion back out.

A screencap from Paul Bardunias’ presentation at the Battle of Plataea Conference which I hope he will pardon my use of. Though the 60cm side (left) doesn’t have a lot of depth, you can see how flexible the second rank’s position is – they’re not pushing the guys in front of them, but they can push up to assist by delivering strikes or drop back to create space. Such jostling is presumably happening all through each file, as each man probably has a few feet of ‘vertical’ room to move.

After that initial impact – which again, might range from a slow-to-stop-at-measure to folks slamming into each other, with every variation of those outcomes happening somewhere as the lines meet – assuming both formations remain cohesive, you are going to get a stabbing fight at the front line. I suspect the increasing frequency of this kind of fight is what propelled the development of the ‘all hoplite’ phalanx because lighter infantry would be at an extreme disadvantage in this kind of fight. Close-quarters engagements between heavy infantry and light or even medium infantry tend to be shockingly one-sided both because the heavier armor enables the heavy infantryman to be much more aggressive against his unprotected foe and because the mismatch leads to rapid cohesion collapse.

Via Wikimedia Commons, hoplites fighting ‘shield against shield.’ (c. 600). These sorts of combat scenes are common in Greek artwork but as you can see it is quite robustly hard to tell if the fighting we are seeing is formation fighting in a pitched battle or other kinds of actions.

However, since these are both heavily armored and well-protected lines, the casualties here will be tolerably low, probably around 5% of the total engaged force, which wouldn’t even represent a majority of the front line of an eight-man-deep phalanx (it’d be c. 40% of that line) even if every single casualty was from the front line, and we have to imagine some unlucky second or third line fellows are likely struck either in position or once they move forward to replace a downed comrade.28 This phase simply could not last very long because these formations have no way to ‘trade out’ the front ranks and exhaustion would hit fairly fast. A looser formation might be more able to trade out men, but as Bardunias’ own experiments demonstrate, if you adopted that looser 180cm formation, a tighter 90cm or 60cm formation would cut through it much too quickly.

As Ardant du Picq observes, under these conditions collapse comes not from the front, but from the back: the men in the back can see the carnage, they are stuck with the anxiety and fear of ‘waiting their turn’ but have none of the impetus to action of being in the fight. This kind of fighting is effective, but it pushes human psychology well beyond its intended limits and at some point something must break. Victor Davis Hanson’s ‘gaps and tears’ – break-down from the front – are thus unnecessary for formation collapse. Once basically anyone starts fleeing, cohesion collapse is rapid: every man who turns to run increases the psychological pressure on everyone else and all of these men are near the breaking point. As the formation collapses, the great majority of the killing occurs, probably around 10% or so of the fleeing army killed in the rout, most within a few moments of collapse.

Then the question becomes pursuit. The orthodox generally argue that the ‘rules’ of war and the heavy equipment of hoplites prevented long pursuits, while heterodox scholars29 argue that pursuit was broadly unrestricted. My view here, to be frank, is that they are both half-right. Within the ‘agonal’ war discourse – that is to say, in wars with truces and heralds between poleis – it sure does seem like pursuit after a battle was often limited. Outside of that discourse – wars in colonial areas, in civil wars, during actions other than pitched battle or wars that had broken the ‘truces and heralds’ bonds – pursuit could be and indeed often was long and savage.30 That said even ‘short‘ pursuits could be very bloody indeed if some obstruction or terrain prevented one side from getting off of the field quickly: Greek hoplites had little problem butchering enemies who did not or could not escape after a pitched battle between poleis, even if they might not chase them once they did so.

Notably, when thinking about pursuit, we probably ought to think about the strategic context here and this is a point on which I think the orthodox school may have things almost exactly backwards. The orthodox school imagines a sort of limited, ritualistic warfare dominating the Archaic period which then broke down under the pressures of the Classical period (the heterodox school imagines few limits to such warfare at any period). By contrast it seems to me that if we glimpse Sparta’s early history we can see a different pattern: a series of eventually ‘unlimited’ wars in the seventh century – during what should be the heyday of ritual, ‘agonal’ warfare – which destroy the Messenian polity and reduce its population to slavery. Some time in the mid-500s, they tried the same thing to tiny Tegea, but were defeated a the ‘Battle of the Fetters’ (Hdt. 1.66) and forced to back off their policy of direct conquest. Yet by Thucydides’ day, if not earlier, the idea that a war would extinguish a polis was a shocking breach of norms and expectations: the destruction of Plataea and Melos are major events in his history for this reason.

What I think is happening is not some utterly ancient Archaic ritual warfare, but rather that the emergence of a state system of reasonably well-fortified poleis produces a period of, effectively, ‘Kabinettskrieg‘ in Greece (in the sense of war aims, not in the sense of army structure). What had happened during the age of Kabinettskrieg in the early modern period was simply that the nature of warfare had made vast, sweeping conquests mostly impractical (lots of well-fortified towns were a major factor), so a system of more limited warfare developed, later to be, eventually, decisively disrupted by the Wars of the French Revolution. I think the same thing is happening here: as the Greek state system solidifies around fortified urban centers, war aims get limited because they essentially must. Greek armies, after all, are terrible at siege-craft, not just compared to the feats of later Macedonians or Romans, but even compared to earlier Neo-Assyrian armies. Major walled cities were almost impossible for them to capture with the kind of weekend-warrior militia armies they had, at least until the scale and intensity of the Peloponnesian War enabled modestly effective siege warfare again, at which point the period of ‘Kabinettskrieg‘ started to collapse, breaking those expectations, which in turn we hear about through the discourse and culminating in Philip IIs conquests at the tail end of the Classical period.

What to Expect When You Are Expecting Hoplites

To conclude this part then, I think the first step in trying to untangle this debate is to allow our definition of ‘phalanx’ a little more flexibility. The second step is to think in terms of expectations rather than rules, allowing our sense of Greek battle to have a little give in the joints: not the complete no-rules absolute murder-war of the heterodox school nor the ultra-rules-bound inflexible system of the orthodox.

If we were to simplify our model, the Greeks of the Classical period expected pitched battles to be won primarily by engagements with hoplites. Light infantry and cavalry were mostly for other kinds of military action or for distinctly subordinate roles around as much as ‘in’ a pitched battle. Pitched battle in turn was the most culturally important kind and could often be decisive, but was hardly the only sort of military action one might engage in.

In a pitched battle, the polis Greeks expected that both sides would ‘offer battle’ by forming up on terrain they were willing to fight on, eventually arriving on ground they were both willing to risk a battle on, which tended to eventually mean fairly open ground, but not always. They would draw up by detachments – for Greek poleis almost always fought in multi-city alliances in this period – probably with small intervals between them but these were not intended as precision maneuver-units so much as cohesion units (more on that next time). These formations would generally be about 8 men deep, sometimes deeper, sometimes shallower, though 8 seems to have been the normal, expected depth, with each file occupying around 90cm or of width, perhaps getting a bit tighter during that rightward-drift we hear about from Thucydides. The position of honor was the far right,31 but all sorts of expediencies both diplomatic and tactical might cause different dispositions.

Again, expectations, not rules.

Before deployment generals usually offered a sacrifice to the gods to determine if the gods endorsed offering battle. Another sacrifice was made as the deployment completed moments before, which was to please the gods rather than ask for information – it was too late to do much in any case. If light infantry were to do much, they might skirmish against each other during the deployment, before getting out of the way for the main show; cascading attacks were not a thing for pitched battles, for Greeks were not Romans and the hoplite phalanx not a legion. Generals tried to use terrain as much as they could and set out their formations as cleverly as they might and could in some cases give pre-made battle plans, but for the most part these armies were dumbfire missiles. The general signaled the advance, a trumpet rang out and the missile fired; a song was taken up on the advance, punctuated by a shrill war cry as the two advancing lines sped to a charge over the last few hundred meters.

Sometimes a phalanx collapsed before impact, or right in the moment of it, to general disaster. But generally once both sides ascertained that the other was not stopping they likely slowed a bit: individual impacts probably occurred but no mass shoving effort. The ranks probably compacted together and then, to a degree, accordioned out. In place of the shoving othismos, the front ranks probably backed out to ‘measure’ (spear’s reach) and thrust at enemies, with both lines irregularly wavering forward and back as men pushed forward to strike and backed up to avoid enemy strikes. Men who were struck fell and likely tried to crawl or were pulled by their mates back through the line. Behind, the ranks not yet in battle felt their courage slowly wither with the sounds of shouting, the cries of the dying, the sight of wounded comrades.

Eventually, the terror became too much and some of them men, likely men not yet in contact, began to back up. The rout would quickly be contagious as their fellows – every bit as scared and knowing full well that being the last man to retreat in a rout was a death sentence – noticed the weakening cohesion. As the formation collapsed, there was a tremendous burst of killing – we might imagine half of the killing might happen over the several minutes of charge, contact and sparring and the other half in the few seconds of the rout. But most of the retreating men got away: hoplite armies were not well designed for long pursuits and they weren’t expected or generally necessary for pitched battles against other poleis in any case. An enemy so defeated was unlikely to offer battle again soon, clearing the way for a siege or – in the age of ancient Greek ‘Kabinettskrieg‘ – more likely a negotiation over the recovery of dead.

Of course against non-Greeks, or in kinds of battle that were not pitched battles between ‘gentlemen’ hoplites, the rules were quite different, pursuits could be long and Greek armies recognized few if any distinctions between combatants and non-combatants.

That is, more or less, my effort at tactical synthesis. It will not, of course, describe every battle or even exactly describe any battle. Instead, it is an effort to lay out what the expectations were, particularly on the even of the Peloponnesian War (431-404) after which expectations clearly begin to shift and collapse.

Next time we’re going to look at society outside of the battle and talk about how the hoplite fits into the polis: what his social status is, how he is (not) trained and what the implications are for the nature of the polis and indeed how many Greeks there even were.

[syndicated profile] oldnewthingraymond_feed

Posted by Raymond Chen

Last time, we encountered a mystery where the synthesis of CF_OEM­TEXT from CF_TEXT did not use Ansi­To­Oem. Today we will begin the investigation.

Recall that we have a table showing how Windows synthesizes each of the various text formats from the other two. But in the case where the clipboard has two formats available, and you ask for the third, there are two ways that the third format could be synthesized: It could convert the first, or it could convert the second. How does Windows decide?

The preference table is

To get First try Then try And then try
CF_TEXT CF_TEXT CF_UNICODETEXT CF_OEMTEXT
CF_OEMTEXT CF_OEMTEXT CF_UNICODETEXT CF_TEXT
CF_UNICODETEXT CF_UNICODETEXT CF_TEXT CF_OEMTEXT

In words, first look for a perfect match. If that’s not available, then try (in order) CF_UNICODE­TEXT, then CF_TEXT, then CF_OEM­TEXT. (One of those last three checks is redundant with the perfect match check.)

Combining that with our previous table produces this conversion table with priorities:

To get First try Then try And then try
CF_TEXT CF_TEXT CF_UNICODETEXT + WC2MB(ANSI CP) CF_OEMTEXT + OemToAnsi
CF_OEMTEXT CF_OEMTEXT CF_UNICODETEXT + WC2MB(OEM CP) CF_TEXT + AnsiToOem
CF_UNICODETEXT CF_UNICODETEXT CF_TEXT + MB2WC(ANSI CP) CF_OEMTEXT + MB2WC(OEM CP)

Again, “ANSI CP” means “the code page reported by calling Get­Locale­Info with the LCID in the CF_LOCALE clipboard format, and the LOCALE_IDEFAULT­ANSI­CODE­PAGE locale attribute”. Similarly for “OEM CP”, using LOCALE_IDEFAULT­CODE­PAGE instead of LOCALE_IDEFAULT­ANSI­CODE­PAGE.

If you stare at this table, you might notice something odd, possibly even disturbing. And that is part of the answer to the mystery. We’ll talk about it next time.

The post Resolving an ambiguity in the Windows clipboard automated text conversion table appeared first on The Old New Thing.

[syndicated profile] frontendmasters_feed

Posted by Chris Coyier

Matt Smith with wonderfully straightforward writing on why default parameters for functions are a good idea. I like the tip where you can still do it with an object-style param.

function createUser({ name = 'Anonymous', age = 24 } = {}) {
  console.log(`${name} is ${age} years old.`);
}

createUser(); // Anonymous is 24 years old.

more on visual culture in science

Dec. 12th, 2025 11:04 am
kaberett: Trans symbol with Swiss Army knife tools at other positions around the central circle. (Default)
[personal profile] kaberett

This morning I am watching the lecture I linked to on Tuesday!

At 6:53:

Here is an example of how the Hubble telescope image of the Omega nebula, or Messier 17, was created, by adding colours -- which seem to have been chosen quite arbitrarily -- and adjusting composition.

The slide is figure 13 (on page 10) from an Introduction to Image Processing (PDF) on the ESA Hubble website; I'm baffled at the idea that the colours were chosen "arbitrarily" given that the same PDF contains (starting on page 8) §1.4 Assigning colours to different filter exposures. It's not a super clear explanation -- I think the WonderDome explainer is distinctly more readable -- but the explanation does exist and is there.

Obviously I immediately had to stop and look all of this up.

(Rest of the talk was interesting! But that point in particular about modern illustration as I say made me go HOLD ON A SEC--)

[syndicated profile] in_the_pipeline_feed

It’s been obvious for many years now that growing antibiotic resistance is a problem, and that it could turn into a very bad one. There has been a great deal of work put into trying to understand the nature of these resistance pathways, but if you’re studying bacterial pathogens in the modern world, you’re showing up at the crime scene long after the break-in.

You might be surprised to learn (I was!) that there is actually a resource of pathogenic bacteria from the pre-antibiotic era. The “Murray collection” has several hundred bacterial varieties in it, mostly from the Enterobacteriaceae and specifically a number of Escherichia, Shigella, Klebsiella, Salmonella, and Enterobacter species that were collected from 1917 to 1954 by Everitt George Dunne Murray during his long career. These were stored as cultures on agar slopes, and curation of this collection was continued by his son Robert Everitt George Murray during the mid-20th century. In the early 1980s, subcultures of all of these were transferred to the National Collection of Type Cultures in the UK, where they are still available today.

This is obviously a uniquely valuable resource, and the world of infectious disease biology is indebted to the Murrays (father and son) for what must have seemed at times like a very odd use of time and effort. Over the years there have been many studies of the Murray cultures, and a number of very interesting things have been discovered - for example, it was found a few years ago that the majority of the Klebsiella strains in the collection were resistant to penicillin before penicillin even came into any widespread use. They were already prepared with beta-lactamases, presumably due to the natural occurence of such antibiotics in soils and other locations.

Here’s a new paper studying the Murray strains, specifically looking at the DNA plasmids that these bacteria carry. Those are the unfortunately all-too-swappable elements that bacteria trade around, and are a primary method by which resistance spreads through a population. They find that the great majority of the Murray-ra plasmids aren’t carrying many resistance genes per se. About 23% of the old plasmids have actually never been seen again in bacterial sequence databases in the modern era, but there are some from all the way back to 1917 that are still around (in modified form) in 2020. What this team found was that modern bacterial pathogens are dominated by large plasmids that have incorporated the older ones in their sequences, with several lines of evidence suggesting that they’re the product of multiple fusion events over the years.

As mentioned, the early plasmids have low levels of resistance genes scattered among them, mostly efflux pumps and a few for dealing with cationic peptides. The modern plasmids. . .are not like that. 38% of them are carrying resistance genes, often multiple copies, conferring resistance to a whole range of agents, many of them the broad-spectrum or “last resort” antibiotics, oh joy. The peak are plasmids that carry up to 40 different resistance genes, spanning a dozen different antibiotic types.

The authors were able to see several broad types of plasmid in the modern samples, and it appears that those behemoth polyresistance modern plasmids are probably short-lived, with a lot of the nasty diversity lurking in smaller, more stable and persistent sequences that are mixes of old-fashioned Murray sequences (and their descendants) with modern resistance genes. But as they authors note, it’s not just the presence of resistance genes that determines that fate of all these bacterial plasmids - there are clearly evolutionary forces at work beyond just those from antibiotics, and those need to be better understood. The bacteria are nowhere near giving up all their secrets.

Thoughts on Native CSS Mixins

Dec. 11th, 2025 10:29 pm
[syndicated profile] frontendmasters_feed

Posted by Chris Coyier

I have some notes from various times I’ve thought about the idea of native CSS mixins so I figured I’d get ’em down on (digital) paper!

For the record, they don’t really exist yet, but Miriam Suzanne says:

The CSS Working Group has agreed to move forward with CSS-native mixins.

And there is a spec, but the spec only deals with @function (which does exist). Functions are a little similar but act only as a single value rather than a block of styles.

The idea comes from Sass @mixin.

We happen to use Sass (SCSS) at CodePen and as I write, we have 328 @mixin definitions in the codebase, so it’s clearly of use.

Here’s a practical-if-basic example:

@mixin cover {
  position: absolute;
  inset: 0;
}

In Sass, that doesn’t compile to anything. You have to use it. Like:

.modal-overlay {
  @include cover;
}

.card.disabled {
  &::before {
    @include cover;
    background: lch(0% 0 0 / 0.8);
  }
}

See how I’ve used it twice above. Compiled Sass will dump in the contents of the mixin in both places:

.modal-overlay {
  position: absolute;
  inset: 0;
}

.card.disabled {
  &::before {
    position: absolute;
    inset: 0;
    background: lch(0% 0 0 / 0.8);
  }
}

Things can get a little fancier in Sass, but it’s all pretty straightforward:

  • Mixins can include nesting and work in nested code. They can even slot in nested content you pass to it.
  • Mixins can use other mixins.
  • Mixins can have parameters (like a function) and use/calculate off those values in the output.

I would assume and hope that all of this is supported in native CSS mixins. The native version, as explained so far on Miriam’s site (which will almost definitley change!), the only difference is the usage syntax:

@mixin --cover {
  position: absolute;
  inset: 0;
}
.modal-overlay {
  @apply --cover;
}

I imagine it’s @apply instead of @include literally because Sass uses @include and Sass would have a hard time “leaving it alone” when processing down to CSS.

Is there enough here for browsers/standards to actually do it?

The W3C CSS Working Group has already OK’d the idea of all this, so I assume it’s already been determined there is value to native CSS having this ability at all. But what are those reasons?

  • Not having to reach for a preprocessor tool like Sass. I don’t think this is enough of a reason all by itself for them, but personally, I do. This is a paved cowpath, as they say.
  • Preprocessor output has potentially a lot of duplicate code. This leads to bigger CSS files. Perhaps not a huge issue with gzip/brotli in play, but still, smaller files is almost always good.
  • Integration with --custom-properties. I would think the parameters could be custom properties and there could be custom properties used generally with the style block. Custom properties can change dynamically, causing re-evaluated styles, so mixins can become more powerful expressions of style based on a comparatively small custom property change.
  • Custom Properties can cascade and be different values at different points in the DOM, so mixins might also do different things at different points in the DOM. All this custom property stuff would be impossible in a preprocessor.
  • It’s a nicer API than faking it with @container style(). You can test a custom property with a style query and dump out styles in certain places now, but it doesn’t feel quite right.

I wonder what else tipped the scales toward the working group doing it.

Parameter handling seems tricky.

You can pass things to a mixin, which I think is pretty crucial to their value.

@mixin --setColors(--color) {
  color: var(--color);
  background-color: oklch(from var(--color) calc(l - 40%) c h / 0.9);
}

But things can get weird with params. Like what happens if you call setColors() with no params? Does it just fail and output nothing?

.card {
  @apply --setColors(); /* ??? */
}

It’s possible --color is set anyway at the cascade level it’s being used at, so maybe it has access to that and outputs anyway? I assume if --color is set at the same cascade level and the param is passed, the param value wins? How does !important factor in?

And what about typed params? And default values? Seems doable but quite verbose feeling, especially for CSS. Is it like…

@mixin --setColors(
  --color type(color): red
) {
  color: var(--color);
  background-color: oklch(from var(--color) calc(l - 40%) c h / 0.9);
}

Maybe like that? I’m not sure what the syntax limitations are. Or maybe we don’t need default values at all because the var() syntax supports fallbacks already?

Feels like it could open up a world of more third-party CSS usage.

Imagine CSS carousels. They are so cool. And they are quite a bit of CSS code. Perhaps their usage could be abstracted into a @mixin.

The jQuery days were something like this pseudo-code:

// <script src="/plugins/owl-carousel.js"></script>
$(".owl-carousel").owlCarousel({
  gap: 10, 
  navArrows: true,
  navDots: true
});

Which morphed into JavaScript components:

@import SlickCarousel from "slickcarousel";

<SlickCarousel
  gap="10"
  navArrows={true}
  navDots={true}
/>

Maybe that becomes:

@import "/node_modules/radcarousel/carousel.css";

.carousel {
  @apply --radCarousel(
    --gap: 10px,
    --navArrows: true,
    --navDots: true
  );
}

The jQuery version was DIY HTML and this would be too. You could call that SSR for free, kids.

What about “private” variables?

I sort of remember Miriam talking about this at CSS Day this past year. I think this was the issue:

@mixin --my-thing {
  --space: 1rem;
  gap: var(--space);
  margin: var(--space);
}

.card {
  @apply --my-thing;
  padding: var(--space); /* defined or not? */
}

The question is, does that --space custom property “leak out” when you apply the mixin and thus can be used there? It either 1) does 2) doesn’t 3) some explicit syntax is needed.

I can imagine it being useful to “leak” (return) them, so say you wanted that behavior by default, but the option to not do that. Maybe it needs to be like…

@mixin --my-thing {
  @private {
    --space: 1rem;
  }
  gap: var(--space);
  margin: var(--space);
}

Don’t hate it. Miriams post also mentions being more explicit about what is returned like using an @output block or privatizing custom properties with a !private flag.

What about source order?

What happens here?

@mixin --set-vars {
  --papaBear: 30px;
  --mamaBear: 20px;
  --babyBear: 10px;
}

.card {
  --papaBear: 50px;
  @apply --set-vars;
  margin: var(--papaBear);
}

What margin would get set here? 50px because it’s set right there? 30px because it’s being overridden by the mixin? What if you reversed the order of the first two lines? Will source order be the determining factor here?

Are Custom Idents required?

All the examples use the --my-mixin style naming, with the double-dashes in front, like custom properties have. This type of using is called a “custom ident” as far as I understand it. It’s what custom functions are required to use, and they share the same spec, so I would think it would be required for mixins too.

/* 🚫 */
@mixin doWork {
}

/* ✅ */
@mixin --doWork {
}

Is this just like the way forward for all custom named things forever in CSS? I think it’s required for anchor names too, but not container names? I wish it was consistent, but I like backwards compatibility better so I can live.

Wouldn’t it be better if it was required for keyframes, for example? Like if you saw this code below, is it obvious what the user-named word is and what other things are language syntax features?

.leaving {
  animation: slide 0.2s forwards;
}

It’s slide here, so you’d have to go find it:

@keyframes slide {
  to { translate: -200px 0; }
}

To me it would be much more clear if it was:

.leaving {
  animation: --slide 0.2s forwards;
}
@keyframes --slide {
  to { translate: -200px 0; }
}

Annnnnnnd there is nothing really stopping us from doing that so maybe we should. Or take it one step further and adopt an emoji naming structure.

Calling Multiple Mixins

Would it be like?

@apply --mixin-one, --mixin-two;

Maybe space-separated?

@apply --mixin-one --mixin-two;

Or that is weird? Maybe you just gotta do it individually?

@apply --mixin-one;
@apply --mixin-two;

Does it matter?

Functions + Mixins

It seems to make sense that a mixin could call a function…

@mixin --box {
  gap: --get-spacing(2);
  margin-trim: block;
  > * {
    padding: --get-spacing(4);
  }
}

But would it be forbidden the other way around, a function calling a mixin?

@function --get-spacing(--size) {
  @apply get-vars(); /* ??? */
  result: 
    if (
      style(--some-other-var: xxx): 3rem;
      style(--size: 2): 1rem;
      style(--size: 4): 2rem;
      else: 0.5rem;
    )
}

Or is that fine?

Infinite Loops

Is it possible this opens up infinite loop problems in calculated styles? I don’t know if this is an actual problem but it’s brain-bending to me.

@mixin --foo(--val) {
  --val: 2;
}

.parent {
  --val: 1;
  .thing {
    @apply --foo(--val);
    --val: if(
        style(--val: 1): 2;
        else: 1;
      );
  }
}

Like, when evaluating a .thing, --val is 1 because of inheritance, but then we apply a mixin which changes it to 2, then we reset it back to 1, but if it’s 1 shouldn’t it reevaluate to 2? I just don’t know.

Unmixing

Miriam asks can you un-mix a mixin? Which is a great question. It’s very worth thinking about, because if there ends up being an elegant way to do it, it makes native mixins even more powerful and a big feather in their cap above what any preprocessor can do. I don’t hate an @unapply at first thought.

Thoughts?

Are you stoked for native mixins? Against it? Worried?

[surgery] one year on!

Dec. 11th, 2025 10:28 pm
kaberett: Trans symbol with Swiss Army knife tools at other positions around the central circle. (Default)
[personal profile] kaberett

I continue extremely grateful to no longer have ureteric stents.

a bit of stock-taking )

[syndicated profile] in_the_pipeline_feed

It’s been obvious for many years now that growing antibiotic resistance is a problem, and that it could turn into a very bad one. There has been a great deal of work put into trying to understand the nature of these resistance pathways, but if you’re studying bacterial pathogens in the modern world, you’re showing up at the crime scene long after the break-in.

You might be surprised to learn (I was!) that there is actually a resource of pathogenic bacteria from the pre-antibiotic era. The “Murray collection” has several hundred bacterial varieties in it, mostly from the Enterobacteriaceae and specifically a number of Escherichia, Shigella, Klebsiella, Salmonella, and Enterobacter species that were collected from 1917 to 1954 by Everitt George Dunne Murray during his long career. These were stored as cultures on agar slopes, and curation of this collection was continued by his son Robert Everitt George Murray during the mid-20th century. In the early 1980s, subcultures of all of these were transferred to the National Collection of Type Cultures in the UK, where they are still available today.

This is obviously a uniquely valuable resource, and the world of infectious disease biology is indebted to the Murrays (father and son) for what must have seemed at times like a very odd use of time and effort. Over the years there have been many studies of the Murray cultures, and a number of very interesting things have been discovered - for example, it was found a few years ago that the majority of the Klebsiella strains in the collection were resistant to penicillin before penicillin even came into any widespread use. They were already prepared with beta-lactamases, presumably due to the natural occurence of such antibiotics in soils and other locations.

Here’s a new paper studying the Murray strains, specifically looking at the DNA plasmids that these bacteria carry. Those are the unfortunately all-too-swappable elements that bacteria trade around, and are a primary method by which resistance spreads through a population. They find that the great majority of the Murray-ra plasmids aren’t carrying many resistance genes per se. About 23% of the old plasmids have actually never been seen again in bacterial sequence databases in the modern era, but there are some from all the way back to 1917 that are still around (in modified form) in 2020. What this team found was that modern bacterial pathogens are dominated by large plasmids that have incorporated the older ones in their sequences, with several lines of evidence suggesting that they’re the product of multiple fusion events over the years.

As mentioned, the early plasmids have low levels of resistance genes scattered among them, mostly efflux pumps and a few for dealing with cationic peptides. The modern plasmids. . .are not like that. 38% of them are carrying resistance genes, often multiple copies, conferring resistance to a whole range of agents, many of them the broad-spectrum or “last resort” antibiotics, oh joy. The peak are plasmids that carry up to 40 different resistance genes, spanning a dozen different antibiotic types.

The authors were able to see several broad types of plasmid in the modern samples, and it appears that those behemoth polyresistance modern plasmids are probably short-ilved, with a lot of the nasty diversity lurking in smaller, more stable and persistent sequences that are mixes of old-fashioned Murray sequences (and their descendants) with modern resistance genes. But as they authors note, it’s not just the presence of resistance genes that determines that fate of all these bacterial plasmids - there are clearly evolutionary forces at work beyond just those from antibiotics, and those need to be better understood. The bacteria are nowhere near giving up all their secrets.

[syndicated profile] oldnewthingraymond_feed

Posted by Raymond Chen

So far, we’ve learned that the conversion between Unicode and the 8-bit ANSI and OEM code pages is performed with the assistance of the CF_LOCALE clipboard format, which itself comes from the active keyboard layout. We left with the question of whether this is the right thing, giving as an example the case of highlighting some text in Hebrew and copying it to the clipboard. Shouldn’t that be set with a Hebrew LCID?

First of all, you have to specify what you mean by “copy it to the clipboard.” Suppose the English-language user selected some Hebrew text and the program set it to the clipboard as CF_UNICODE­TEXT with a Hebrew LCID. A program which reads the CF_UNICODE­TEXT will read the original Unicode text, with Hebrew characters intact. The LCID plays no role since no conversion was performed. So in the case where the string was placed as Unicode and retrieved as Unicode, everything is fine.

If the string were placed as Unicode but read as CF_TEXT, the retrieving program will get the string translated to code page 1252, since that is the ANSI code page used by the US-English LCID. Is this the correct code page? Well, if the retrieving program is using CF_TEXT, then it is a program that uses the 8-bit ANSI character set as its string encoding, and if you’re running on a US-English system, then the 8-bit ANSI character set is code page 1252. So translating the Hebrew text to ANSI via code page 1252 is correct. You need to translate the string into the ANSI code page that the retrieving program is using.

Conversely, if the Hebrew string were placed on the clipboard as 8-bit ANSI in code page 1252, then… wait, that’s a trick question! Code page 1252 doesn’t have any Hebrew characters! If a program uses the US-English 8-bit ANSI character set, it cannot represent Hebrew characters at all, so the scenario itself is flawed: There can’t be any Hebrew text on the screen to be selected since the program has no way of displaying it.

Now, I guess it could be possible if a program internally supported enough Unicode to display Hebrew characters, but still chose to put text on the clipboard in ANSI format. But in that case, it would be putting question marks on the clipboard since there are no Hebrew characters in code page 1252. Any program that does this intentionally is clearly being pathological: Why do all the work to display characters in Unicode, yet copy those character to the clipboard in 8-bit ANSI?

But wait, let’s rewind to a simpler scenario where there are no character set conversions at all. A program sets text on the clipboard in 8-bit ANSI, and another program reads it. If we consult our table, we see that the entry for this is “N/A”: There is no conversion. This holds true even if the program that put the text on the clipboard and the program that reads the text from the clipboard disagree on what the 8-bit ANSI code page is.

Prior to the introduction of the activeCodePage manifest declaration, the identity of the 8-bit ANSI code page was the same for all applications running in the same desktop. There was no opportunity for mismatch, so if one program put the text on the clipboard in 8-bit ANSI, and another read it out in 8-bit ANSI, they necessarily agreed on what the 8-bit ANSI code page was, since there was only one. But now that we have the ability for different programs to have a different value for the 8-bit ANSI code page, this nop-transformation will result in mojibake if the reader and writer have different ideas about what the 8-bit ANSI code page is.

You have the same problem with the Ansi­To­Oem conversion: Historically, all programs agreed on what the 8-bit ANSI and 8-bit OEM code pages are, so the system maintains a single “ANSI⇆OEM” conversion table that is shared by all processes. But now that programs can choose (indirectly) their ANSI and OEM code pages, you have a problem if those choices don’t match those the system would have chosen.

The people who added activeCodePage support hooked it up to the GetACP() and GetOEMCP() functions, as well as the to the A-suffixed functions which convert their 8-bit ANSI string parameters to Unicode before forwarding the result to the W-suffixed functions. But there are other places that didn’t get updated because doing so would require larger architectural changes, would affect performance of programs that didn’t use the activeCodePage feature, would introduce regression risk, and could lead to compatibility problems. Not saying that they couldn’t have done it, but it would have taken longer, and maybe it’s better to have a good-enough feature than a perfect one.

While doing fact-checking on this series of articles, I wrote some test programs that tried to trigger the CF_TEXT-to-CF_OEM­TEXT conversion, and they didn’t behave as I expected.

// Note: Test program doesn't do error-checking.

// Put the ANSI string "\xD0\x00" on the clipboard,
// with the locale 1049 (ru-ru).
int main()
{
    if (OpenClipboard(hwnd)) {
        EmptyClipboard();

        // Put an ANSI string on the clipboard.
        HGLOBAL glob = GlobalAlloc(GMEM_MOVEABLE, 2);
        PSTR message = (PSTR)GlobalLock(glob);
        message[0] = 0xD0;
        message[1] = 0x00;
        GlobalUnlock(glob);
        SetClipboardData(CF_TEXT, glob);

        // Mark it as locale 0x0419 = 1049 = ru-ru
        glob = GlobalAlloc(GMEM_MOVEABLE, sizeof(LCID));
        (LCID*)GlobalLock(glob) = 0x0419;
        GlobalUnlock(glob);
        SetClipboardData(CF_LOCALE, glob);

        CloseClipboard();
    }
}

And here’s the program to read the string back out in the OEM code page.

int main()
{
    if (OpenClipboard(hwnd)) {
        HGLOBAL glob = GetClipboardData(CF_OEMTEXT);
        PSTR message = (PSTR)GlobalLock(glob);
        printf("%0x02x\n", message[0]);
        GlobalUnlock(glob);

        CloseClipboard();
    }
}

I ran this on a US-English system, so the LCID is 0x0409 = 1033, the ANSI code page is 1252, and the OEM code page is 437. The character D0 in code page 1252 is Ð = U+00D0. This character does not exist in code page 437, so Ansi­To­Oem uses the best-fit character D = U+0044, which is in position 44 in code page 437.

When I ran this program, I expected the CF_OEM­TEXT string to have the byte 44, but it didn’t. It had the byte 90. We will start unraveling this mystery next time.

The post Studying the various locale mismatch scenarios in Windows clipboard text format synthesis appeared first on The Old New Thing.

[syndicated profile] oldnewthingraymond_feed

Posted by Raymond Chen

Last time, we finished with a nice table of now Windows synthesizes each of the three text clipboard formats from the other two. We saw that the CF_LOCALE clipboard format plays an important role in the conversion. But when most people set text on the clipboard, they don’t specify an explicit CF_LOCALE format. What happens in that case?

If the code that puts the initial text on the clipboard does not specify an explicit CF_LOCALE, then the system synthesizes one by using the LCID associated with the user’s current keyboard layout. This is what 16-bit Windows did, and 32-bit Windows carried this policy forward for backward compatibility.

This means that if you typed the text with the US-International keyboard, then the system will use the US-English LCID as the CF_LOCALE, and it will therefore use 1252 as the ANSI code page and 437 as the OEM code page.

You might say, “But that makes no sense, does it? Suppose I highlight some text in Hebrew and copy it to the clipboard. Shouldn’t that be set with a Hebrew LCID?”

Should it?

We’ll start studying all the multi-locale issues next time.

The post How does Windows synthesize the <CODE>CF_<WBR>LOCALE</CODE> clipboard format? appeared first on The Old New Thing.

[syndicated profile] littletinythings_feed

New comic!

It was great reading all your comments on the last pages :) this whole Gnome arch has been a reveal I've been waiting to get to since the start<3

May warm loving hugs spread far and wide. And know you're loved.

side-tracks off side-tracks

Dec. 10th, 2025 11:08 pm
kaberett: Trans symbol with Swiss Army knife tools at other positions around the central circle. (Default)
[personal profile] kaberett

One of the things I found yesterday, while getting distracted from transcription by regretting not having taken History and Philosophy of Science (or, more accurately, not having shown up to the lectures to just listen), was some tantalising notes on the existence of a four-lecture series entitled Visual Culture in Science and Medicine:

Science today is supremely visual – in its experiments, observations and communication, images have become integral to the scientific enterprise. These four lectures examine the role of images in anatomy, natural history and astronomy between the 15th and the 18th centuries. Rather than assessing images against a yardstick of increasing empiricism or an onward march towards accurate observation, these lectures draw attention to the myriad, ingenious ways in which images were deployed to create scientific objects, aid scientific arguments and simulate instrumental observations. Naturalistic styles of depictions are often mistaken for evidence of first-hand observation, but in this period, they were deployed as a visual rhetoric of persuasion rather than proof of an observed object. By examining the production and uses of imagery in this period, these lectures will offer ways to understand more generally what was entailed in scientific visualisation in early modern Europe.

I've managed to track down a one-hour video (that I've obviously not consumed yet, because audiovisual processing augh). Infuriatingly Kusukawa's book on the topic only covers the sixteenth century, not the full timespan of the lectures, and also it's fifty quid for the PDF. I have located a sample of the thing, consisting of the front matter and the first fifteen pages of the introduction (it cuts off IN MID SENTENCE).

Now daydreaming idly about comparative study of this + Tufte, which I also haven't got around to reading...

Mirror-Imaging Your Way Through

Dec. 10th, 2025 03:48 pm
[syndicated profile] in_the_pipeline_feed

I found this to be an interesting paper, and it uses an idea that’s not always easy to realize. There are a lot of time when we’d like to be able to use small proteins and peptides as drugs, but they often have poor pharmacokinetics (absorption, membrane penetration, and most especially metabolic liability). In addition, some of these small-protein ideas can end up being immunogenic, since your body can react to them like the foreign substances they are, with your immune system taken them as signs of some sort of viral or bacterial attack.

As an aside, the current vogue for “peptides” (very loosely defined) among wellness types, bodybuilders, and other such groups is grimly amusing from a medicinal chemistry point of view. Most of these people have no actual idea of what they’re talking about, and “peptide” gets used as a synonym for “cool dietary supplement known to guru insiders” with no further thought. So asking someone if they take peptides just gets a blank stare from anyone who knows biochemistry, since your body is swimming with tens/hundreds of thousands of different short protein sequences that fit inside that name. And the number of different possible peptides, even reasonably short ones, is just beyond human comprehension. It’s not a very useful term when thrown around like this!

Anyway, what the new paper above is discussing is more in the “miniprotein” class - that is, long enough to fold itself into a defined three-dimensional structure. In this case, they’re about forty amino acids long. And the authors are looking to compare hit rates against a difficult target (PD-1/PD-L1) versus shorter sequences I blogged just the other day about a quick computational approach that came up empty against this one, and it’s really no wonder - that interface features two rather flat beta-sheet surfaces that don’t give small structures very much to grab on to, as far as anyone’s been able to see.

And they’re also interested in making these miniprotein candidates out of D-amino acids. Those are of course the mirror-image forms of the ones used normally in living systems, and the idea there is that a peptide or protein made out of such enantiomers will probably not be a substrate for hydrolase enzymes (and may be less immunogenic as well). But you’re not going to be able to take a sequence that you know binds to you target, synthesize it with all the amino acids flipped into the D stereochemistry, and expect it to bind. You’ve made a different compound entirely! So the D-proteins you get out of such a screening/synthesis exercise would not be expected to look much like sequences you’re seen before - you’re just using this non-natural stereochemistry to put the side chains and functional groups into the right position to hit the target, one way or another.

But how do you do that? There are, as mentioned, ridiculously huge numbers of potential protein candidates available, and the best ways to produce and evaluate huge mixed libraries of them rely on living-system-derived techniques like phage display (subject of the 2018 Chemistry Nobel, I might add). But the phages and bacteria you’d use for such library preparation are of course all using the good ol’ L amino acids that we’ve stuck with for a few billion years now. Well, here’s a way out: if you can go to the trouble of making a supply of your target protein (the one that you’re screening for binders to) as an all-D protein, then you can screen against whatever normal phage libraries you want. If you identify a binder, then all you have to do is synthesize that hit out of D amino acids so it can bind the natural L-protein target! This mirror-image screening was pioneered back in the 1990s and has been used in a number of applications since for people interested in D-protein screening hits.

Now, making any substantial sized protein out of all D amino acids is not enjoyable, but it’s gotten more feasible over the years with advances in organic-chemistry routes to protein synthesis. And that’s what this paper did, making a 146-amino acid construct of the PD-1 extracellular domain as the screening target. (It was assembled from seven shorter sequences by various chemical ligation reactions - not the work of a moment, but certainly doable if you have the time, skill, and patience. Oh, and the money. That too.

Most of the commercial screening libraries of various-length peptides didn’t yield much of interest. But their miniprotein library, which had been targeted towards a different purpose entirely (SUMO binding) from another project, actually yielded a micromolar binder. They used that sequence to prepare a new phage library with several hundred million proteins randomized around this one. The twenty or so best survivors from four successive rounds of screening and enrichment turned out to be pretty good when tested as individual compounds - many of them were sub-micromolar and one of them came in with an IC50 of 60 nanomolar (but was about a hundredfold less potent in the cell assay, which is certainly not unheard of either, unfortunately). NMR evidence seems to confirm direct binding to the PD-1 protein, albeit without many structural details.

This comes under the heading of “an interesting start”, and it certainly seems to demonstrate that miniproteins can be ligands for such difficult targets. Turning D proteins of any sort into drugs is something that hasn’t quite crossed the finish line yet, although there are two such candidates in clinical trials against other targets. It seems that the advantages of greater stability and lower immunogenicity can be realized with these things, although you certainly don’t want to take either one of those as given without proving it for yourself. There are though, an insane number of possible miniprotein scaffolds and designs, each of which can partake in the equally insane variety of protein sequences, so you’d have to think that there are drugs in there somewhere!

Fixing A Reaction

Dec. 4th, 2025 12:11 pm
[syndicated profile] in_the_pipeline_feed

Some chemistry today, drawn from real life (mine, anyway). I was setting up a short series of palladium-catalyzed couplings the other day (Buchwald-Hartwig type, C-N bond formation), and since there were very close precedents to my structures in the chemical literature, I naturally just borrowed the known conditions. There was nothing out of the ordinary about them; it seemed as if they’d work about as well on my starting aryl bromides as it did on the ones already described. (Edit: added some more references to this post after its first publication).

Well, they didn’t, of course. Which is the way of such metal-catalyzed couplings, which is why there are fifty gazillion ways of running them in the literature. They work until they don't! You can vary the catalyst ligands, first off, and boy are there are lot of them out there. You can change up the solvent, and the base needed for the reactions to go. There are other additives to try, and you can even vary the source of the palladium. (These days, if you know the system well enough and have some money to spend, you can order “pre-cat” materials where the ligand/Pd complex is already formed for you). In fact, here’s a recent Organic Process Research and Development paper that investigates that last variable in great detail: some catalyst systems don’t seem to care where their palladium comes from, while others care very much indeed, in case you were wondering.

But I had no desire to wander off and try a whole list of reaction conditions. In the manner of discovery biopharma chemists everywhere, I didn’t want to perfect my reaction - I just wanted it to make a reasonable amount of product so I could get on to the important stuff! I was staring at my compounds and trying to think about what made them different from the known examples, and the main thing was that I had an extra functional group at the other end of the molecule. I hadn’t thought it would be a problem, but I wondered if it was perhaps sensitive to the base I was using (which was good ol’ cesium carbonate). So I was very interested indeed when I saw this new JACS paper from the Hartwig group themselves.

It goes into great detail about the use of a base that I’d heard of but never actually tried, potassium 2-ethylhexanoate (K-2-EH). That might be an obscure-sounding reagent (along with the starting 2-ethylhexanoic acid) unless you’re a Real Industrial Chemist. Those compounds show up in a lot of polymer, coating, formulation, and materials science applications, and the acid is one of the largest-scale compounds of its kind produced industrially. So you can buy big ol’ bottles of the sodium and potassium salts relatively cheaply, and the potassium one is especially notable for dissolving in all kinds of organic solvents (where a lot of other potassium salts and carboxylates may not).

The Hartwig group found that it’s an excellent choice in the C-N couplings that bear the name, partly because of that solubility and partly because it’s a much milder base than many that people reach for. I read up on that, checked our inventory, and found a bottle of the stuff one floor below me. A milder base was about the only idea that I had to fix my problem, so it seemed like a good opportunity to try it out. I should note that the Buchwald group at MIT has also investigated some bases with properties of this sort, such as NaOTMS, which may itself be more effective for secondary amines. It's fascinating to me that these transformations have been investigated for so many years now (with these two research groups providing many major advances!) and there are still improvements like this coming along. Who knows what the final forms will be, if there are indeed final forms to be had?

Well by golly, I checked this morning and the reaction is making beautifully clean product, as opposed to the mixture of dark gunk I got with the cesium carbonate conditions. It is relatively rare that we get to actually figure out what’s going wrong with our reactions (unless you’re a process chemist, in which case that is your entire job!) But it’s also rare to fix things cleanly on the first shot - I can count the number of times I’ve been able to turn things around like this with one change on the fingers of my hands. Maybe just one hand, and that’s after forty years at the bench. 

That’s not as grim as it sounds, because remember, over most of that span I’ve been in the world where (as I like to say) there are two yields for reactions: Enough and Not Enough. Most of the time, even a relatively crappy conversion, the sort of thing a process chemist would not put up with for ten seconds, has been Enough, and I move on. But when all your starting material turns to gorp, you don’t have that option. Honestly, I would have settled just for a better product/gorp ratio, but what I got was the cleanest coupling reaction I’ve run in a long time. So thanks to Hartwig and collaborators, and those of you troubleshooting Pd reactions, try a K-2-EH run and see if it helps! 

Now I can move on (after another step or two) to the real reason I'm making these compounds, which is to do something very odd to an unsuspecting protein, and sadly I can't talk about that. But without making the needed compounds, you can't test out those weirdo ideas, can you? I'm glad these are now unsnarled.

I Wish People Were More Public

Dec. 10th, 2025 12:00 am
[syndicated profile] borretti_feed

Probably not a popular thing to say today. The zeitgeisty thing to say is that we should all log off and live terrible cottagecore solarpunk lives raising chickens and being mindful. I wish people were more online and more public. I have rarely wished the opposite. Consider this post addressed to you, the reader.

Your Writing

I will often find a blog post on Hacker News that really resonates. And when I go to check the rest of the site there’s three other posts. And I think: I wish you’d write more! When I find someone whose writing I really connect with, I like to read everything they have written, or at least a tractable subset of their most interesting posts. If I like what I see, I reach out. This is one of the best things about writing online: your future friends will seek you out.

And, from the other side, I have often written a post where, just before publishing, I would think: “who would want to read this? It’s too personal, obscure, idiosyncratic, probably a few people will unsubscribe to the RSS feed for this”. And always those are the posts where people email me to say they always thought the same thing but could never quite put it into words. I really value those emails. “I am understood” is a wonderful feeling.

I try to apply a rule that if I do something, and don’t write about it—or otherwise generate external-facing evidence of it—it didn’t happen. I have built so many things in the dark, little experiments or software projects or essays that never saw the light of day. I want to put more things out. If it doesn’t merit an entire blog post, then at least a tweet.

Your Books

If I follow you on Twitter, and you have posted a picture of your bookshelf, I have probably scanned every book in it. This is why I appreciate Goodreads. Like many people I have been reading a lot less over the past ~5y, but since I made a Goodreads account earlier this year, I’ve read tens of books. Reading in public has helped to motivate me.

You may say reading in public is performative. I say reading in private is solipsistic. Dante, in De Monarchia, writes:

All men on whom the Higher Nature has stamped the love of truth should especially concern themselves in laboring for posterity, in order that future generations may be enriched by their efforts, as they themselves were made rich by the efforts of generations past. For that man who is imbued with public teachings, but cares not to contribute something to the public good, is far in arrears of his duty, let him be assured; he is, indeed, not “a tree planted by the rivers of water that bringeth forth his fruit in his season,” [Psalms 1:3] but rather a destructive whirlpool, always engulfing, and never giving back what it has devoured.

My default mode is solipsism. I read in private, build in private, learn in private. And the problem with that is self-doubt and arbitrariness. I’m halfway through a textbook and think: why? Why am I learning geology? Why this topic, and not another? There is never an a priori reason. I take notes, but why tweak the LaTeX if no-one, probably not even future me, will read them? If I stop reading this book, what changes? And doing things in public makes them both more real and (potentially) useful. If you publish your study notes, they might be useful to someone. Maybe they get slurped up in the training set of the next LLM, marginally improving performance.

And Goodreads, for all its annoyances, is a uniquely tender social network. Finishing a book, and then seeing a friend mark it as “want to read”, feels like a moment of closeness.

I have a friend who lived in Sydney, who has since moved away, and we don’t keep in touch too often, because the timezones are inconvenient, but occasionally she likes my book updates, and I like hers, and I will probably never read that avant-garde novel, but I’m glad she is reading it. It is like saying: “You exist. I exist. I remember. I wish you happiness.”

Your Flashcards

Lots of people use spaced repetition, but most everyone’s flashcard collections are private. They exist inside a database inside an app like Anki or Mochi. You can export decks, but that’s not a living artifact but a dead snapshot, frozen in time.

One reason I built hashcards: by using a Git repo of Markdown files as the flashcard database, you can trivially publish your deck to GitHub. My own flashcard collection is public. I hope that more people use hashcards and put their decks up on GitHub.

The point is not that you can clone their repos (which is close to useless: you have to write your own flashcards) but because I’m curious what people are learning. Not the broad strokes, since we all want to learn thermo and econ and quantum chemistry and the military history of the Song dynasty and so on, but the minutiae. Why did you make a flashcard out of this Bible passage? Why does it resonate with you? Why do you care about the interpretation of that strange passage in Antigone? Why did you memorize this poem?

Your Dotfiles

Computers mediate every aspect of our lives, yet most people use their computers the way they came out of the box. At most they might change the desktop background. Some people don’t even change the default icons on the macOS dock. Even most Linux users just use the stock configuration, e.g. GNOME on Fedora or whatever.

I’m interested in people who customize their experience of computing. This is often derided as “ricing”. But agency is interesting. People who remake their environment to suit them are interesting. And I am endlessly curious about how people do this. I like reading people’s init.el, their custom shell scripts, their NixOS config. It’s even better if they have some obscure hardware e.g. some keyboard layout I’ve never heard of and a trackball with custom gestures. I put my dotfiles up on GitHub because I imagine someone will find them interesting.

etc.

And beyond my selfish curiosity there’s also the Fedorovist ancestor simulation angle: if you die and are not cryopreserved, how else are you going to make it to the other side of the intelligence explosion? Every tweet, blog post, Git commit, journal entry, keystroke, mouse click, every one of these things is a tomographic cut of the mind that created it.

Some Blog Posts I’d Like to Read

Dec. 9th, 2025 10:31 pm
[syndicated profile] frontendmasters_feed

Posted by Frontend Masters Staff

  • I Chose {x} Framework For My Last Major Project and Here’s The Thought Process That Landed Me There
  • I Recreated the {x} Effect from {x}
  • Here’s Why Signals is a Useful Concept (and Three Practical Examples)
  • How I Use CI to Check For Accessibility Regressions on Every PR
  • How I Use CI to Check For Performance Regressions on Every PR
  • These Are The First Things I Do After Starting a New WordPress Projects
  • This Is Our Transactional Email Setup at Work
  • Here’s How I Made My Personal Website into a PWA
  • How To Use Custom Rules, Skills, and Artifacts to Make Claude Code Work Better on Your Project
  • Our Design System is in Figma and We The Figma MCP Server to Build Pages
  • Here’s 10 Things I Found Surprising When Learning {x}
  • I Build The Same App with Three Different Sets of Technologies — Here’s What I Learned
  • I’ve Hired Half a Dozen Developers This Year — This is What I Look For
  • The Story of the Last Three Dependencies I Removed
  • Here’s How We Do Code Reviews at {x}
  • The Trickiest Bug I’ve Ever Solved
  • I Maintain a CLI for Our Company, Here’s Three Interesting Things It Can Do
  • My Overall Testing Strategy for Customer-Facing Projects
  • A Friction Journal on using {x} for the First Time
  • How I Refactored Our Tooltips To Use Anchor Positioning
  • The Tricky Parts of Adding Realtime Editing Features to a Web App
  • Three Features That Baseline Makes It Looks Like You Can’t Use But You Really Can if You Embrace Progressive Enhancement
  • How To Safely Do Database Migrations in {x}
  • When {Deno/Bun} is a Better Solution than Node.js
  • A Walkthough of How Use Vite for a Custom React Site
  • The Tools We Use To Run Our Monorepo
  • How To Replace an SPA with Multi-Page View Transitions
  • How I Built a Fully Keyboard-Navigable Menu System
  • A Tour of our Icon System, From Figma to Customizable Components
  • Replacing a jQuery Widget with a Web Component
  • The Five Most Important Things We Use GitHub Actions For
  • How To Build a Useful Custom Linting Rule
  • Implementing Row-Level Security in {Database} for a Real Product

These are just some of a million potential ideas, admittedly with a slightly clickbaity flair to them.

Why would you write them? To solidify what you’ve learned. Writing does that very well. Plus it gives you a little industry cred, which is pretty darn useful when you’re on the career path.

Good things we’re always looking for authors.

Profile

mathemagicalschema: A blonde-haired boy asleep on an asteroid next to a flower. (Default)
schema

January 2019

S M T W T F S
   12345
6789101112
13141516171819
20212223242526
2728293031  

Most Popular Tags

Style Credit

  • Style: Midnight for Ciel by nornoriel

Expand Cut Tags

No cut tags
Page generated Dec. 14th, 2025 05:53 am
Powered by Dreamwidth Studios