Conversation
|
@rdleal may you please look at the PR? |
|
Hi @Bychin sorry for the delay. I will take a look at the PR today! |
|
@Bychin the change you are proposing is a breaking change to the current API. We can't change the signature of a function in Go and still keeps its backward compatibility, as users of this package might be relying on the type PriorityQueueRemover interface {
Remove(k string)
}
func main() {
pq := kpq.NewKeyedPriorityQueue[string](cmp) // cmp function definition omitted for brevity.
var x PriorityQueueRemover = pq
fmt.Println(x)
}A good practice here would be to add a new method with the new signature. For example, adding the method What do you think of it and which of those you think solves best your use case? For more on backward compatibility in Go, please refer to the following articles: |
feat: add blocking pop call
Add boolean return value for
Remove()method.Sometimes it is useful to know whether the element was actually removed on not. But I don't want to call
Contains()beforeRemove()because it requires extra r-lock call.