algebaric operations on a RegEx?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Apr 15 14:10:57 UTC 2009


On Tue, Apr 14, 2009 at 06:06:30PM -0400, S P Arif Sahari Wibowo wrote:
> Maybe this can be helped a bit if there is a way of many of those 
> language developer to agree on 1 common intermediate code to compile to.

There likely isn't one common code that would work efficiently and
correctly for all languages.

> I liked that fine, and indeed I programmed in Perl mostly using one way I 
> consider the right way (being Object Pascal developer in the past); and 
> generally I would like Python if not for its requirement to use 
> indentation to delimit statement blocks. I just cannot stand it to the 
> degree I wanted to smash something when I tried it.

I used to not like that indentation thing either, but I do now.
The change is when I realized that with braces, you can write code that
works correctly, but looks completely wrong based on the indentation.
In python, code must behave is it appears it will behave.  It prevents
you from making things confusing by missing a brace somewhere and putting
it the wrong place.

ie:
sub foo() {
	my i=10
	while(i>0) {
		if($i>5) {
			print "$i\n";}
			$i--;
			if($i>7) {$i=$i-3;
		}
	print "Looping\n";
	}
}

If you look at it, it is clearly badly indented, but perl will still
be happy with it.  Python simply won't permit such things to happen.
If will do what it looks like it will do.  Given the amount of code
that looks like line noise already in perl, not noticing an oddly places
brace can become quite easy.

> I like Ruby, just wishes its grammar was designed better (ideally fit 
> into LL(1)/LALR(1)), so it is easier to develop a fast parser / 
> interpreter / compiler; and wishes there is only 1 way to define 
> parameterized code block (instead of 3).

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list