Phrase Usage – Is ‘Prefixed By’ Correct?

phrase-usage

When I write the following sentence, the grammar/spelling checker running on my Mac always suggests me to use prefixed to or prefaced with.

Functions implemented by a module should always have their names prefixed by the module name.

What I mean is that, if the module name is user, the function name should not be load(), but user_load().

Is it correct to use prefixed by, or should I use another phrase?

Best Answer

Both prefixed to and prefixed by are correct, but they have different meanings.

If A is prefixed to B, A is the prefix and B is what the prefix is added to. In this case the end result is A_B. To use your example, you could say that user is prefixed to load() to create user_load().

If A is prefixed by B, B is the prefix and A is what the prefix is added to. The result is B_A. For your example, you would say that load() is prefixed by user to create user_load().

To state this in more general terms for your entire project, you might make either of these statements:

Each method name related to the user object is prefixed by the string user.

The string user is prefixed to each method name related to the user object.

And concerning the sentence in your question:

Functions implemented by a module should always have their names prefixed by the module name.

It is indeed correct, because the suffix (function name) is prefixed by the prefix (module name).