Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!usc!apple!netcomsv!jls From: jls@netcom.COM (Jim Showalter) Newsgroups: comp.object Subject: Re: named parameters and verbosity [was: Functions without side effects] Message-ID: <1991Jun27.232437.19983@netcom.COM> Date: 27 Jun 91 23:24:37 GMT References: <130242@tut.cis.ohio-state.edu> <4888@osc.COM> <72893@microsoft.UUCP> <1991Jun21.013944.23970@netcom.COM> <20445@alice.att.com> <1991Jun26.001847.24239@netcom.COM> <1991Jun26.185707.26149@visix.com> <1991Jun27.052157.2291@visix.com> Organization: Netcom - Online Communication Services UNIX System {408 241-9760 guest} Lines: 42 >I agree (which may not be a surprise :)). Use of macro-defined and >enumerated constants is an important aspect of good coding style, in C >as in any other language. The difference, as I pointed out at the start of this thread-within-a- thread, is that in SOME languages the language designer is kind enough to supply the programmer with LANGUAGE constructs that directly support good coding style, and in others the onus is on the programmer. Thus, in the first kind of language the programmer has to go out of their way to defeat these mechanisms in order to degrade legibility, whereas in the latter kind of language the programmer has to go out of their way to work around the lack of such mechanisms. Human laziness, ignorance, and schedules being what they are, what do you think the default behavior turns out to be? Consider enumeration constants in C. Yes, very nice--very legible, helps a great deal during maintenance. I'm all for them. On the other hand, there are a lot of other languages that simply GIVE you enumeration types so you don't have to use good community hygiene in order to write readable code (even C++ has them...imagine that!). I was making a similar argument for formal parameter names and named parameter association when we veered off into this enumeration stuff. >One of the things I like about Common Lisp is the way it handles "keyword >arguments." In particular, you can often write functions that have a >useful mixture of implicitly and explicity labelled parameters. For example: > (make-array '(2 2)) >makes an uninitialized array (or perhaps one initialized to some default >value), while > (make-array '(2 2) :initial-contents '((1 2) (3 4))) >makes one with the specified initial contents, and so on. You might be amazed, but this is remarkably similar to Ada's formal parameter names, named parameter association, and default arguments, which I was discussing earlier in this thread. I guess there must be some consensus as to the value of such readability enhancers among language designers, huh? :-0 -- *** LIMITLESS SOFTWARE, Inc: Jim Showalter, jls@netcom.com, (408) 243-0630 **** *Proven solutions to software problems. Consulting and training on all aspects* *of software development. Management/process/methodology. Architecture/design/* *reuse. Quality/productivity. Risk reduction. EFFECTIVE OO usage. Ada/C++. *