jinzhu / copier

Copier for golang, copy value from struct to struct and more
MIT License
5.58k stars 490 forks source link

Should Copy's arguments be reversed for consistency with io.Copy? #1

Closed rce closed 11 years ago

rce commented 11 years ago

The io.Copy function in the standard library is of form io.Copy(dst, src) but your Copy function is Copy(src, dst). Should it be changed?

That would break existing code though.

jinzhu commented 11 years ago

I think no one would export all method from package io and copier at the same time with this:

import . "io"
import . "copier"

And even someone are doing like this, he will get compile error!

So of course, no existing code would be break.

rce commented 11 years ago

That's not what I tried to say. I was saying that the destination, source order of parameters would be more idiomatic because of the consistency with io.Copy's parameters.

jinzhu commented 11 years ago

Sorry, I didn't read you comment carefully... ;(

Yes, you are right. it would be a better to change the order.

Just did it hope won't affect any others due to the breaking change ;(