Take the 2-minute tour ×
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It's 100% free, no registration required.

I am trying to document some code and this sentence sounds confusing.

Replaces the existing item associated with the provided key with newItem.

I am tempted to put a comma here but I am not sure if it would be correct.

Replaces the existing item associated with the provided key, with newItem.

If it's incorrect, how can I state my intention clearly?

share|improve this question
    
Having the worth "with" twice is your problem. –  New Alexandria Sep 27 '12 at 4:20

2 Answers 2

up vote 5 down vote accepted

I would write:

Replaces the existing item, which is associated with the provided key, with newItem

Replaces the existing item, associated with the provided key, with newItem.

And if the key is something that's common between the two items, then you could say something like this:

[With the provided key it] replaces the existing item with newItem.

Or

Replaces the existing item with newItem based on the provided key.

share|improve this answer
    
I like your Option 2, and the O.P. may even want to consider using dashes: Replaces the existing item – associated with the provided key – with newItem. –  J.R. Sep 16 '12 at 12:15
    
@J.R. Yea, I think that sounds better. –  Noah Sep 16 '12 at 12:35
    
+1 I think this is what it is. Though rephrasing would be definitely better. –  Kris Sep 16 '12 at 13:14

I think you may have been looking at it too long. I see what you mean, but a comma doesn't add anything. My suggestion is to either simply italicize newItem as in:

Replaces the existing item associated with the provided key with newItem.

or change it to something like:

Replaces the provided key's currently associated item with newItem.

share|improve this answer
    
NB: You don't need a hyphen between currently and associated. You're linking an adverb with an adjective, not two adjectives to a noun. The adverb modifies the adjective, not the noun. –  Robusto Sep 16 '12 at 12:25
    
@Robusto removed. –  cornbread ninja 麵包忍者 Sep 16 '12 at 12:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.