Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Non-flow-control logical tests
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dan Sugalski  
View profile  
 More options May 20 2004, 11:40 am
Newsgroups: perl.perl6.internals
From: d...@sidhe.org (Dan Sugalski)
Date: Thu, 20 May 2004 11:40:38 -0400
Local: Thurs, May 20 2004 11:40 am
Subject: Non-flow-control logical tests
Okay, let me preface this by saying it is, in large part, directly
because of my current work project, so it feels a bit self-serving.
(One of the reasons I haven't just put them in)

But...

Right now the only good way to find out if a value is true or not is
to do something like:

  $I0 = 1
  if $P0, done
  $I0 = 0
  done:

and look in $I0 for the result. This is OK, but if you're dealing
with a language with relatively primitive views of logical operations
(i.e they return 0 or 1) you end up with a *lot* of these little code
snippets when evaluating something like:

    if ((foo or bar) and ((x1 >= 12) or (x2 < 15) or (x5 and x6 and
x7)) goto somewhere

(And yes, that's close to a real code snippet. Feel my pain here :)
Not a huge deal to translate, but once you hit 30K basic blocks in a
sub the register coloring algorithm really gets unhappy and dies an
unpleasant death after an hour or so.

Anyway, because of it I'm pondering non-flowcontrol logical ops. That
is, something like:

    istrue I0, P5        # I0 = 1 if P5 is true
    isgt I0, P5, P6      # I0 = i if P5 > P6

The or/and/xor/not ops don't really need alternate versions, since:

    isor I0, P5, P6

can be done with

    or P4, P5, P6
    istrue P4

so there doesn't seem to be much pressure there.

Given the semi-self-serving nature of these I think some discussion's
in order first.
--
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
d...@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.