oscbyspro / Numberick

An arithmagick overhaul in Swift
Apache License 2.0
15 stars 3 forks source link

Non-fixed-width `init(repeating:)` #45

Open oscbyspro opened 1 year ago

oscbyspro commented 1 year ago

I think init(repeating:) should be moved to NBKBinaryInteger so it becomes available to IntXL, and UIntXL could reasonably trap on init(repeating: true). I suppose that adding a duplicate requirement to NBKSignedInteger is an alternative, but I don't find that as elegant.

oscbyspro commented 1 year ago

The asymmetry of (#34) is an argument in favor of adding a duplicate requirement to NBKSignedInteger. Hm.

oscbyspro commented 1 year ago

I suppose it's unclear what size this would give a manually resizable integer. Hm.

oscbyspro commented 1 year ago

An alternative is committing to fixed-width by moving init(bit:) to NBKFixedWidthInteger. The rationale being that heap allocating a single bit is almost never what you intend to do.