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.06k stars 198 forks source link

`MutXxx.clear()` methods #7139

Closed Chriscbr closed 4 weeks ago

Chriscbr commented 2 months 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 1 month ago

Hey Chris, can I take this issue?

eladb commented 1 month 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 1 month 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

monadabot commented 4 weeks ago

Congrats! :rocket: This was released in Wing 0.85.24.