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

Re: Vectors as functions




Just to clarify, what exactly *are* you advocating?

For me, the problem with special function-like syntax for vectors is:

1) It's ad-hoc.  Could a user define this syntax him/herself?

2) I like having explicit vector-set! and vector-ref operations in case I
   wanted to write code that needed them.  I'm thinking of a map-like
   construct, although that won't work for vector-set! because it's a
   special form, but you could do similar things with a macro.  

   [Aside: I still don't understand why scheme has set! as a primitive
    special form instead of as a function whose first argument is a symbol.
    Ideally you'd have both, of course, but the latter seems more primitive
    to me.  IIRC the very first version of scheme had "set" as a function.]

If you keep vector-set! and vector-ref, and have a mechanism whereby users
could create syntactic shortcuts as described, then I'd be all for it.  IMO
syntactic sugar is VERY important in certain contexts; in fact, it's way
too important to be left to the discretion of language designers ;-)  That's
my beef against perl; it's not that all that syntax is useless, but it's
not something the user can define (except maybe in perl 6, which will have
everything...).

Mike

> From: Robby Findler <robby@cs.uchicago.edu>
> Date: Thu, 14 Aug 2003 22:36:13 -0500
> 
> At Thu, 14 Aug 2003 20:35:24 -0400 (EDT), mike@newhall.net wrote:
> >     I actually do agree that the special syntax of vectors probably helps
> > reduce bugs, but perhaps in a highly orthogonal language that would
> > not be a fundamental property.
> 
> One of the best things about this list is that people here realize that
> such purely theoretical concerns are not the only ones that matter.
> Also, it's not just the special syntax (altho it is very important) --
> it's also the fact that vectors cannot be confused for other types
> (either statically or dynamically); the abstraction is unbreakable.
> 
> Robby
>