On the philosophy of conditionals

Allison on 2006-04-18T06:37:34

Today I implemented elsif and else blocks in Punie. Fairly straightforward. One interesting tidbit: the logic for translating conditionals down to PIR is actually simpler if you reverse it. So this bit of Perl 1 code:

if (1) {
  print "is true\n";
} elsif (2) {
  print "else is true\n";
} else {
  print "is false\n";
}


translates to something like this bit of PIR code:

unless 1 goto is_false
# if
    print "is true\n"
    goto end_if
is_false:

unless 2 goto else_is_false # elsif print "else is true\n" goto end_elsif else_is_false:

# else print "is false\n" end_elsif: end_if:


This is far easier to generate from a tree than the alternative:

if 1 goto is_true
if 2 goto else_is_true
# else
    print "is false\n"
    goto end_if
else_is_true:
# elsif
    print "else is true\n"
    goto end_if
is_true:
    print "is true\n"
end_if:


I've noticed this in general when writing PIR code --that unless gives me a control flow more similar to the if of a high-level language. It's because the actual meaning is reversed: HLL if means "if X is true do the following chunk of code" while the assembly if means "if X is true skip over the following chunk of code to label Y".


perl6 progress bar

vijucat on 2006-04-27T12:13:00

Hi,

Is it possible, given the lack of spec for perl 6, etc; that mere perl 5 and CPAN loving mortals such as myself, can get an idea of how far along perl 6 is?

I recommend a perl 6 progress bar (or multiple progress bars, one for pugs, one for...). The progress bar has an end point, has tick marks (milestones) and a slider at a particular tick mark.

I realize how corporate sounding and non-open-source all this insistence on definition is (I report daily at 8:30 a.m. to the same desk and job, and have deadlines, and try to meet them, so sue me), but I am asking for this in desperation : can you guys please release an intermediate version that works? Can you (unimaginable?) write a spec?

Apologies if this is the wrong forum. Should I post this to any perl6 mailing list/group?