ropensci / taxa

taxonomic classes for R
https://docs.ropensci.org/taxa
Other
48 stars 12 forks source link

Behavior of taxmap$func() vs func(taxmap) #19

Closed zachary-foster closed 7 years ago

zachary-foster commented 7 years ago

@sckott, currently, I have set up the two ways of calling functions to behave differently. Calling a function in the classical R way imitates traditional no-side-effects copy-on-change behavior by cloning the object before returning the changed clone version. For example, filter_taxa(ex_taxmap, 1:3) will not change ex_taxmap, but ex_taxmap$filter_taxa(1:3) will. Both return the modified ex_taxmap.

Do you like this convention, or do you think it will confuse users? I suspect that each user will pick the style of calling they like and stick to it for the most part.

sckott commented 7 years ago

I agree that any one person will likely stick to one way or the other.

I think we should stick with what you've done for now - we should get others to take a look at the entire package soonish and if there's a strong feeling about changes, we can talk about that then

zachary-foster commented 7 years ago

Sounds good

zachary-foster commented 7 years ago

Do we still want to have others weigh in on this? I can ask a few coworkers.

sckott commented 7 years ago

yeah, that'd be great

zachary-foster commented 7 years ago

Hey @knausb and @Tabima, would you mind weighing in on this if you have time? Thanks!

zachary-foster commented 7 years ago

Oh yea, and we would of course like to hear from @grunwald as well.

knausb commented 7 years ago

I think its great that you have engineered both behaviours! I think that will make the package approachable to those of us who have a more more 'base R' perspective as well as those who want the side effects version.

zachary-foster commented 7 years ago

Thanks for the feedback @knausb!

grunwald commented 7 years ago

I agree with all comments and support the dual approach.

zachary-foster commented 7 years ago

Think we can close this or do we want more input?

sckott commented 7 years ago

i think we can close

zachary-foster commented 7 years ago

Cool