[Rd] capture "->"

Dmitri Popavenko dm|tr|@pop@venko @end|ng |rom gm@||@com
Sat Mar 2 15:05:07 CET 2024


On Sat, Mar 2, 2024 at 1:31 PM Duncan Murdoch <murdoch.duncan using gmail.com>
wrote:

> You can't change the parser.  Changes like `+` <- `-` change the
> function that is called when the expression contains a function call to
> `+`; this happens in `eval()`, not in `parse()`.  There are never any
> function calls to `->`, because the parser outputs a call to `<-` with
> the operands reversed when it sees that token.
>

Another idea would have been to use "=>", which is disabled by default:
> substitute(A => B)
Error: '=>' is disabled; set '_R_USE_PIPEBIND_' envvar to a true value ...

> Sys.setenv(`_R_USE_PIPEBIND_` = TRUE)
> substitute(A => B)
Error in substitute(`=>`(A, B)) :
  invalid use of pipe bind symbol (<input>:1:0)

The quest is to obtain a valid expression to get past substitute(), but it
proves to be more difficult than I initially thought.
Dmitri

	[[alternative HTML version deleted]]



More information about the R-devel mailing list