This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alternative array syntax


Per Bothner <per@bothner.com> writes:

> Now I happen to think one *should* view arrays and vectors as functions
> and use function-call-syntax, so I'm comfortable with this.  But it's
> not in the Scheme mainline, which doesn't seem to believe in inheritance
> or an overloaded collections framework.

I'm not sure there is a scheme mainline.  I do think Shriram
Krishnamurthi and possibly other PLT people objected to the idea on the
ll1-discuss list some time ago.  They are naturally concerned with
confusing newbies, and allowing more values in the first position may do
that.  Confusion already arises from being able to put either syntax or
a function in the first position.  But for people who use Scheme for a
while it's not confusing, and actually elegant and understandable.  To
the compiler functions vs syntax is two radically different evaluation
scenarios, but to humans it's all (verb obj ...).

To be clear, I don't think arrays and vectors should be viewed as
functions; I merely think they should be allowed in the first position
as functions are, with the semantics one would expect.  Yes there will
be people occasionally confused as to why they can't pass arrays to
higher-order functions that expect procedures as arguments, but that
cost is worth the benefit.

> The practical downside (in
> addition to increasing the temptation to write non-portabl code) is that
> some errors may be caught later, and some code written without type
> declarations will be harder to optimize.

Extensions that don't increase the temptation to write non-portable code
are not useful.

To me, the Scheme way is simplicity for the user first, simplicity for
compilation or other static analysis second.  A simple paren-oriented
syntax could likely be understood on first reading, and could be written
without looking in a manual.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]