Comments (7)
This would mean, however, that there is an additional indirection because currently the list directly contains Expr
and would then contain Obj::Expr
. we might want to make List
generic.
from r.
Yeah - that's certainly one concern I have. Representing ExprList
as List<Obj>
means that we need to do some dispatch on the Obj
enum (or maybe in the future, trait
) even though we know that every element is a Expr
. For something as central as the language AST, this would definitely make it annoying to program around and perhaps come with a small performance hit.
We might be going off on an abstraction detour, but we could also handle List
s as heterogenous Vector
s and ExprList
as another homogeneous Vector<Expr>
to avoid the dispatch and clean up the internal api for working with the AST.
from r.
We might be going off on an abstraction detour, but we could also handle
List
s as heterogenousVector
s andExprList
as another homogeneousVector<Expr>
to avoid the dispatch and clean up the internal api for working with the AST.
Yeah, I was already wondering this for the List
, let's see how easy that refactor is.
from r.
If we represent List
as Vector<Obj>
, we would thereby also solve #105, so maybe this is the right call.
from r.
We might be going off on an abstraction detour, but we could also handle
List
s as heterogenousVector
s andExprList
as another homogeneousVector<Expr>
to avoid the dispatch and clean up the internal api for working with the AST.
Maybe this then also means that we have to refactor Vector
from an enum
to a Vector<T>
generic. Thereby we could then conveniently use Vector<Expr>
for ExprList
and Vector<Obj>
for List
, while still not mixing ExprList
, List
and the other atomic vectors too much in the code base.
If you think this is a good idea, I can give this a try.
from r.
@dgkf Before I invest time in this it would be great to get your feedback on whether you would be okay with refactoring the Vector
enum into a generic Vector<T>
. This would mean that the Obj::Vector
variant would become Obj::Character
, ..., Obj::Double
.
I think it would allow us to solve #105 (comment), which is on the v0.4 milestone
from r.
Fundamentally I have no issue with testing it out. I think we should be able to go this route even if we kept the current Obj::Vector(Vector::{Double,Character,..})
as well as Obj::List(List)
where List
is just a type alias for Vector<Obj>
.
I lean toward this style because it will make it easier to differentiate Scalar
and Array
types when we get to those. If there are other benefits, then just be mindful to consider how data with different dimensions should be represented in the Obj
enum.
And just regarding the milestone - I tried to tag things that looked realistic, but regardless of what makes the cut I plan to do the release in the next days. Since I don't think this is a realistic timeframe for this feature, I'm going to bump this one to 0.4.1
from r.
Related Issues (20)
- Ellipsis is exposed through evaluation environment of functions HOT 5
- Suggestion: ability to wite tests in R HOT 2
- Bug when mutating promise HOT 5
- Suggestion: Abandon named Lists in favor our Hashmaps with value semantics HOT 14
- use a different hash function for environments HOT 2
- quote drops parenthesis HOT 2
- Bug when function is passed an expression that contains an assignment HOT 2
- The derived debug implementation will fail for anything that can reach the builtin environment
- Cannot assign list to list-slice
- General call assignment HOT 2
- Syntax suggestion to create vector of ints HOT 4
- ParserError when combining negation and vector indexing HOT 2
- Suggestion for sequence (`:`) operator to require `lhs <= rhs` HOT 1
- Ensure consistency of operations with respect to `Inf`, `NA`, `NaN` HOT 5
- Proposal: new vector representation `RepType::Closure` HOT 9
- Should `NA` be a valid value for subsetting HOT 5
- Indexing with negative values is not supported yet
- Fall cleaning pass ideas :fallen_leaf: :broom: HOT 2
- Use `phf` for primitive function lookup
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r.