On Sun, Oct 16, 2016 at 5:25 PM, Liam <networkimp...@gmail.com> wrote:
> On Sunday, October 16, 2016 at 5:13:36 PM UTC-7, Ian Lance Taylor wrote:
>> On Sun, Oct 16, 2016 at 3:34 PM, Liam <networ...@gmail.com> wrote:
>> >
>> > On Sunday, October 16, 2016 at 2:56:42 PM UTC-7, Ian Lance Taylor wrote:
>> >
>> >> To argue that this should go into the standard library, look at some
>> >> corpus of Go code and find out how often it occurs.  If it occurs
>> >> fairly often, you've got a good case.
>> >
>> >
>> > Fairly often; i.e. as often as Replace or Trim*? In my experience it
>> > passes
>> > that test.
>> This is something that can actually be measured.
> By doing grep 'append.*append' ? And '\[:.*len\(.*\).*\+[0-9]+.*\]' ?
> Neither of these will be accurate.
> Part of my point is that Insert operations are semantically obscured.

Understood.  But my guess is that insertion operations are fairly
rare--much less common than Replace or Trim.  People obviously append
to slices all the time, but I suspect that they tend to write their
slice operations to not require inserting a single element in the
middle of the slice, because insertion is by definition O(N) rather
than O(1).  I could certainly be wrong, but that guess leads me to
suspect that adding a function for something that can easily be
written in a single expression is overkill.  Since I am only guessing,
and since it seems to me that you are also guessing, I think we should
measure rather than guess.


You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to