-
Notifications
You must be signed in to change notification settings - Fork 37
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
Open discussion on renaming polars classes #149
Comments
FWIW, I agree that this is a useful change: I can imagine
The names above seem fine. End-users will almost never need to write those out, so the length is almost irrelevant. |
To clarify, does this mean that pl$DataFrame(a = 1:5, b = 1:5) would change to pl$PolarsDataFrame(a = 1:5, b = 1:5) ? Or that only the methods like |
@etiennebacher hmm good question :/ I really just wanna have the cake and eat it to :) long specfic class names, while short syntax. I hope it can make sense. |
I feel that changes should be made to some of the following.
As for the function names in R, I think it makes sense to keep |
I agree that is ideally best, but extendr does not currently support naming the R side and rust side differently. RDataFrame might look a bit strange on R side as the public class. On rust side it might not matter too much what the name is, just that it visually different from rust-polars class names e.g. DataFrame and Series. If we one day adopt S7 or extendr proc macros are updated, we can adopt RDataFrame and RSeries on rust side. |
It seems that extendr supports this. ( #[extendr(
r_name = "test.rename.rlike",
)]
fn test_rename() { } Edit: I checked and found that |
Related to extendr/extendr#553 and #253 |
Based on the discussion at #418, I think there is currently a consensus to adopt the prefix |
Where are we on this? #418 is closed so does that mean we can now rename all the classes |
We simply need to rename the Rust structs here, since it seems unlikely that that functionality will be added to the extendr. |
I suggest to prefix all polars classes
Polars
, examples would bePolarsDataFrame
PolarsSeries
PolarsDataType
Pros:
readability example of current naming: rust-polars
![image](https://user-images.githubusercontent.com/8015271/233480120-48175a53-81cb-451d-9151-14f4d6839a9e.png)
LazyFrame
in a wrapper struct namedLazyFrame
. This can be a confusing to read, also the compiler error can be confusing.Cons:
What naming do you (anyone) prefer/suggest? Should we rename? Prefixed RPolars?
Bonus info
(**the long footnote)
py-polars has 4 classes/structs from rust to python. DataFrame(rust-polars struct) -> PyDataFrame(wrapper struct) -> PyDataFrame (py03 internal class) -> DataFrame(py-polars public class). The vast majority of py-polars wrapper structs and wrapper classes are the thinnest possible.
r-polars only has 3 classes/struct from rust to python: DataFrame(rust-polars struct) -> DataFrame(wrapper struct) -> DataFrame(extendr class). The R side DataFrame class though have both a set of public methods and a private method set. An early version of r-polars had 4 classes like py-polars and was using R6. That led to more conversions needed at runtime, more boiler plate code, and class instances was no longer just an R type ExternalPtr. Also, I felt it was sometimes cumbersome to make R6 behave exactly like py-polars syntax. Instead I decided to just implement extra base R S3 generic methods for the already auto-generated extendr-classes and add public method functions.
The text was updated successfully, but these errors were encountered: