sirisian / ecmascript-types

ECMAScript Optional Static Typing Proposal http://sirisian.github.io/ecmascript-types/
453 stars 4 forks source link

Ranges - Investigate possible conflicts with future proposals #25

Open sirisian opened 7 years ago

sirisian commented 7 years ago

Refer to https://esdiscuss.org/topic/ranges

I think there's some merit to that proposal and would like to ensure the type system works with any future inclusion. What I foresee is uint8[].range(0, 5) typed syntax for each numeric type. I'm not against having Array.range for a dynamic version. range(start, end, step) seems to be a simple definition that can be used. If start has to be less than end is unclear, but it's probably not important for the discussion.

Common usage, or at least how I've always needed it, would be:

uint32[].range(0, 10).map(i => i + `foo`);