Hi,

my question is probably naive, please bear with me.

Every time I look inside .pir files the same question comes to my mind

Why a simple syntax sugar is not invented to introduce a couple of macro-like 
straightforward expansions

  if COND {
  }

transform to

unless COND goto AUTOGEN_LABEL_XXX
.....
AUTOGEN_LABEL_XXX:

likewise 
unless COND {
}

and 

if COND {
} else {
}

This way following function inside ./languages/perl6/src/classes/Bool.pir:
 .sub 'perl' :method
    if self goto false
    .return ('Bool::False')
  false:
    .return ('Bool::True')
.end

could be written as

 .sub 'perl' :method
    if self {
       .return ('Bool::True')
    }
    else {
      .return ('Bool::False')
    }
.end

which will be expanded as

 .sub 'perl' :method
    unless self goto autogenerated-label-1
       .return ('Bool::True')
goto autogenerated-label-2;
    autogenerated-label-1:
      .return ('Bool::False')
  goto autogenerated-label-2:
.end

these straightforward expansions will free PIR-programmers from inventing 
labels every time, and introduces better readability.

Best regards,
Vadim.
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to