## "of integer type" vs "of type integer"

9

3

It seems to me that it is grammatical to write

1. The variable x is an integer.

or

1. The variable x is of integer type.

1. The variable x is of type integer.

?

It does not sound incorrect to me.

2I think in example 3, you'd want to put single quotes around 'integer', or set it off with italics. I would do the same with example 2, though it doesn't feel as necessary there. #3 is a very common usage among scripters/programmers, but usually with integer set off typographically. – spoko – 2018-02-21T23:36:31.403

@spoko -- integer is often set off typographically by putting it in a fixed-width font. (Many tools for editing programming source code use fixed-width fonts.) Many web sites (including most StackExchange sites) use fixed-width fonts to identify text that is included in programming source code verbatim. – Jasper – 2018-02-21T23:56:16.020

2There is an underlying rule here that has to do with with types generally. We see similar phenomena in biological classification, for example. – Tᴚoɯɐuo – 2018-02-21T23:58:04.797

@spoko: I agree that it's common among programmers, but almost always, it will use the keyword (int) rather than the full English name (integer). Depending on OP's programming language, integer may actually be the keyword. – Flater – 2018-02-22T09:27:03.760

35

Neither of the sentences is incorrect, but they have slightly different meanings in technical context.

The variable x is of type integer.

This sentence indicates that the variable is specifically of type integer - that is, the type name in the language is exactly that. Usually it'll refer to either a 32- or 64-bit wide integer type depending on the platform. Also I agree with @spoko in the comments that integer will usually be typeset to distinguish it from the rest of the sentence, or put in quotes.

The variable x is of integer type.

This sentence, however, indicates that the variable type is of some integer (as in, capable only of holding whole numbers) type. This might be int/integer, but it could also be a byte, short, or whatever type your language defines.

The variable x is an integer.

This sentence is somewhat more general - if we understand "the variable" as referring to its value (a common, if not always correct, technical shorthand), it might mean that the variable is of an integer type, or that it's of a fractional type that happens to hold an integer at the moment.

1The third sentence (in your answer, not OP's question) could also occur in mathematics, while the first two are pretty exclusively computer science jargon (mathematics doesn't tend to talk about "types" nearly as much as computer science does). – Kevin – 2018-02-22T03:43:02.700

5or that it's of a fractional type that happens to hold an integer at the moment Slightly disagree here. The phrase is "The variable x is an integer.", thus referring to the variable, not the value contained within. If the phrase were "The value of (the variable) x is an integer.", I'd be more inclined to agree. – Flater – 2018-02-22T09:29:14.993

The 3rd sentence is usable in math, but considered very vague in CS. Think of weakly typed languages, like PHP. You can assign a string \$s = '3'; of course, it can be correctly used in numerical comparsions, because it is an integer, although var_dump outputs it as string. – rexkogitans – 2018-02-22T11:00:28.977

2@Kevin There is an entire branch of mathematics (type theory) devoted to assigning types to values (primarily to avoid various paradoxes in set theory). This doesn't invalidate your observation that types aren't common in most branches of mathematics, though. :) – chepner – 2018-02-22T15:17:00.573

-1

This is mostly a convention in technical writing. I expect there should be a colon between "type" and "integer" to explicitly show that this is a name/value pairing, but most writers will leave it out.

If you declare the variable to be of type: integer you have to be careful of buffer overflow.

You will find many such artifacts in this kind of writing. Technical writers like short, choppy sentences focused on facts and with little "decoration".

16I have been working in computer science and software engineering for decades, and that colon makes no sense to me. – David K – 2018-02-22T04:36:35.393

@DavidK I've been working in the same industry the same length of time. Perhaps we read different technical manuals. – Andrew – 2018-02-22T06:02:22.473

5Can you give an example of a technical manual that uses a colon in that way? – David K – 2018-02-22T08:34:45.867

@DavidK: The only related syntax I can think of is Typescript, where method parameters are declared as myParam : string. Which still doesn't quite match type: integer. In OP's phrase, "type" is used semantically (in English), not declaratively (as a programming language), so I agree that the colon makes no sense in this context. – Flater – 2018-02-22T09:33:00.580

4@Flater Pascal uses that notation too (function Foo(bar: Integer): Integer or var baz: Integer), and might have borrowed it from earlier languages. In more modern terms, UML uses that notation as well. The type declaration notation name: type certainly dates much farther back than Typescript. However, I don't think I've ever seen it used to emphasize a name/value pair in ordinary running prose, as Andrew seems to suggest. – a CVn – 2018-02-22T13:30:14.150

2To be honest, if I were editing such a document, I would remove such a colon as being more harmful than helpful. It might work if you have it within code formatting, but even then it would appear (to me) as more than a little hammy — ultimately all you've done there is add decoration. Why not use the common and varyingly-accurate expressions described by Maciej? – Lightness Races in Orbit – 2018-02-22T14:21:14.607

4@MichaelKjörling Yeah, that's a syntactic construct found in programming languages, not something you would see in English. – chepner – 2018-02-22T15:18:23.717