winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.02k stars 197 forks source link

`MutXxx.clear()` methods #7139

Open Chriscbr opened 1 month ago

Chriscbr commented 1 month ago

Use Case

Methods that will clear the contents of collections in-place:

Proposed Solution

Implementation Notes

No response

Component

SDK

Community Notes

Pushkarm029 commented 5 days ago

Hey Chris, can I take this issue?

eladb commented 4 days ago

@Pushkarm029, you are welcome to pick up this issue.

I am not sure it makes sense to offer Array.clear(), but it does make sense to offer clear() methods on other collection types, so I revised the title and description a little.

Pushkarm029 commented 3 days ago

@eladb, I double-checked, and the clear() methods are already implemented for MutSet and MutMap. It looks like only MutArray is missing, so I'll go ahead and add it. Let me know if I missed anything or if you have other thoughts! https://github.com/winglang/wing/blob/1fcd84ed1ca8b48c9bfe5a2cf4411cd381768610/packages/%40winglang/sdk/src/std/set.ts#L98-L104

https://github.com/winglang/wing/blob/1fcd84ed1ca8b48c9bfe5a2cf4411cd381768610/packages/%40winglang/sdk/src/std/map.ts#L162-L170