[Gambas-user] New feature in the Array classes
Brian G
brian at westwoodsvcs.com
Sat Feb 13 02:22:37 CET 2021
That to me sounds like a good solution!
--
Thanks
Brian Friday, 12 February 2021, 04:08PM -08:00 from Tobias Boege tobs at taboege.de :
>On Sat, 13 Feb 2021, Brian G wrote:
>
> But if you just used a sorted array, it would always be sorted. No need of any conversion.. or special functions.
> Ummmm, and if you updated your code to use one, then you just change one place.. the definition, all the interface calls are pretty much the same
>
>Remixing the ideas from this subthread, this feature could also take the
>form of a virtual class named .Array.Sorted which replaces some of the
>methods with more optimized or specialized ones. You would then write
>aThings.Sorted.Add(...) or aThings.Sorted.Find(...) if you want to treat
>the array as sorted and preserve that property.
>
>To me, this reads nicer than aThings.AddSorted etc. and doesn't show up
>immediately in the Array class help. It would also avoid copying data,
>because a virtual class operates on the same underlying object, it just
>changes the method resolution.
>
>The disadvantage (which I cannot quantify!) would be that virtual class
>access is slower because it adds one level of indirection. It's basically
>a less efficient way of passing an optional flag to a method, except that
>it is totally backwards-compatible and doesn't clutter the class's symbols.
>
>Just a thought.
>
>Regards,
>Tobias
>
>--
>"There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
>----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210213/5b453bb7/attachment.htm>
More information about the User
mailing list