JosiahParry / rsgeo

R bindings to the geo Rust crate
https://rsgeo.josiahparry.com/
Other
47 stars 5 forks source link

Add a common prefix to functions? #45

Open etiennebacher opened 4 months ago

etiennebacher commented 4 months ago

I don't really use this package (I just like following the development of Rust-based packages) so feel free to dismiss this comment, it just came to me when I saw the new geom_line in the NEWS of 0.1.7.

I see that you have some functions that would conflict with ggplot2, e.g. geom_line(), geom_polygon(). I like the API of sf that has all its functions starting with sf_, st_ or gdal_, it makes it easy to discover functions and works well with autocomplete. Maybe you could take advantage of the fact your package is relatively young to add a prefix rsg_ to most functions?

On the other hand, one could say that you could replace the rsg_ prefix by rsgeo::.

JosiahParry commented 4 months ago

I agree. There’s even an unexpected namespace collision with ggplot. It should t be a problem except for the fact that ggplot is a bit aggressive with its takeover.

I am opposed to repetitive prefixing for example writing geos::geos is redundant. st is useful in that it mimics PostGIS and is indicative of a spatial transformation.

I haven’t had time to revisit this R package but it was slated for archival today if I didn’t do anything. If you have any suggestions to improve the naming conventions, please let me know!

At minimum, the Geom struct needs to be renamed.

etiennebacher commented 4 months ago

st_ is useful in that it mimics PostGIS

I had no clue about that.

I am opposed to repetitive prefixing for example writing geos::geos_ is redundant

True, but having a common prefix would remove the need to write <pkg>::. If you'd rather prefix everything with rsgeo:: then I guess you don't need to rename anything since there won't be collisions?