From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <4FDD3B61-CA0D-446E-A05B-204B4866D755@fastmail.fm> From: Ethan Grammatikidis To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Tue, 4 May 2010 11:01:24 +0100 References: <455f59971ace96897640df2bff497ce3@kw.quanstro.net> Subject: Re: [9fans] du and find Topicbox-Message-UUID: 199582e0-ead6-11e9-9d60-3106f5b1d025 On 3 May 2010, at 19:34, Jorden M wrote: > On Mon, May 3, 2010 at 10:53 AM, erik quanstrom > wrote: >>> It's always been easier for me to use python's/perl's regular >>> expressions when I needed to process a text file than to use >>> plan9's. >>> For simple things, e.g. while editing an ordinary text in acme/sam, >>> plan9's regexps are just fine. >> >> i find it hard to think of cases where i would need >> such sophistication and where tokenization or >> tokenization plus parsing wouldn't be a better idea. > > A lot of the `sophisticated' Perl I've seen uses some horrible regexes > when really the job would have been done better and faster by a > simple, job-specific parser. > > I've yet to find out why this happens so much, but I think I can > narrow it to a combination of ignorance, laziness, and perhaps that > all-too-frequent assumption `oh, I can do this in 10 lines with perl!' > I guess by the time you've written half a parser in line noise, it's > too late to quit while you're behind. I think it's ignorance and something. I'm not sure what that something is. I am sure if you tried to suggest writing a parser to many of the open-sourcers I've talked to you would be treated as if you were suggesting a big job rather than a small one. "Why Write a Parser," they would ask, "when I can just scribble a few little lines of perl?" Maybe it's humans' natural tendencies toward hierarchy coming into play. Stuff known by Teachers and Masters easily takes on a bizarre kind of importance, rank is unconsciously attached, and the student naturally but unconsciously feels he is not of sufficient rank to attempt the Master's Way. That explanation does pre-suppose humans have a very strong natural tendency to hierarchy. I find sufficient evidence within myself to believe it's true, as unpopular as the idea may be. Perhaps some people are more strongly inclined that way than others. Anyway, it's the only explanation I can imagine for the phenomena. > >> >> for example, you could write a re to parse the output >> of ls -l and or ps. but awk '{print $field}' is so much >> easier to write and read. >> >> so in all, i view perl "regular" expressions as a tough sell. >> i think they're harder to write, harder to read, require more >> and more unstable code, and slower. >> >> one could speculate that perl, by encouraging a >> monolithic, rather than tools-based approach; >> and cleverness over clarity made perl expressions >> the logical next step. if so, i question the assumptions. >> >> - erik >> >> > -- Simplicity does not precede complexity, but follows it. -- Alan Perlis