Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

Useful Stuff

  • 0 Replies

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 788
    • View Profile
Useful Stuff
« March 21, 2021, 11:41:23 AM »
Things that would be useful to see in a language.

A common idiom is looping "forever" (well, practically you need to exit that loop at some time).
Code: [Select]
forever {  ...  }
instead of
Code: [Select]
while (true) {  ...  }
The idea is that the keyword forever stands out more obviously to the reader, making it clearer what's going on. In a language like C, you could define a macro forever to be replaced by while (1). Either way, the compiler should be on the lookout for perpetual loops, and check that there is a path out of it (some sort of accessible break; somewhere). Not finding a way out should be a warning, not an error, as there is GUI code which loops forever (?).