We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Allow interfaces to extend other interfaces or existing R types, similar to inheritance in object-oriented programming.
Related to #3
interface()
extends
check_interface()
# Extend an existing interface Person <- interface("Person", name = "character", age = "numeric" ) Employee <- interface("Employee", extends = Person, job_title = "character", salary = "numeric" ) john <- implement(Employee, name = "John Doe", age = 30, job_title = "Developer", salary = 75000 ) # TODO: this needs more work # Extend an existing R type EnhancedDataFrame <- interface("EnhancedDataFrame", extends = "data.frame", metadata = "list" ) my_df <- implement(EnhancedDataFrame, data.frame(x = 1:3, y = c("a", "b", "c")), metadata = list(created_at = Sys.time()) )
R/interface.R
R/helpers.R
tests/testthat/test-interface.R
The text was updated successfully, but these errors were encountered:
dereckmezquita
No branches or pull requests
Description
Allow interfaces to extend other interfaces or existing R types, similar to inheritance in object-oriented programming.
Related to #3
Implementation Ideas
interface()
function to accept aextends
parameter.check_interface()
function to check properties from extended interfaces or types.Example Usage
Integration with Existing Codebase
R/interface.R
to handle theextends
parameter.R/helpers.R
to include extended property checking incheck_interface()
.tests/testthat/test-interface.R
for extension functionality.The text was updated successfully, but these errors were encountered: