Stream: ideas

Topic: requiring more type annotations?


view this post on Zulip Steve Howell (Nov 12 2026 at 15:48):

This is a question that's a bit beyond the scope of 0.1.0 or the specific question here, but do you think it's fair for Roc to just require more explicit annotations in certain cases? I come from the bias that I basically require my agent to write lots of type annotations. So I don't really benefit from the compiler's ability to infer types. Instead, I just pay for compiler complexity when I'm more than happy to have verbose code.

view this post on Zulip Richard Feldman (Nov 12 2026 at 17:36):

Steve Howell said:

do you think it's fair for Roc to just require more explicit annotations in certain cases?

well it's obviously a downside

view this post on Zulip Richard Feldman (Nov 12 2026 at 17:37):

my view is that it's on the negative side of a tradeoff, and if the positive side is sufficiently large, it can potentially outweigh that

view this post on Zulip Richard Feldman (Nov 12 2026 at 17:37):

those tradeoffs have to be weighed on a case-by-case basis, and I think this is one set of tradeoffs that should be weighed sometime after 0.1.0 :smile:

view this post on Zulip Steve Howell (Nov 12 2026 at 17:39):

Is part of the pitch for Roc that you don't have to bother writing annotations? I had very much the same question while I was writing Elm. Out of curiosity, are there any close cousins to Roc that are more strict?

view this post on Zulip Richard Feldman (Nov 12 2026 at 17:39):

more strict in what sense?

view this post on Zulip Steve Howell (Nov 12 2026 at 17:40):

annotations not optional

view this post on Zulip Richard Feldman (Nov 12 2026 at 17:40):

if I remember right, I think Gleam has an ML-family type system and requires annotations on all top-level functions

view this post on Zulip Richard Feldman (Nov 12 2026 at 17:41):

I wouldn't say that "no type annotations" is a critical part of the pitch for Roc, but I do think it's a benefit that should not be given up for little gain

view this post on Zulip Steve Howell (Nov 12 2026 at 17:45):

I guess my position is that I don't really see the gains in the kind of work I do. It's just a data point, to be clear. I haven't ever used Roc as a "scripting" language, though, and I know that's part of your vision. (or correct me if I'm wrong)

view this post on Zulip Anton (Nov 12 2026 at 17:52):

I think not requiring type annotations makes Roc more approachable and attractive when people check it out.

view this post on Zulip Notification Bot (Nov 12 2026 at 17:53):

11 messages were moved here from #announcements > breaking changes: operator desugaring and shadowing by Anton.

view this post on Zulip Karakatiza (Nov 12 2026 at 18:11):

re: the announcement: I hope the more explicit numeric types remains on the horizon as a thorn as stated, rather than temporary-permanent status quo. I find total type inference goal absolutely beautiful (and the fact that language having a nice number of syntax features and still doesn't require explicitness).

view this post on Zulip Richard Feldman (Nov 12 2026 at 18:44):

just to clarify, what do you mean by "the more explicit numeric types"?

view this post on Zulip Karakatiza (Nov 12 2026 at 20:47):

The clarification is I misread your announcement, sorry for confusion :sweat_smile: I was thinking of something else.
Arithmetic operators that act on different types are enticing, so I'm sure it will come up later naturally. The a, a -> a is a very reasonable limitation for now :)

view this post on Zulip Matthieu Pizenberg (Nov 13 2026 at 09:17):

Yeah, I think for the long tail, people doing physics for example always use units in equations if possible instead of bare unit-less numbers. When teaching/learning that’s a good help to check your equation formulas. Your time duration example is typically the "unit" situation. I could see this being useful in games too to differentiate frames of reference, like in-game units VS viewport units. That’s one obvious use case I see where supporting different types for numeric operators would be useful.

view this post on Zulip Steve Howell (Nov 13 2026 at 11:26):

I think #bugs > Recursive Types... @ 💬 is an interesting data point where requiring annotations would prevent a certain level of confusion. I'm not claiming it's more important than the approachability tradeoff. I already basically enforce that agents use annotations, so take this with a grain of salt.

view this post on Zulip Steve Howell (Nov 13 2026 at 11:39):

I actually code in annotations now with agents. I don't use a code editor, but I will often tell Claude that I want a function with the type signature of (Position, Position) -> Distance. This somewhat relates to what @Matthieu Pizenberg bring up in terms of units. I actually have scripts that produce me excerpts of Roc that are primarily annotations. I trust Claude on functions innards, but Claude often gets the types wrong when I am sloppy about expressing requirements.

view this post on Zulip Steve Howell (Nov 24 2026 at 15:49):

Richard Feldman said:

if I remember right, I think Gleam has an ML-family type system and requires annotations on all top-level functions

I was curious. It turns out Gleam only requires annotations for external functions. source: googled "gleam mandatory annotations". More info on google.


Last updated: Nov 26 2026 at 20:35 UTC