Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-12-01 Thread cblake
An un-keyed `pop(Table): tuple[K,V]` more similar to `HashSet.pop` is mentioned in the PR commentary linked above. (I would personally just use the already-defined iterator than b3liever's inline expansion, but eh. Either way.) Totally suitable for another PR. I just wanted to keep the above

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-12-01 Thread Araq
Lol good point, I shouldn't post here when I had too little sleep.

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-12-01 Thread mratsim
Why mpop, the caller takes ownership of the result and must assign it or discard it.

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-30 Thread Araq
But then we also need `mpop` "for consistency", it never ends...

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-30 Thread b3liever
Well I think a pop proc would look like this instead: proc pop*[A, B](t: var Table[A, B]): (A, B) = if len(t) == 0: raise newException(KeyError, "pop(): dictionary is empty") for h in countdown(high(t.data), 0): if isFilled(t.data[h].hcode):

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-17 Thread cblake
Ok. Just to close the loop on this thread I believe this accommodates all expressed views: [https://github.com/nim-lang/Nim/pull/12678](https://github.com/nim-lang/Nim/pull/12678) (except maybe one week pre-release implies backward compatibility forever view or the if one-table has a proc, all

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-16 Thread spip
As proc name overloading is one of the ways to offer genericity in Nim code, selecting the right name is important, particularly for data structures that share similar behaviours. Some languages have symbol renaming or aliasing, like Eiffel, to handle such cases of semantic similarity. +1 for

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-14 Thread cblake
@mratsim \- it's not just you. Formatting looks pretty garbled. @araq \- sensible to me to duplicate/alias rather than deprecate. Pretty low-cost.

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-13 Thread mratsim
+1. Is it me or the apis.rst has a completely broken format on Github? [https://github.com/nim-lang/Nim/blob/devel/doc/apis.rst](https://github.com/nim-lang/Nim/blob/devel/doc/apis.rst)

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-13 Thread kaushalmodi
+1 for pop.

Re: ``Table.take`` should be ``Table.pop`` -- discuss

2019-11-13 Thread Araq
I don't mind `pop` instead of `take` (though "take" is the better word IMO) but I'm personally quite tired of "X is inconsistent with Y so let's deprecate X because nobody ever got tired of applying random changes to existing codebases".

``Table.take`` should be ``Table.pop`` -- discuss

2019-11-13 Thread cblake
Before we leave things as just `take` in `Table`-land for very long/a full release cycle and having to worry about backward compatibility, I thought this warranted a much wider discussion than a comment thread in a closed pull request: >