guile-devel
[Top][All Lists]
Advanced

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

Re: Dotted pair call argument


From: Mark H Weaver
Subject: Re: Dotted pair call argument
Date: Tue, 21 Feb 2012 19:41:49 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

David Kastrup <address@hidden> writes:

>> Scheme has a very useful property which your proposed syntax would
>> destroy: any valid expression can be substituted for any other valid
>> expression, and the result has the same meaning except for the
>> substitution.
>
> guile> (display . (close (current-output-port)))
> #<primitive-procedure close>guile> 
>
> Now try
>
> (define x (close (current-output-port)))
> (display . x)

Admittedly I could have been more clear, but I certainly didn't mean to
imply that anything that _looks_ like a valid expression can be
replaced.  That would be absurd.

What I meant is that any _subexpression_ can be replaced with any other
valid expression, without changing the meaning of the program in any
other way.  Whether something is a subexpression depends on its
_position_ within the larger expression.

In (display close (current-output-port)), even if you write it
confusingly in dotted-tail notation, (close (current-output-port)) is
_not_ a subexpression, because it is not in subexpression position.

The only advantage I see to this proposed syntax is that in some
restricted cases it is more aesthetically pleasing.  I suspect that most
experienced Schemers have at some point wondered why dotted-tail
notation is not allowed in procedure calls.  I certainly have, but upon
further consideration I became convinced that the pitfalls of adopting
such an ambiguous and potentially confusing syntax far outweigh the
advantages.

    Thanks,
      Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]