[e-lang] Documentation bug for FlexList

David Hopwood david.nospam.hopwood at blueyonder.co.uk
Fri Mar 16 12:12:40 CDT 2007


Kevin Reid wrote:
> On Mar 15, 2007, at 23:43, David Hopwood wrote:
> 
>><http://erights.org/javadoc/org/erights/e/elib/tables/FlexList.html>
>>
>># void setRun(int start, int bound, EList other)
>># Enabled: Replace from start..!bound in this list with other.
>>
>>? def a := [2, 3, 4].diverge()
>># value: [2, 3, 4].diverge()
>>
>>? a.setRun(0, 0, [1])
>>? a
>># value: [1, 2, 3, 4].diverge()
>>
>>1. Why is this called 'setRun'? 'insertRun' would make more sense.
> 
> Note that the name "setRun" is part of the assignment sugar:
> 
>    a(b, c) := d
> 
> expands to
> 
>    a.setRun(b, c, def ares__1 := d)
>    ares__1
> 
> , and a(b, c) is of course a.run(b, c).

How often is this used? I'm not sure I see the justification for
syntactic sugar here. Assuming the expression is not normally relied
on to return d, it only saves 5 characters (8 with the 'insertRun'
name change), and it is not at all obvious that it does an insertion.

Wouldn't "a.insertRun(b, c, d)" be better in every significant way?

> Whatever name change you propose must also fit generically into the  
> assignment sugar.
>
> Separately:
> 
> - Calling this "replacement" in the documentation is consistent with  
> replace/5, which is the same operation except with the ability to  
> specify a subrange of the source list.

Then that documentation has the same problem. Also, it's not clear why
this method should have a different name, rather than being an overload
(e.g. 'insertRun/5').

> - What would you think of the name "putRun"?

No better than 'setRun'.

-- 
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>



More information about the e-lang mailing list