From: Robert Dober Date: 2007-02-08T16:16:57+09:00 Subject: Re: Patterns of semantic contradictions? ------=_Part_17370_16129926.1170919015050 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/8/07, ara.t.howard@noaa.gov wrote: > > On Thu, 8 Feb 2007, Robert Dober wrote: > > > hmmm. hard to say without context, but i generally squirm at any regex > that > has neither anchors nor uses the positive, rather than negative - eg i > prefer > > pathname =~ %r| IMG [^/]+ \.jpg $ |iox that is very good advice in practice and it is also an excellent example for my dilemma. Redundancy (just imagine for the sake of argument that your regexp is redundant in the space of strings it is applied to, which normally it is not of course) is a very good thing sometimes. Your regexp tells the reader that you definitely do not want to match "IMGS001/draft.jp" which might be pretty good for readability and extensability, even if there are no such strings. "a".gsub(/a/,"A") might have the same autocommenting effect in some contexts, but it might be confusing too, I guess the team needs to talk about this kind of ambiguity (think larger scale than the fun example please). What I was (or rather develop to be) up to is if there is a categorization of such things (on much a larger scale, sry if I repeat myself). When we implement patterns, sometimes we refactor. When we do this do we not in some way look for Antipatterns to transform them into Patterns? I would love to know more about that approach if it exists which I do not really doubt, gotta ask Google too ;) to > > pathname =~ %r/ IMG.*jpg /iox > > > because it's can't sweep down path separators. > > interesing thread... thx :) -a > -- > we can deny everything, except that we have the possibility of being > better. > simply reflect on that. > - the dalai lama > > Cheers Robert -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous ------=_Part_17370_16129926.1170919015050--