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 might be having a dumb day but today after looking over my code I ran into a meaning issue with my own syntax, and the comments explaining that syntax...something I've never actually thought about until I decided I need to be clearer to myself, as this application gets larger and larger and I'm the only maintainer on this project...so here is the question.

If I were to say merge hash1 with hash2 what would that mean to you? Would it be more proper to simply say "merge hash2 into hash1" since this is what I actually mean? I'm not the the only one reading this so I want to be as clear as possible to people who aren't programmers what exactly is going on.

For anyone who wants elaboration on entities:
hash1 = {a: "default", b: "default", c: "default"}
hash2 = {a: "new", b: "new"}
Where in this case hash2 is being merged into hash1 so that hash2 overrides hash1.
For anyone who doesn't program, think of it as two lists, list2 merging into list1.

share|improve this question
1  
You might benefit from elaborating on the context of use, e.g. what are the entities that are being merged? –  N.N. Oct 7 '11 at 12:05
    
I've elaborated it for you. –  Jordon Bedwell Oct 7 '11 at 12:12

4 Answers 4

up vote 4 down vote accepted

As a programmer (American) I agree you need to clarify your comments in the code. When I can't understand my own comments (and it has happened), I'm in big trouble.

I would expect merge A with B to give a result that contains all the elements of both A and B, but it doesn't tell me if the result is in A, B, or C. Merge A into B tells me that B will end up gaining anything from A that wasn't already in B.

In your specific case, I would say update hash1 with hash2 because you are modifying hash1 by ensuring that it contains the data from hash2.

It would probably be beneficial to use more than four words because someone else may eventually maintain the code and explicit comments will be greatly appreciated.

share|improve this answer
    
This is what I was thinking too. I should clarify it the way you're thinking and state "merge hash2 into hash1" because it's in-place so there is never going to be a c and even though a programmer would see that right off the bat, average-Joe wouldn't... so it sounds like this is what I should do, use into rather than with so it implies that b is going into a. –  Jordon Bedwell Oct 8 '11 at 7:22

In the context of your question, it would be (at least to my logic) merge hash2 into hash1. When you start with hash1 as the base, merge hash2 into that then hash2's entries take precedence should there be a duplicate.

This is a slightly different process from concatenation, which describes end-to-end linking — so hash2 would follow directly after the end of hash1.

Or perhaps this is actually what you have in mind? Given if you were merging hash1 and hash2 lists it's probably programatically simpler to concatenate multiple hash*n* files then parse the whole thing linearly.

share|improve this answer

You've answered your own question. When something you're not saying is "what you actually mean", you should say that instead!

"Merge hash2 into hash1".

share|improve this answer

When you say merge with I imagine that to mean that there will be portions of each input in the output. When you say merge into it suggests that the output will be very similar to one of the inputs, with some differences that were inserted from the other input.

share|improve this answer

Your Answer

 
discard

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

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