Comments (7)
A very minor thing, but it would be great if list(a = 1,)
work just like list(a = 1)
:D
from r.
A very minor thing, but it would be great if
list(a = 1,)
work just likelist(a = 1)
:D
Done!
This was a stealth feature, even to me! I only discovered that I baked it in last time it was mentioned over on mastodon. However, I never went back and updated this issue to document it.
One point of contention here is whether to allow arbitrary numbers of empty arguments (list(,,,,,b = 3)
or x[, 2]
). Still not sure if empty arguments are desirable as meaningful call arguments generally. The only place where I think this really has impact is for axis indexing. Personally, I found R's x[,2]
syntax much more confusing at first than python
's df.loc[:, 2]
and julia
's df[:, 2]
which both at least have some argument, but that might just be a matter of which language I encountered first. Ultimately they're all expressing the same idea, and R's is definitely the most terse.
from r.
If I may add a little more to the wishlist, having sub-modules / sub-packages would also be something that I would appreciate quite a bit :)
Yeah, I think this will be a nice-to-have. For a long time I've felt like the inability to nest packages is actually a powerful feature that forces the minimal scoping of packages and splitting them into more focused sub packages. However, what I've come to appreciate is how hard it is to develop packages that are inter-dependent (similar to the tidyverse
). I think there might be a best of both worlds in here where a package can take a dependency on only a sub-package without taking a dependency on the whole set (Depends: tidyverse::dplyr (>= 1.0.0)
).
In that sense, the tidyverse
style meta-package becomes a more formalized construct, allowing for the release of a cohort of related packages without the overhead of necessitating all of them to be used together.
There's tons to consider in here that warrants its own issue when we get to that point. If you're passionate about the considerations involved here, I welcome the initiative to get the planning and design started.
from r.
If I may add a little more to the wishlist, having sub-modules / sub-packages would also be something that I would appreciate quite a bit :)
from r.
I would definitely like to work on this, but I would first try to get a better understanding of the code-base! I like the idea of making a "universe" a formalized construct. I am working on a project (mlr3) that is also a collection of dependent R packages and I know some of the troubles related to that, e.g.:
- package A has a non-exported function f that I want to use in package B, but I don't want to export it in package A for regular users.
- I want to make a change in package A that will break package B, therefore I either have to synchronize new releases of package A and B or have to do some additional releases that are compatible with different versions.
- Where exactly should integration tests live?
- Dependency management
Maybe one could use rust's idea of a workspace for inspiration.
from r.
To put another item on the agenda: I think the list()
datatype in R
is currently somewhat overloaded, as it is being used both as a standard (unnamed) list but also as a dictionary (when it has names). Unfortunately it does not ensure that names are unique, and stuff like list(a = 1, a = 2)$a
is definitely a source of bugs and something that should not be possible imo.
It might be a good idea, to define this a bit more rigorously and possibly split the list()
datatype into a dict()
and a (unnamed) list()
, what do you think?
from r.
Also, should partial argument matching still be allowed?
Some arguments against it:
- It can lead to unexpected behavior (at least how it was implemented in R), let's say I have a function with signature
function(..., sep = " ")
and I call this function withf(s = "a")
, thes
will partially matchsep
, which is definitely not something that I would expect. - Code might break when additional arguments are added to a function: Let's say my function has signature
f(first, second)
and I call it withf(fir = 1, sec = 2)
, but then the functionf
gets an additional argumentf(first, second, fir = NULL)
. If I keep calling the function withf(firs = 1, sec = 2)
, this will lead to different results. - We don't have to partially match arguments to parameters each time a function is called (this might be negligible though)
Some argument in favour:
- it saves some typing
Still, I think the amount of typing that is saved (this should actually not really make a big difference when having proper autocompletion) is not worth the disadvantages.
from r.
Related Issues (20)
- Bug due to some lingering evaluations HOT 2
- Capture invalid syntax HOT 3
- print does not work in the demo repl HOT 1
- for loop should *maybe* return `null` HOT 5
- Bug when assigning to vector subset HOT 1
- Forcing closures should update environment
- Tracking promise expression for substitute HOT 4
- Proposal: partial function evaluation HOT 1
- Object shared references architecture HOT 3
- Allowed Vector Subsets during assignment HOT 2
- Heuristics for materializing vectors HOT 1
- List declaration using paren syntax doesn't force promise evaluation
- Internal Character representation should maybe use `Rc<String>` instead of `String` HOT 1
- 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 4
- 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
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.