relationship to SRFI-25
Per Bothner
(30 Jul 2015 05:30 UTC)
|
Re: relationship to SRFI-25
John Cowan
(30 Jul 2015 20:20 UTC)
|
Re: relationship to SRFI-25
Bradley Lucier
(31 Jul 2015 21:00 UTC)
|
Re: relationship to SRFI-25
Bradley Lucier
(26 Sep 2015 18:33 UTC)
|
Re: relationship to SRFI-25
Per Bothner
(27 Sep 2015 05:34 UTC)
|
Re: relationship to SRFI-25
Bradley Lucier
(28 Sep 2015 21:04 UTC)
|
Re: relationship to SRFI-25
Per Bothner
(28 Sep 2015 21:29 UTC)
|
Re: relationship to SRFI-25 Bradley Lucier (28 Sep 2015 21:54 UTC)
|
Re: relationship to SRFI-25
Jamison Hope
(28 Sep 2015 22:22 UTC)
|
Re: relationship to SRFI-25
Bradley Lucier
(28 Sep 2015 22:38 UTC)
|
Re: relationship to SRFI-25
Jamison Hope
(28 Sep 2015 23:20 UTC)
|
Re: relationship to SRFI-25
Bradley Lucier
(29 Sep 2015 06:03 UTC)
|
Re: relationship to SRFI-25
Jamison Hope
(29 Sep 2015 16:12 UTC)
|
Re: relationship to SRFI-25
Bradley Lucier
(30 Sep 2015 03:42 UTC)
|
On 09/28/2015 05:29 PM, Per Bothner wrote: > > > On 09/28/2015 02:04 PM, Bradley Lucier wrote: >> On 09/27/2015 01:33 AM, Per Bothner wrote: >>> >>> I think this has been mentioned before: the name >>> specialized-array-share! >>> should not end in a '!'. >> >> Perhaps, I don't remember the remark. >> >> Let me say what issue I was trying to address by adding "!" and you >> can offer some advice. >> >> I've generally thought that the bang "!" in set-cdr!, vector-set!, >> etc., was to alert the reader that something strange or nonlocal could >> happen. > > I thank of it as something that causes a side-effecting modification. > Can you think of counter-examples? > >> In our case, if we have >> >> (define domain (interval '#(0 0) '#(100 100))) >> (define a (array->specialized-array (array domain list))) >> >> for which >> >> ((getter a) 0 0) => (0 0) >> >> and then >> >> (define b (specialized-array-share! a (interval '#(0) '#(100)) (lambda >> (i) (values i j)))) >> >> >> then calling >> >> ((setter b) #t 0) >> >> will change subsequent values of >> >> ((getter a) 0 0) => #t > > How is this different from: > > #|kawa:1|# (define lx (list 'x 'a 'b)) > #|kawa:2|# (define ly (cons 'y (cdr lx))) > #|kawa:3|# (set-car! (cdr ly) 'w) > #|kawa:4|# lx > (x w b) > > The specialized-array-share! is the equivalent of line 2 - i.e. we > create a new data structure > that share with another. I agree completely. (1) I don't particularly like my notation; (2) sharing mutable structures can cause strange situations because of later mutations; (3) these later mutations using existing primitive procedures usually have a bang in their names to indicate that they are mutations (I think it's to alert the code reader that the code is doing something dangerous); (4) when using this array API there is no point in this whole process where a bang occurs textually. So I put a bang in the notation for the sharing step. This is just me trying to explain my previous notational choice, and I'll probably remove the bang in the next revision. Brad