From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from techfac.TechFak.Uni-Bielefeld.DE ([129.70.132.100]) by hawkwind.utcs.toronto.edu with SMTP id <2664>; Wed, 22 Sep 1993 08:53:01 -0400 Received: from dahlie.TechFak.Uni-Bielefeld.DE by techfac.TechFak.Uni-Bielefeld.DE id AA23786; Wed, 22 Sep 1993 14:52:33 +0200 Received: by dahlie.techfak.uni-bielefeld.de (5.0/tp.29.0890) id AA00848; Wed, 22 Sep 93 14:52:32 +0200 Date: Wed, 22 Sep 1993 08:52:32 -0400 From: malte@TechFak.Uni-Bielefeld.DE Message-Id: <9309221252.AA00848@dahlie.techfak.uni-bielefeld.de> To: rc@hawkwind.utcs.toronto.edu Subject: builtins and more If simplicity is often the same as useability, then let me remind you of the shift operator. Can there be a cleaner concept than the existing of list and variables ? And isn't * just another variable except for the property of being initialized at function invocation ? So how comes that shift cannot shift variables other than * ? Probably because in sh variables aren't lists. I find it much harder to remember to include some file to overload the shift functionality. Not talking about the additional security checking involved if a script may be executed by root. So consequently simplicity means enhancing the shift operators functionality. And even if you think this is false, have you ever thought about "x = ( 1 2 3 ) echo $x(0)" ? Why is $*(0) a special case ? Wouldn't it be cleaner to have another special variable for that ? And what about omitting shift ? Here's the sceleton of a function as a replacement for shift: fn shift { switch( $#* ){ case 0; echo cannot $0 >[1=2]; return 1; case 1; return 0; case *; n = ( 1 1 ){ while(){ echo $*($#n); if( ~ $#n $#* ) { break; } else { n = ( $n 1 ) } } } return 0 } } Instead of "shift" you'll have to type * = `{ shift $* } So, having raised all these questions: I think there is a very close connection between datastructures and algorithms on them. With the fundamental data- structure being lists, I miss the necessary operators (operations). About the performance of a backquote-style read: I have checked the difference between while(){ echo `{ /bin/echo true }} and while(){ echo `{ echo true }} on my favourite machine. It seems to me that the exec(2) is by far more expensive than the fork(2). So the backquote solution may be a good compromise between clearity and performance. Btw, I dimly remember Byron asked for a rc wish list sometime around Xmas. Wasn't this meant to be a request for possible improvements ? I mean, even changes to rc syntax and semantics ? Malte