FAQ
Hello,

I know this was requested several times but don't know the current status:

I'd like to know if there is any plan of adding a builtin delete([]slice,
idx) for slices and a set type (could just be a map[Type]struct{}
internally, and myMap[<key>] returning bool value only) for convenience.

This is not really important but I'm using these operations frequently and
believe this would improve code readability quite a lot. I also don't think
that it would significantly increase complexity of the language.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ian Lance Taylor at Jun 7, 2015 at 10:50 pm

    On Sun, Jun 7, 2015 at 10:42 AM, wrote:
    I'd like to know if there is any plan of adding a builtin delete([]slice,
    idx) for slices and a set type (could just be a map[Type]struct{}
    internally, and myMap[<key>] returning bool value only) for convenience.
    There are no plans for these changes. Neither is likely to ever be
    added to the language. They add no significant new functionality.

    Ian

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Dan Kortschak at Jun 8, 2015 at 12:33 am
    To add to this, there are at least two reasonable ways to do delete from a slice - one is O(1) and one is O(n). Which would be chosen? The choice depends significantly on use context.
    On 08/06/2015, at 8:20 AM, "Ian Lance Taylor" wrote:

    There are no plans for these changes. Neither is likely to ever be
    added to the language. They add no significant new functionality.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 7, '15 at 5:42p
activeJun 8, '15 at 12:33a
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase