moodymudskipper / tag

Build function operator factories supporting the tag$function(args) notation
GNU General Public License v3.0
13 stars 1 forks source link

on chaining / composing adverbs #9

Closed moodymudskipper closed 5 years ago

moodymudskipper commented 5 years ago

One thing that makes it nice, even though it's not technically systematic, is that a lot of time composed adverb will act independantly, thus the order in which they're applied is not important.

This frees cognitive load : this$that$f(args, this_args, that_args) is saying that we apply two modifications, and the arguments forwarded to the right act "at the same time" (from the point of view of the user).

It's nice if the code tells you that the order of actions doesn't matter, typically code doesn't show that.

This cannot really be enforced but maybe there's a distinction to make for adverbs that "behave well" in this context, i.e. they do one specific thing that doesn't overlap with other adverb that behave well. An adverb like purrr::safely changes the structure of its output, and thus doesn't really behave well here, and it indeed it is awkward, it doesn't just "safely" do something, it changes the function's output structure, which is not a very "adverbial" thing to do.

even purrr::safely can be composed with many adverbs where order that wouldn't matter though.

Maybe we can say explicitly that it's bad practice to chain adverbs when the order of application of these adverbs is important, as adverbs are easier seen as applied on the original behavior than on an already modified behavior ?

This should be worded carefully, a user who knows what they're doing can still use "directional" composition of adverbs.

moodymudskipper commented 5 years ago

In short : include one sentence or two on order of adverb composition. Not urgent.