[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: multiple variable reference, etc.



>by symmetry, i think that
>
>        $(x y z)
>
>should be equivalent to
>
>        $x $y $z

Erik> Why? All this seems to be way out on the fringes of the language and
Erik> really does not contribute to the overall structure of es.  (Perhaps
Erik> I've missed something here?) Therefore, I think that in the interest
Erik> of simplicity (and the interest of not creating [sic] dark corners), I
Erik> think that this idea should be abandoned.

[ Erik had also not seen the postings correcting Paul's $foo to $$foo,
  but I informed him privately so I won't touch on that part of his
  message here. ]

I don't think this is way out on the fringes, and what's more, I think
it's actually pretty well mandated by earlier decisions.  Let me
explain.

One of many guiding principles of software design is the Principle of
Least Astonishment: The program shall do what will least astonish the
user.

If this principle is accepted then it follows with necessity that
whatever can be put on the lefthand side of an assignment can also be
expanded.  So if we allow the user to say

	magic words = fee fie foe foo

then we must also allow the expansion $(magic words).  It doesn't
really matter that the user might as easily say $magic $words here,
for the expectation to be allowed the former form is there, and it's
well founded.  Besides, there are lefthand sides of the form
$lots-of-words to consider.

If we had thought of this back when multiple assignments were first
considered, I would say that this would be an argument against adding
multiple assignments, albeit a weak one (and one unlikely to have
convinced me, at least).  But by now, I would say our (Paul's) hands
are forced, and this feature simply must be added, unless you want to
go back and reopen the debate on multiple assignments.

Hopefully the feature will not complicate the implementation of es
much -- I wouldn't think it should.

- Harald

PS.  The Principle of Least Astonishment should be used with some
care: It must be assumed that the user is reasonably well informed.
For example, the novice Bourne shell user, having learned that the :
command does nothing at all, might well be astonished to learn that

	: `rm -fr *`

will indeed delete all his files, while it is the opposite behaviour
that would more astonish a more seasoned user.

Apart from all that, I suppose that HAL 9000 might be said to violate
the principle in great style... :-)