iqis / q7 Goto Github PK
View Code? Open in Web Editor NEWFreestyle Object Oriented Programming in R
License: GNU General Public License v3.0
Freestyle Object Oriented Programming in R
License: GNU General Public License v3.0
`$.extend(object_a, object_b)
https://github.com/r-lib/evaluate
keeps comments, formats, etc.
use utils::getParseData()
or {xmlparsedata}
to....handle binding modifiers? Warn erroneous/harzardous implements? Explore.
Locks all bindings, but not the envir itself, so new bindings can be added.
myThing <- myThing %>% immutable()
option to lock only functions?
put into .private$.s3
Birds generally fly. Turkey doesn't.
Mammals generally don't fly. Bat does.
canFly()
feature can be added to Bat() and not be added to Turkey()
Use portable()
to attach package scope to class's parent env chain.
myThing <- portable(type(function(a, b){
add <- function() a + b
}))
## or
myOtherThing <- function(){
value <- 1
} %>%
type() %>%
portable()
if ...s3 = "Foo" then the S3 class of the type would become Foo_type
.
This fully differentiates type and object created from the type, but how does this affect features applied to a type?
It seems magrittr
is not used in the function bodies. Shall it be moved to Suggests:
?
Line 17 in d17ee96
That calls the print()
method of an object.
require(Q7)
BaseType <- type(function(a){
b <- 1
f <- function(){
a + b
}
})
bt <- BaseType(2)
bt$f()
ExtendedType <- type(function(b){
extend(BaseType)(b)
g <- function(){
b
}
})
et <- ExtendedType(3)
et$b #1
et$f() #2
et$g() #1
Users may have assumed of the opposite.
retain class after using extend()
-- also, rename extend()
?
offer a feature()
/implement()
friendly way to manipulate S3 classes.
One <- type(\(.){
.my <- Two(.)
}, s3 = "One")
Two <- type(\(.){
value <- 2
}, s3 = "Two")
One("foo")
One("foo")$value
## NULL
Create an environment in the class obj's attr.
Refer to this envir with active bindings in the public/private envirs of the obj.
Despite the potential hazard, pay no regard to the consequence of envir serialization now.
the name is appended to the "feature" attribute of the main obj.
May I ask why this definition is OK
size <- Q7::type( function(size){ }, s3 = "ggsd.size")
x <- size(1)
But below definition result in error.
type_size <- function(size){ }
size <- Q7::type(type_size, s3 = "ggsd.size")
x <- size(1)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.