Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site lumiere.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!alberta!ubc-vision!uw-beaver!tektronix!lumiere!davest From: davest@lumiere.UUCP (Dave Stewart) Newsgroups: net.unix,net.unix-wizards Subject: Re: Bourne shell modifications, past and future Message-ID: <1453@lumiere.UUCP> Date: Wed, 27-Nov-85 11:49:56 EST Article-I.D.: lumiere.1453 Posted: Wed Nov 27 11:49:56 1985 Date-Received: Fri, 29-Nov-85 07:56:55 EST References: <1943@gatech.CSNET> <10@druri.UUCP> <21@pixdoc.UUCP> <3@bbncc5.UUCP> <161@nitrex.UUCP> <122@rexago1.UUCP> <847@whuxl.UUCP> Reply-To: davest@lumiere.UUCP (Dave Stewart) Organization: Tektronix, Beaverton OR Lines: 38 Xref: watmath net.unix:6409 net.unix-wizards:15885 In article <847@whuxl.UUCP> mike@whuxl.UUCP (BALDWIN) writes: >I think providing *both* aliasing and functions is a misfeature! Why have >two inconsistent ways of doing the same thing??? > ... >Back to my first point: please don't implement something 2 or 3 times >in different ways! Functions subsume aliases very nicely, so chuck >aliases! The same thing could be said for the "for" "while-do" and "do-while" constructs in C. It can be proven that any of these can be subsumed by one of them - so why have all THREE ways of doing the same thing? Well, history for one thing and programmer convenience for another. That's why you provide both aliases and functions - aliases have a history (excuse the pun) in csh. Having both is more convenient. In ksh, aliases take on other roles as well: tracked aliases are as a replacement for the command hashing of csh. There are also a handful of aliases predefined upon shell invocation which (in a sense) provide the user with more things that look like builtins without actually adding more builtins. I think most people who have both aliases and functions available use aliases as command-name macros and shell functions like programming language functions. Well, the analogy isn't perfect, since one also has shell scripts to act as "functions", but I believe the concept is transferable. Do I want to chuck out macros because I have functions available? Heck no. Finally, there is a line in the ksh intro paper that reads, "Functions are more general than aliases but also more costly." Well, I guess that's implementation-dependant, but intuition would tend to support this, even when one considers that functions usually take up more text chars before being read. -- David C. Stewart uucp: tektronix!davest Unix Systems Support Group csnet: davest@TEKTRONIX Tektronix, Inc. phone: (503) 627-5418