Stream: ideas

Topic: increment and decrement builtins


view this post on Zulip Richard Feldman (Aug 14 2023 at 22:01):

I'd like to add Num builtins for increment and decrement (including wrapping and saturating versions).

I was thinking of naming them Num.incr and Num.decr because Num.dec might be confusing with the completely unrelated Num.Dec.

Any thoughts on those names?

view this post on Zulip Brendan Hansknecht (Aug 14 2023 at 23:46):

Names look strange to me, but I'm sure I would get use to them. Could also go with Num.addOne or something similar.

view this post on Zulip Brendan Hansknecht (Aug 14 2023 at 23:47):

I don't think users would understand Num.decr at first glance.

view this post on Zulip Brendan Hansknecht (Aug 14 2023 at 23:48):

My first thought with decr is definitely: what does the r stand for? Cause decf would be decrement float, but what is decr?

view this post on Zulip Brendan Hansknecht (Aug 14 2023 at 23:49):

Decrement round obviously doesn't make sense, but is how I read it by default.

view this post on Zulip Richard Feldman (Aug 15 2023 at 00:52):

ha, addOne is pretty straightforward! I'm game for that :thumbs_up:


Last updated: Jun 16 2026 at 16:19 UTC