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

Re: #\a octothorpe syntax vs SRFI 10



 | Date: Sun, 02 Jan 2005 20:58:16 +0000
 | From: Matthias Radestock <matthias@xxxxxxxxxx>
 | 
 | campbell@xxxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
 | >
 | > By the way, how does the proposed array syntax relate to
 | > quasiquotation & syntax-rules?
 | 
 | Good point!  Arrays would not have the same status as lists and
 | vectors unless the quasiquotation and syntax-rules pattern/template
 | syntax&semantics were extended to deal with them.

Strings are first class objects in Scheme yet they don't support
UNQUOTE, eg. ",state ,zip USA".

Heterogeneous vectors support UNQUOTE because the elements of vectors
can contain reference to expressions.  Homogeneous-vectors would not
easily support UNQUOTE.  From SRFI-4:

   Homogeneous vectors can appear in quasiquotations but must not
   contain unquote or unquote-splicing forms (i.e. `(,x #u8(1 2)) is
   legal but `#u8(1 ,x 2) is not).  This restriction is to accomodate
   the many Scheme systems that use the read procedure to parse
   programs.

Similarly, heterogeneous arrays could support UNQUOTE; but uniform
arrays would not easily do so.

That vectors can support UNQUOTE-SPLICING is a fortuitous consequence
of their having only one row, whose length is thus unconstrained.  The
rows of multi-row arrays must all be the same length; supporting
UNQUOTE-SPLICING would require some heavy lifting.

Does this same analysis apply to Scheme macros?

 | One also needs to consider the general implications of adding new
 | types of literals to the syntax.  It requires the extension, or at
 | least careful examination, of any code that treats programs as
 | data.  Given that the programs-as-data philosophy is one of the
 | hallmarks of Scheme, there is a lot of code in current use that
 | would have to be extended/examined.

That criticism applies to nearly any change to the language, syntactic
or not.  R6RS is coming; let's get multidimensional-arrays on board.

 | ... there are significant complications in writing portable
 | programs-as-data code that works both Schemes with and without the
 | literal extensions in question.

That is why SRFI-47, which is entirely portable, is separate from
SRFI-58.

 | To make matters worse, unless the new literal syntax is part of the
 | core standard (as vectors are, but arrays are not), ...

My efforts are directed toward making multidimensional arrays part of
R6RS.  Multidimensional arrays have been an integral part of computing
since before electronics.  A general-purpose computer language without
multidimensional arrays is an oxymoron.