[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Prefix, not postfix
On 4/13/06, Philippe Meunier <meunier@xxxxxxxxxxx> wrote:
Marc Feeley <feeley@xxxxxxxxxxxxxxxx> wrote:
>1) I prefer prefix syntax, e.g. (button :text "OK" :action quit)
>2) I prefer suffix syntax, e.g. (button text: "OK" action: quit)
>3) I don't care
As an example of a procedure that looks especially nice with suffix
syntax, here is SEND-MAIL from the Hato mail server:
Okay, this post is a bit lame since the last message in this thread was
posted over a year ago, and I only read it because of the finalization
announcement on comp.lang.scheme. However, I want to express my opinion on
this matter anyway, since a couple of points didn't seem to be mentioned
explicitly in the discussion.
Alex' example with suffix:
(send-mail From: "Dr. Watson <guest@xxxxxxxxxxxx>"
To: "Sherlock Homes <not-really@xxxxxxxxxxxxxxxxx>"
Subject: "First Report"
Body: "Moor is gloomy. Heard strange noise, attached."
Attachments: '((File: "howl.ogg")))
Alex' example with prefix:
(send-mail :From "Dr. Watson <guest@xxxxxxxxxxxx>"
:To "Sherlock Homes <not-really@xxxxxxxxxxxxxxxxx>"
:Subject "First Report"
:Body "Moor is gloomy. Heard strange noise, attached."
:Attachments '((File: "howl.ogg")))
I think prefix is better, for the following two reasons:
1. Its faster to spot the colon when its at the start of a word: "Aha!
the first character is a colon, the characters following the colon
constructs a keyword."
2. Vertical alignment. "send-mail"'s arguments consists of a bunch of
keywords+argument pairs, where the first coloumn is keywords and the
second is arguments. This is easier to spot with prefix because all the
colons are vertical aligned.