Giter Club home page Giter Club logo

Comments (10)

batpigandme avatar batpigandme commented on August 28, 2024 1

FWIW expr() is more meaningful at a glance than build() is to me at least. build_expr() would kind of capture both, though I don't know that it's a great function name. There are also some mental namespace collisions with build() in terms of R/RStudio commands (surmountable obstacles for sure), but just putting that out there… Again, not a function name, but I somehow think of it more as constructing than building (which πŸ™„, yeah, they're basically synonyms).

Also possible that my mental model is just totally wrong, since you blew my mind yesterday with the enquo() expr() thing.

from tidyeval.

hadley avatar hadley commented on August 28, 2024 1

I think if we decide to change the names, we need to design some sort of experiment so that we can validate that the new names are actually easier for people to understand. I know that @gvwilson would be very happy to help out with this sort of experiment.

from tidyeval.

lionel- avatar lionel- commented on August 28, 2024 1

Going with the defusing / booby trap analogy:

expr() -> defuse()
enquo() -> arg_defuse()

defuse() prevents evaluation of your own expression. arg_defuse() prevents evaluation of a function argument.

defuse() seems to go well with blast():

dfs <- list(mtcars[1:2, 1:4], mtcars[3:4, 1:4])

defuse(rbind(!!!dfs))
#> rbind(<data.frame>, <data.frame>)

blast(rbind(!!!dfs))
#>                 mpg cyl disp  hp
#> Mazda RX4      21.0   6  160 110
#> Mazda RX4 Wag  21.0   6  160 110
#> Datsun 710     22.8   4  108  93
#> Hornet 4 Drive 21.4   6  258 110

from tidyeval.

lionel- avatar lionel- commented on August 28, 2024

That's similar to the naming scheme we had in earlier versions of rlang. Some thoughts:

  • Probably not worth renaming eval_tidy() which is a very specialised function.

  • We should probably steer away from thetidy_ prefix. If the goal is autocompletion you'll find many disparate functions in that namespace.

  • I worry that it's too late to change the names and having two sets of names + friendlyeval is going to make things more complicated.

from tidyeval.

lionel- avatar lionel- commented on August 28, 2024
  • I like how build() suggests it's building a more complex expression. If we go for build() then we'll have to embrace the quote() / build() dichotomy as in lisp.

  • Instead of capture, could be auto_quote() and auto_quote_list().

from tidyeval.

lionel- avatar lionel- commented on August 28, 2024
delay_action(arg)    # enquo()
delay_variable(arg)  # ensym()

as_name(delay_variable(arg))
as_label(delay_action(arg))

from tidyeval.

lionel- avatar lionel- commented on August 28, 2024
action <- delay_action(arg)
action <- expand(mean(!!action, na.rm = TRUE))

from tidyeval.

hadley avatar hadley commented on August 28, 2024

Why do you prefer delay_ over capture_?

One reason might be to pick an antonym for eval() and delay() + advance() is more evocative than capture() + release()

from tidyeval.

lionel- avatar lionel- commented on August 28, 2024

I was thinking about delay_ and resume(). I'm considering whether explaining NSE in term of delaying of computation may be more intuitive for beginners.

  • Sourcing an R file triggers a series of computation, getting results after results. If a function suspends that process of computation, it gets the blueprint of the computation instead.

  • Why suspend? In order to resume computation with the blueprint in a different context (the user's data).

I think "delaying" instead of "quoting" or "capturing" is more suggestive of why we need to quote. If users understands why, they are more likely to remember what to do the next time around.

The next step is to understand how to change blueprints. It's easy to change results, but to change a blueprint we need !!. That's the surgical operator that allows you to modify a blueprint. When you're dealing with code as text, the surgical operator is %s or { }. When you're dealing with code as blueprint, it's !!.

Finally, what are blueprints made of: variables (symbols) and actions (function calls). Though I'm not entirely happy with delay_action() because that suggests it always returns calls, just like delay_variable() always returns symbols.

from tidyeval.

gvwilson avatar gvwilson commented on August 28, 2024

Funnily enough, I was just discussing this with Andy Stefik...

from tidyeval.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.