0

Consider the following sentence:

This function takes/accepts/expects integer for the first parameter, not string.

Should I use "as" in place of "for"? Any other way around?

  • 4
    Your context is an unusual "domain-specific" one, that doesn't have very well defined syntax. What you actually want to say could be more "correctly" expressed as Function foobar() takes / accepts / expects the first parameter to be an integer, but that's a bit more "wordy" than "nerdy". Your severely cut-down syntax is common enough for your exact context (perhaps including an before integer to get a bit closer to "standard syntax"), but it's not really "proper English", and it won't teach you much about how to use English naturally in any other contexts. – FumbleFingers May 9 at 13:00
  • @FumbleFingers Correct me if I'm wrong. Proper English is the one spoken by native speakers (a lot of, or most of). If a lot of native speakers change their habits, so changes the definition of proper English. Right now it's not generally accepted that my phrasing (save for the articles) is proper English. It might become, or it might not. Is that correct? By the way, I believe you provided an alternative phrasing only for "expect." You can't possibly say, "takes the first parameter to be an integer." – x-yuri May 9 at 13:26
  • Consider a less "domain-specific" technical context where you might think about using essentially the same syntax: This elderly airline passenger expects woman for the flight attendant, not man (or female / male instead of woman / man). That's certainly not likely to become an "acceptable" construction in my lifetime, but I suppose feasibly it might do so within yours (especially if you're quite young and/or they invent immortality in the next few decades! :) – FumbleFingers May 9 at 13:59
  • ...in which context I'll just say that although I don't usually agree with Will Self on political issues, I certainly wouldn't question his command of English. And he was perfectly happy to write The law of the car is that it takes diesel, not petrol (but arguably the speaker there is being slightly "facetious", since the usage is at least slightly "weird"). – FumbleFingers May 9 at 14:08
  • 1
    There's some justification for saying that "headlinese" does in fact have its own peculiar (cut-down) "syntax", but I don't really think you can extend that concept to comments that programmers write in or about code. That is (and probably always will be) an area where nobody particularly knows or cares about "correct syntax" - so long as the text is reasonably intelligible, that will usually be seen as "good enough". Honestly, it's not an area you should devote any significant effort to, as a learner. – FumbleFingers May 9 at 15:03
2

Even in technical writing, this sounds odd, or at least, not written by a native English speaker. Such things may have become commonplace, but that doesn't mean they are correct.

At the very least I would put quotes around the terms that are to be read as something other than their usual definition.

This function takes "integer" for the first parameter, not "string".

Still, this is needlessly awkward. It's better with the articles:

This function takes an integer for the first parameter, not a string.

Or be explicit:

The first parameter of this function must be an integer, not a string.

Either way, unless you're just trying to fill up space in a technical paper, why describe it at all? Technical documentation for programmers just defines the types in the description of the function, as in a Javadoc, so there is no confusion at all:

public void someFunction (Integer firstParameter, String secondParameter)

(Edit) A commit message usually talks about what has been added or changed, rather than simple documentation:

Changed the first parameter of someFunction to be an Integer instead of a String value.

  • That was an error on my part to miss the articles. Does it sound okay with them? Like proper English? Written by a native speaker? Then, why describe it? That was meant to be a commit message telling that type of the parameter changes. I could come up with a more schematic way of conveying that, but that would be not necessarily better. – x-yuri May 9 at 21:36
  • @x-yuri Oh, ok. it sounds fine with the articles. I'm not sure it's appropriate for a commit message. but that's a discussion for Stack Overflow. – Andrew May 10 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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