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

Re: [Scheme-reports] Proposed new SRFI for immutable lists



On Wed, 3 Sep 2014 17:39:12 -0400, John Cowan <cowan@x> said:

> Michael Montague scripsit:
>> I suggest that immutable pairs should use the same names (cons, car,
>> cdr, pair?, etc) as mutable pairs. A programmer can control which
>> implementation of pairs they use in a particular module using import.

> That's exactly what I thought when I started this effort, but after
> all, some Schemes don't have modules, so I figured I'd just go with the
> minimal name changes.  So I wrote a script to refactor all the names in
> the code (a few names of local variables got missed, I think), wrote a
> bunch of tests, and started debugging.  I figured it would be a doddle.

> Only not.

> What I wasn't thinking of was that the mechanism of procedures with
> arbitrary numbers of arguments, of which SRFI-1 and SRFI-116 have many,
> involves the use of lists, not ilists.  In Racket, ordinary Scheme
> lists were immutable and there was no problem.  But to make the code
> work in Chicken and Chibi, where I do most of my development, I had to
> scrutinize all of the converted code for map and for-each and many other
> routines in order to decide when I was dealing with immutable lists and
> when with mutable argument lists.

  I think the general case, or one general
  case, is like this.  A program (or
  library) uses libraries A1, A2, ...,
  which process and return structures made
  of mutable pairs, as well as libraries
  B1, B2, ..., which process and return
  structures made of immutable pairs.
  Therefore, the program must use both
  kinds of procedures, possibly within the
  same expression.  I think some practical
  experience with this kind of programming
  is necessary before being able to say
  what are the most significant issues in
  this area.

  ---Vassil.

-- 
Vassil Nikolov | Васил Николов | <vnikolov@x>

"Be careful how you fix what you don't understand."  (Brooks 2010, 185)

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports