moodymudskipper / nakedpipe

Pipe Into a Sequence of Calls Without Repeating the Pipe Symbol.
69 stars 7 forks source link

side effects #4

Closed moodymudskipper closed 4 years ago

moodymudskipper commented 4 years ago

A consequence of the implementation of https://github.com/moodymudskipper/nakedpipe/issues/2 is that we can use magrittr's %T>% if we need to.

Maybe we can do better though.

The first idea is probably the wisest one, let's not inject too much weirdness.

... I think I really like the last one though....

moodymudskipper commented 4 years ago

pipeR uses ? in a clever way, but it's limited to printing.

I was hesitant to use ? after using and abusing it in doubt and tb though.

Also ? looks like a question, and if I want to plot or save, it s not really a question anymore

-- has precedence issues though, so we d need to deparse and create an overhead, or to make sure we respect that precedence.

~~ is safe in that regard, but looks a bit scarier for some reason.

moodymudskipper commented 4 years ago

went with ~~, assignment ops are given special treatment to deal with precedence. It looks good with syntax highlighting.

~~ is not supported in %..%, not sure if it should

moodymudskipper commented 4 years ago

Note that {expr; .} works perfectly fine for most side effects, (not assignments except <<-).

So I'm not even sure if we should bother, assigning mid way through a pipe is not great practice, and if it's in interractive use <<- would work fine.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.