2

I came across this sentence in The Rust Programming Language:

: calling the 'next' method on an iterator changes internal state that the iterator uses to keep track of where it is in the sequence.

It seems to me like the state needs an article in the main clause. On the other hand

I'm drinking a water that isn't sparkly.

sounds fine to me, even with the article omitted. Am I wrong in thinking the former case is grammatically incorrect? If not, what differentiates the two cases?

3
  • ? the method changes state that the iterator uses... I think you are right. Apr 19 at 14:04
  • It seems you can use state as a noncount noun with change when change is acting ergatively; that is, when something changes state, it does it to itself. A method can change state (change its state). A method can change the state of something else. But it can’t “change state” of something else. You need the article. And “calling a method” can’t change state at all (but it can change a state). Apr 19 at 16:25
  • If something isn't a sentence, then typically it's meaningless to debate whether it's grammatical. Your quote doesn't seem to be a sentence, because it doesn't start with a capital letter. It feels like note or bulletted list format, in which articles, auxiliaries, and other minor words are often omitted.
    – Stuart F
    Apr 19 at 21:09

1 Answer 1

3

The first example is, in fact, correct.

In computing, the word "state" can be used as a noncount noun. As the paper "The Importance of Students’ Attention to Program State: A Case Study of Debugging Behavior" explains:

State represents the idea, present in all programming environments, of a set of temporary or permanent variables that completely describe the current environment on which a program can act. This includes programmer-defined variables as well as other aspects of the runtime environment such as the current stack frame. Program commands change aspects of the computer program’s state and the process of writing programs involves developing sequences of state change operations to achieve a particular goal.

In this case, "internal state that the iterator uses" refers more specifically to the data in some set of mutable fields within the iterator.

9
  • And 'a water' might be construed as either non-count (from [a blinding light / a blinding sunlight?}: These nouns fail the 'no a/an' test for massness but pass the 'no numerals' test. Thus 'The state gave me a good education' but not ' ... two good educations'. 'I have an understanding of the principles involved' but not 'I have two understandings ...'. 'I felt a strange warmth' but not 'They felt two strange warmths'. ... or a countified usage (2 spring waters that I recommend ...). Apr 19 at 13:57
  • @EdwinAshworth "A water" can also be used to mean "a glass/serving of water," thus making it an ordinary count noun; see this ELL answer. You mostly see this in restaurant orders ("We'd like two waters"); I'm not sure if this is AmE-specific.
    – alphabet
    Apr 19 at 15:48
  • Predated by count vs mass ... and Can i use the word milks {noun}?. Apr 19 at 18:38
  • 2
    The noncount reading of "internal state" seem very forced to me. (I think it's because of the restrictive relative clause, but perhaps Tinfoil Hat is onto something, too.) If not explicitly ungrammatical, it's certainly something that I would have recommended the writer avoid. Apr 19 at 19:22
  • How does that explain the the method changes state that the iterator uses? I call typo. Here you can find the same piece of Rust code referred to in the OP’s example along with a description using an article in front internal state: The num_iter is made mutable because the next method used in the next few statements changes the internal state of the iterator. Apr 19 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.