17

It's clear enough that product names should not be formatted as code. What about package names? To me, this feels like a corner case not clearly addressed in When should code formatting be used for non-code text?.

Fish Below The Ice's and ChrisF ♦'s answers do not mention package names. They say code formatting for non-code should be used sparingly, give a few examples where that can be useful, but leave open the possibility of other appropriate uses.

According to Raedwald's answer, code formatting can be used for "any other string that a computer would recognize". I can see package names as strings that a computer recognises: they can be copied and pasted after a apt install, npm install, Install-Package, ... command.

Is that enough to make it okay to use code formatting for them?

Context: I've had an answer edited to use code formatting for a package name. It looks weird to me personally, but I cannot quite figure out why. I do not know if I should leave it or roll it back.

1
  • 3
    I'm a little indifferent to this one, as long as it's not littered all over the place and is intended for a bit of highlighting. Having said that, editing a post to change this (and only this) I would probably reject.
    – DavidG
    Commented Jun 15, 2018 at 14:15

2 Answers 2

17

IMO, it's "okay" to use code formatting for package names, but only that. It shouldn't be compulsory, or something that bothers an editor so much that they feel compelled to edit an answer only, or primarily, to add that formatting in, when it's not appearing in the context of actual code (this includes commands). And when it's used, it shouldn't bother an editor so much that they feel a need to remove it.

If it bothers you, you may roll it back. If it's your answer and you feel that it's infringing on your writing style (as you said, it looks weird to you personally), I wouldn't entertain any attempts by the editor to justify their edit because as an editor there are far more significant and clear-cut cases for them to fuss about.

FWIW, even I'm not consistent in my use of code formatting when representing package names — mostly because they come in different forms (reverse DNS, simple word-like strings, etc) and I have a habit of matching the formatting in the question.

3
  • Thanks for your answer (and to duplode). I'll wait a bit to see if anyone wants to post an answer that disagrees with this, but if not, I'll probably accept this and roll back the edit.
    – user743382
    Commented Jun 15, 2018 at 7:37
  • To expand on this, for the engine [Unity3d], which uses Entity-Component systems where the "Entity" is GameObject. But it is possible to speak about game objects in a non-code mannar, so I do not use backticks, even when calling those objects GameObjects unless the post is specifically referring to the GameObject class or type. The same would extend to other types of code: commands (npm install), packages, etc. if it's being refereed to in a code-like manner, backticks. Commented Jun 15, 2018 at 16:22
  • It's inherently tough to be consistent about how to format package names because the package publishers are themselves inconsistent. Some authors are very careful to use "attractive" and consistent capitalization when the package is referred to in prose (in other words, the "product name" scenario that OP said was clear enough) while using computer-recognized capitalization (typically all-lowercase) when it appears in an installation command or import statement. Other authors are willy-nilly about capitalization in prose (and perhaps in code as well if the language is case-insensitive).
    – John Y
    Commented Jun 15, 2018 at 16:37
6

I've had an answer edited to use code formatting for a package name. It looks weird to me personally, but I cannot quite figure out why.

I would put it down to a tendency to blur the distinction between package names and library names through metonymy (it is not unlike when we talk about drinking a glass of water). In most cases, when I say "Control.Lens.Wrapped is a module from the lens package", I am utterly indifferent with respect to the possibility of saying "Control.Lens.Wrapped is a module from the lens library" instead. Furthermore, not using code formatting for package names underlines that the package does not belong to the same domain of entities that manifest themselves in the code I am writing.

That said, the "string that a computer would recognize" point of view is defensible, especially if the discussion is about software distribution or package management, rather than actual usage of whatever the package provides. That being so, I agree with BoltClock's stance on both styles being acceptable, and on the ultimate decision in this case being up to you.


Personally, I don't use code formatting for package names, unless I'm literally talking about arguments to be passed to something like apt install, or about strings to be inserted into a configuration file. To distinguish package names from the surrounding text (which can improve readability, especially when the package names look like regular words), I use italics, borrowing the convention used for book titles. (I see quoting a snippet of library source code as being analogous to quoting a passage from a book.)

You must log in to answer this question.