-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
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
function names #1
Comments
Having just looked at this package, I had the same thoughts, and I like the names @AliciaSchep suggests a lot. |
Hey Alicia, thanks for starting this issue! I like your suggestions. Particularly the use of 'input'. 👍 I've thought about 'bare' but I had trouble writing documentation I didn't find convoluted that explained the term, but I think it would be good to revisit that now. I'd be interested in seeing a version of the points under:
that reads clearly with 'bare'. I do feel bad about the long function names, but my thoughts on those were:
But it sounds like the feedback is: the bad feelings of a long function name aren't mitigated by these factors. In which case we do need to shorten them. |
Hi Miles! BTW came across this repo b/c the Runconference tweets made me wonder what cool stuff you were up to 😄 Re bare, I can see that it is a bit awkward of a term to document -- maybe On the function length, I don't think it is the length per se that is the issue (apologies for my lack of clarity above), but more the complexity and difficulty of parsing it in your head. |
I agree with @AliciaSchep, both in that this is a really interesting idea, and in that the primary challenge with the current function names is their cognitive demand rather than their length. I also appreciate your interest in leveraging autocomplete, but I wonder if perhaps you haven't gone far enough? One of the things I really like about
Then, the workflow could be something like, "I want to incorporate this |
Wow. This is great! I love this prefix idea. |
Glad you like it! Happy to look over documentation etc. too, if you think it'd be helpful. |
Yes help is welcome there. First of all thought I think the key section we need to nail using the new terminology is in README from
to
So I'm going to create a branch called I have two modifications I am considering to the
|
Okay so that was a lot easier than I expected! I'm think the results are a marked improvement. Still a couple of tiny things I feel weird about. Check out the |
One other thought about |
Agreed, these changes definitely make it easier to parse. Pluralizing the That's a good point, @AliciaSchep:
|
Looking at the README again, you describe all three of the |
Re: I'd be glad for counter examples, but I tried to come up with
|
I was just thinking it might be nice to have a 'Beyond Friendlyeval' vignette that has some |
I guess I don't quite understand how this is "Beyond friendlyeval" as the current first three functions enable passing expressions; it is just a question of the name of the function being reflective of what is being done. I would guess that for many functions that use Here is the first example that popped to my head, a modified filter_loudly <- function(x, ...){
in_rows <- nrow(x)
out <- filter(x, !!!typed_list_as_name_list(...))
out_rows <- nrow(out)
message("Filtered out ",in_rows-out_rows," rows.")
return(out)
} You would almost always be using an expression, e.g. Some of the patterns where I can image where you want to pass expressions:
|
One note -- with the help of autocomplete it was pretty easy to get to |
You're right, the functions allow it, but I was thinking that explaining things in terms of expressions might get too complicated. Especially since you can't pass expressions as values/strings for the last two. However, maybe I'm being too pessimistic about that. Sorry, I don't understand what you mean by the third bullet. For bullets 1 & 2, you're describing quite abstract/general functions - to even come up with those I think you need to have some sense of metaprogramming. I guess I had imagined most people who needed But if the explanation can be kept clear and direct and the examples concise there's no problem. |
Forgive me if this is a slightly wild idea, but it's Friday afternoon here. What if the list became something like:
So under the hood, some of these functions map to the exact same edit2: in which case maybe edit3: and maybe makes your intent clearer to yourself while you're muddling through? |
My initial reaction was adding more functions with the same functionality would make things unwieldy, but after thinking about it for a bit (and considering the advantages of auto-completion), this latest proposal is growing on me. It seems that the increased specificity would benefit the target audience. If you do go that route, I agree that |
I like that idea for the |
Yeah so for |
I'm feeling better about this choice since I have realised I overlooked the |
I think the I also suggest not using Furthermore it seems you're aliasing Finally I don't think "value" is a proper term when you're expecting a string. A value is the result of some evaluation and can be any kind of R object. |
@lionel- thankyou for your comments. It looks like I realised my Since I seem to be in the minority now on |
I do think the |
If it is just for auto-complete maybe you can use
|
In the documentation I've framed these functions as instructions to |
Then maybe you should not use How about |
To make this point clearer, I don't like the idea that programming is for people with computer science backgrounds. Loops, functions, higher-order functions like lapply, meta-programming, ... These are all things that scientists and analysts of any backgrounds can learn and be productive with. I also think they should be learned in this order which is why I appreciate your effort to make meta-programming accessible to people who didn't have time to get there (or never will because they don't have the interest). |
I agree with you on that very much! I also have great appreciation for the fact you have laid it out as a progression. I feel this is the way most people learn, but often when we teach, we don't respect that, and fail to layout a progression people can follow to higher proficiency. My sense of 'evaluate' is that most R programmers would be comfortable with this term. It comes up pretty early in programming life particularly around conditional statements. 'If this evaluates to true' etc. |
Still you know my position:
|
I agree that eval is misleading, and really like the prep suggestion! Even if folks are not familiar with the concept of eval, if this package is a gateway into rlang, they may soon be learning it... In that case, the names here could lead to some confusion and make it harder to get to that understanding. |
One reason I prefer So in my mind, the command isn't supposed to read 'evaluate this now', rather: 'here are instructions for evaluation'. I concede this distinction could easily be lost. For me, This is something I do feel strongly about: I'd like to keep the With that in mind, there are probably terms that would work within that constraint other than
Any other ideas? |
How about |
Bonus side effect: catchy tag lines like "Using |
👌👌👌 I like this a lot! |
Also, imagine the hexsticker potential... |
How about 'pass' |
Thanks Nick, as we discussed on the phone, I am quite taken with treat! I've created I really like how it looks and how it makes the explanations read. 👍 |
Agreed! I think the latest version of the README is very clear, both in motivation and execution. |
Seconded! 🎉 |
Good news! I've just merged the Biggest thanks go to @pkq for the rewrite of the README! I've added names of contributors from this thread to the DESCRIPTION. I haven't added emails, so make a PR if you would like me to add. Also let me know if you'd like to be removed. |
This package is a great idea! One thought -- I found the function names a bit confusing and unwieldy. Here are some ideas:
bare_input
bare_input_lhs
bare_input_list
string_input
string_input_list
It seems like
typed
is intending to mean a user typed it in... I think there is a clash with the "type" concept of having objects with a specified type. I'm not sure if "bare" is super clear either, but at least I don't think it has as much of a clash with another programming concept.For
value
, my sense is that this meansstring
in which case I thinkstring
is more clear but maybe I am not thinking about other possibilities...The
as_name
bit I think is a bit confusing because I think it leads to the question of "name of what?" even though it seems to be technically appropriate. It makes the function names super long too...These suggestions surely have flaws too, but wanted to get a convo going with some ideas 😄
The text was updated successfully, but these errors were encountered: