zig icon indicating copy to clipboard operation
zig copied to clipboard

std: add decl literal initializers to some collections

Open dzfrias opened this issue 9 months ago • 5 comments

For coherence, it would make sense if EnumMap, EnumSet, and EnumMultiset had .empty and .full decl literal initializers like other collections do.

I'm not sure if initEmpty() and initFull() should removed from these types completely, since decl literals seem to be the better way to do things now.

dzfrias avatar Jan 30 '25 15:01 dzfrias

I'm not sure if initEmpty() and initFull() should removed from these types completely, since decl literals seem to be the better way to do things now.

I suggest implementing those old functions in terms of the new ones, and marking the old ones deprecated.

alexrp avatar Mar 25 '25 18:03 alexrp

Done, thank you for the suggestion. I extended decl literals to StaticBitSet, as well.

Also, would it be good to squash these commits?

dzfrias avatar Mar 27 '25 21:03 dzfrias

No need, I'll just squash when merging.

alexrp avatar Mar 27 '25 22:03 alexrp

with the addition of of the decls, would it be a good opportunity to remove the default field values?

nektro avatar Apr 21 '25 04:04 nektro

with the addition of of the decls, would it be a good opportunity to remove the default field values?

Since the default initializer for ArrayListUnmanaged is deprecated, I think that makes most sense. I'll go ahead with those changes and revert if needed.

dzfrias avatar May 04 '25 23:05 dzfrias