Eric Kow <ko...@darcs.net> writes: >> I really do think that the "darcs replace" in its current form is too >> dangerous to use, because absolutely nothing has the exact lexical >> structure assumed by it. > > The word "dangerous" made me sit up for a moment. Then I realised you > were using a broader definition of dangerous than I am. My stricter > sense of 'danger' here means 'uh-oh we have to change the Darcs core' > which does not appear to be the case here. > > Are you at least convinced that darcs replace is safe in the sense that > it is simple/predictable?
No. Here's an (untested!) example: suppose a user runs darcs replace --token '[^,]' 1000 1024 foo.csv they will run into trouble when one day Darcs tries to commute this against a hunk patch like hunk ./foo.csv 1 +number,description +512,"Unlike 10,100,1000, this is a power of two." Because even in this relatively simple markup format (comma-separated values), there is escaping which darcs replace CANNOT. As a result, darcs replace will behave in its unintuitive (but admittedly well-defined) manner. The resulting file will unexpectedly begin with: number,description 512,"Unlike 10,100,1024, this is a power of two." In short, my concern with darcs replace is that it can *appear* to work, but bite you on the arse years later -- when there are too many dependent patches to do anything about it. > Is that convincing enough? Because if we only have to change the > default token spec in the replace command, that's easy. It's my opinion that the current approach of tokenizing everything into two tokens (ATOM or FOLDING WHITESPACE) is FUNDAMENTALLY inadequate, that we should discourage its use, and that long-term we should either remove it or replace it with something more complicated and unwieldy. Consider two other trivial examples: sexprs and mexprs. The former has several tokens: OPEN PAREN, CLOSE PAREN, FOLDING WHITESPACE and ATOM. You can't reduce this to simply ATOM and FWS, because then "(+ foo)" would be two atoms, "(+" and "foo)", separated by whitespace. Similarly with the latter, a two-token ATOM and FWS approach would treat "x+y" and "x-y" as tokens, making it impossible to replace "x" unless atoms, operators and parens are religiously separated by FWS. > Basically, I'm "happy" if once we have a replace patch it does exactly > what it says it will do 100% predictably. I think replace does what it says. I just don't think what it says is what a reasonable man would *think* it says. _______________________________________________ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users