This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Reader option to permit brackets as parentheses
I'm a bit puzzled as to how this works. Are the []'s semantically
identical to ()'s? In some old lisps the ] was used as a "super-paren"
that would close all open parens in the current form. IIRC they faded from
popularity when paren-matching editors came around. Can you give an
example where the [] syntax dramatically improves readability?
My gut reaction is that the only benefit is that you could see the grouping
a bit better. OTOH, if you want to go that route, why stop there? You
could have {}'s as well, and maybe user-defined paren-equivalents such as
#{ #} etc. etc.. Taken to its logical extreme, you have SGML. I tend to
think scheme is better off without them, but of course it would be fine as
a dialect handled by a separate parser a la CTAX. For that matter, it
would be interesting to have a dialect that used indentation as an
alternative for parens like python does.
Mike
> Chris Bitmead <cbitmead@ozemail.com.au> writes:
>
> <snip>
>
> > I fail to see how it makes more readable code. Apart from anything else
> > your code will look alien to every other scheme programmer on the
> > planet. Can that be more readable? It would also make writing the code
>
> This isn't at *all* true. LOTS of scheme programmers are brought up
> using instructional Scheme environments that permit [] as parentheses,
> and are accustomed to having certain constructs in [] instead of ().
>
> > more difficult. When to use a [] and when to use () ? You'll spend half
> > your day exchanging bracket types trying to make it more asthetically
> > pleasing. Write a text editor that does colour matching on parenthesis
> > or something.
>
> Clearly you aren't convinced, and I believe you're probably in the
> majority among this list's readers, but I've lately been teaching scheme
> in an undergraduate programming languages course here at the UW and the
> students definitely seem to like the ability to use [], and find my
> examples more clear when I reliably and consistently use [] in certain
> special forms (e.g., let bindings).
>
> Bottom line is I thought the option would be nice. I'd expect it to be
> pretty easy to verify empirically that programmers (especially novice
> ones) can better understand Scheme programs that use [] reliably and
> consistently. (And I hypothesize little harm by random use of paird []
> instead of () ).
>
> So... my lips are sealed until I either have time to run the experiment
> or can reference someone who has studied the issue empirically. :-)
>
> Greg
>