Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3/S4-based wrappers around R6 classes for more R-like API #48

Open
keller-mark opened this issue Aug 22, 2023 · 5 comments
Open

S3/S4-based wrappers around R6 classes for more R-like API #48

keller-mark opened this issue Aug 22, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@keller-mark
Copy link
Owner

keller-mark commented Aug 22, 2023

From discussions with @pieterjanvc the non-R6 API would be much more natural for the R ecosystem

@keller-mark keller-mark added enhancement New feature or request good first issue Good for newcomers labels Aug 22, 2023
@dblodgett-usgs
Copy link
Collaborator

+1 to this

Consider the RNetCDF API pattern where you pass an open object to a function that works with it.

e.g. open.nc() returns an nc object and you pass that object to functions like att.get() or var.put() etc.

@dblodgett-usgs
Copy link
Collaborator

@keller-mark -- here's what I've got cooking.

https://code.usgs.gov/wma/nhgf/geo-data-portal/rnz/-/tree/develop

The README there shows the basics of what it does so far.

I am going to get a copy of that repository public at: https://github.com/DOI-USGS/rnz and will do the rest of the development on a dirty main branch but there's a bit more paperwork to get cleared before it's done.

@dblodgett-usgs
Copy link
Collaborator

I implemented:

#' Returns results of listing the store
#' 
#' @param x a pizzar Store object 
#' @export
names.Store <- function(x) {
  x$listdir()
}

And a side affect that is kind of unfortunate is:

> class(store)
[1] "DirectoryStore" "Store"          "R6"  

image

Not sure what the UX of working with these classes really should be, but I'm not sure that R6 and S3 should really coexist based on this?

@mdsumner
Copy link

might be some relevance in the new S7 on your questions here (if you haven't seen that): https://blog.r-project.org/2024/05/17/generalizing-support-for-functional-oop-in-r/index.html

@dblodgett-usgs
Copy link
Collaborator

I need to sit quietly with some examples of how to implement subsetting and assignment. @keller-mark -- do you feel like the implementations of bracket methods in zarr-array.R are the way they should be or were those just a starting point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants