[% setvar title Simplify C Syntax %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/


Simplify do BLOCK Syntax


  Maintainer: Mark Senn <mds@purdue.edu>
  Date: 26 Aug 2000
  Last Modified: 29 Aug 2000
  Mailing List: perl6-language@perl.org
  Number: 167
  Version: 2
  Status: Developing


Simpify syntax of do BLOCK by deleting do before the block and ; after it.


One of the most common mistakes I make is forgetting a ; after do BLOCK, probably because I'm thinking ``if'' and an if doesn't require a : after it's closing }. I'll type, for example,

    $cond  and  do  {
        # statements

instead of

    $cond  and  do  {
        # statements

Can the syntax be simplified to drop the ;, and while you're at it, how about the do also, so one can type

    $cond  and  {
        # statements

If the do and ; are redundant should they be eliminated to obey the rule:

    Omit redundant punctuation as long as clarity doesn't suffer.

on page 604 of Camel III?




Camel III, pages 123--125, 604