Re: [darcs-devel] Darcs and git: plan of action
- From
- Ray Lee <ray-lk@madrabbit.org>
- Date
- Apr 20, 2005, 01:11 UTC
- Message-ID
- <1113959503.29444.91.camel@orca.madrabbit.org>
- In-Reply-To
- <426594F9.4090002@tupshin.com>
Thanks for your patience.
On Tue, 2005-04-19 at 16:32 -0700, Tupshin Harper wrote:
> >Give me a case where assuming it's a replace will do the wrong thing, > >for C code, where it's a variable or function name.
Show 12 quoted lines
> try this:
> initial patch creates hello.c
> #include <stdio.h>
>
> int main(int argc, char *argv[])
> {
> printf("Hello world!\n");
> return 0;
> }
>
> second patch:
> replace ./hello.c [A-Za-z_0-9] world universeAha! Okay, I now see at least part of issue: we're using different definitions of 'token.' Yours is quite sensible, in that it matches the darcs syntax. However, I'm claiming a token is defined by the file's language, and that a replace patch on anything but a token as per those language standards is a silly thing.
In your example, I'd claim you did an inter-token edit, as the natural token there was "Hello world!\n".
With that, let me restate what I think is possible.
One should be able to discover renames (replaces) of user identifiers in C code programmatically. Is that everything darcs replace does? Obviously not. Is that what users would usually *want*? If I were using it, that's what I'd want (especially including the limited scope of replacement -- user identifiers such as variable or function names, etc.). But then I'm not a lurker on the darcs user list, so I don't know how usage of darcs replace plays out in actual practice.
So, it's a subset. Is it a useful subset? Yes, as it addresses what happens during refactoring, which is when I'd usually see this getting used. (Syntactically ignorant search and replace is so, y'know, *1970s*.)
Any clearer?
Ray