From g@bembecker @end|ng |rom gm@||@com  Mon Apr 13 10:23:21 2020
From: g@bembecker @end|ng |rom gm@||@com (Gabriel Becker)
Date: Mon, 13 Apr 2020 01:23:21 -0700
Subject: [Rd] detect ->
In-Reply-To: <CABtg=KmifDz6DbufPoBX0j4Suepm3pG6K=6PoPHJ4cCXAVYafg@mail.gmail.com>
References: <6DB118E2-8C9A-4C5D-BC82-12B689C872FF@gmail.com>
 <CABtg=KmifDz6DbufPoBX0j4Suepm3pG6K=6PoPHJ4cCXAVYafg@mail.gmail.com>
Message-ID: <CAD4oTHFUe+W+bBtC-e9uhOGkJUMTV317xPETXS+7iW-v9m7iNg@mail.gmail.com>

Adrian,

Indeed, this has come up in a few places, but as Gabor says, there is no
such thing as right hand assignment at any point after parsing is complete.

This means the only feasible way to detect it, which a few projects do I
believe, is process the code while it is still raw text, before it goes
into the parser, and have clever enough regular expressions.

The next question, then, is why are you trying to detect right assignment.
Doing so can be arguably useful fo linting, its true. Otherwise, though,
because its not really a "real thing" when the R code is being executed,
its not something thats generally meaningful to detect in most cases.

Best,
~G

On Mon, Apr 13, 2020 at 12:52 AM G?bor Cs?rdi <csardi.gabor at gmail.com>
wrote:

> That parser already flips -> to <- before creating the parse tree.
>
> Gabor
>
> On Mon, Apr 13, 2020 at 8:39 AM Adrian Du?a <dusa.adrian at gmail.com> wrote:
> >
> > I searched and tried for hours, to no avail although it looks simple.
> >
> > (function(x) substitute(x))(A <- B)
> > #A <- B
> >
> > (function(x) substitute(x))(A -> B)
> > # B <- A
> >
> > In the first example, A occurs on the LHS, but in the second example A
> is somehow evaluated as if it occured on the RHS, despite my understanding
> that substitute() returns the unevaluated parse tree.
> >
> > Is there any way, or is it even possible to detect the right hand
> assignment, to determine whether A occurs on the LHS?
> >
> > Thanks in advance for any hint,
> > Adrian
> >
> > ?
> > Adrian Dusa
> > University of Bucharest
> > Romanian Social Data Archive
> > Soseaua Panduri nr. 90-92
> > 050663 Bucharest sector 5
> > Romania
> > https://adriandusa.eu
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



[Rd] detect ->
Gabriel Becker