Imaginary Language Features

Andrew (he/him) - Jul 18 '19 - - Dev Community

This really interesting proposal for an any case in a switch statement (with subtle differences from default) by Meghan...

...got me thinking: what imaginary language features would be cool to program with? In response to Meghan's proposal I thought of a template case:

What about a template case?

switch (number) {

  template:
      before: // do something before
       after: // do something after

  case 1: // ...

  template case 2: // ...

  template case 3: // ...

  case 4: // ...

  default: // ...

}
Enter fullscreen mode Exit fullscreen mode

template could be applied to only a particular subset of cases, and the template definition could be extended to do exception handling, etc.

What are some neat ideas you've had for language features?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .