Re: [perl #44553] [PATCH] Add a new PIR tutorial for defined

2007-08-12 Thread Paul Cochrane
On 11/08/07, Patrick R. Michaud [EMAIL PROTECTED] wrote:
 On Sat, Aug 11, 2007 at 05:00:33PM +0200, Paul Cochrane wrote:
   Within the past few months we've standardized on always quoting
   type names in PIR, so the above needs to read
  
   $P1 = new 'String'
  
   Throughout Parrot you'll find lots of examples and code that
   use older deprecated syntaxes -- they should probably be
   changed to the new syntax as well (patches welcome!).
  
   $P1 = new .String  # deprecated
   $P1 = new String   # deprecated
 
  This would make a great CAGE task.  Would you be able to open a ticket
  for this with a list of the old syntaxes and what the new syntax
  should be?

 Should it be a single ticket, or should we open tickets based on
 subsystems?  I'm in favor of the latter, personally.

My guess is also the latter.

 We also have a bug day coming up in a week (August 18), and this
 might be a great set of tasks for people to work on for bug day.
 It'd be nice if we could come out of bugday having converted
 most of the existing deprecated syntaxes into the new one.

Agreed!  :-)

Paul


Re: [perl #44553] [PATCH] Add a new PIR tutorial for defined

2007-08-11 Thread Patrick R. Michaud
On Fri, Aug 10, 2007 at 04:20:04PM -0700, Colin Kuskie wrote:
 This patch adds a new tutorial file, 56_defined.pir, which talks 
 about the concept of definedness.   
...
 +=head1 defined
 +
 +The defined function tells you if the contents of a PMC register is defined 
 or not.  Using
 +defined on an temporary Integer, Number, or String register will generate an 
 error.

For consistency's sake I think we should stick with the term
opcode or operation instead of function.  Also, it might
help to surround the word defined with C..., as in:

The Cdefined opcode tells you if the contents of a PMC register
are defined...

 +.sub main :main
 +
 +$I0 = defined $P0
 +if $I0 goto defined_PO
 +say $P0 is undefined before being used
 +goto end_defined_P0
 +  defined_PO:
 +say $P0 is defined before being used

I'm not certain that uninitialized registers ($P0 in
the above) are guaranteed to be null ... in particular,
the PIR assembler might be free to map $P0 to a register 
that already has a value of some sort in it.  So, someone 
might be very surprised to try a variation of the above code 
and get back a result that $P0 is defined.

 +PMCs are undefined before being typed.  After they are typed, they
 +are defined, and hold whatever default value PMCs of that type contain.  
 ...

This is likely misleading.  All PMCs have a type, so there aren't
really states of before being typed or after being typed.
There is an Undef type, but it's just another type.

Also, definedness is not necessarily tied only to the Undef type.
Any PMC is able to have its own concept of definedness --
thus a HLL can create things that represent undefined integers,
undefined strings, undefined files, etc.  The Cdefined opcode
simply queries a PMC to see if it believes it is defined or not,
according to that PMC's criteria for definedness.

 +$P1 = new String

Within the past few months we've standardized on always quoting
type names in PIR, so the above needs to read

$P1 = new 'String'

Throughout Parrot you'll find lots of examples and code that
use older deprecated syntaxes -- they should probably be
changed to the new syntax as well (patches welcome!).

$P1 = new .String  # deprecated
$P1 = new String   # deprecated

Thanks for the contributions!

Pm


Re: [perl #44553] [PATCH] Add a new PIR tutorial for defined

2007-08-11 Thread Paul Cochrane
 Within the past few months we've standardized on always quoting
 type names in PIR, so the above needs to read

 $P1 = new 'String'

 Throughout Parrot you'll find lots of examples and code that
 use older deprecated syntaxes -- they should probably be
 changed to the new syntax as well (patches welcome!).

 $P1 = new .String  # deprecated
 $P1 = new String   # deprecated

This would make a great CAGE task.  Would you be able to open a ticket
for this with a list of the old syntaxes and what the new syntax
should be?

Paul


Re: [perl #44553] [PATCH] Add a new PIR tutorial for defined

2007-08-11 Thread Patrick R. Michaud
On Sat, Aug 11, 2007 at 05:00:33PM +0200, Paul Cochrane wrote:
  Within the past few months we've standardized on always quoting
  type names in PIR, so the above needs to read
 
  $P1 = new 'String'
 
  Throughout Parrot you'll find lots of examples and code that
  use older deprecated syntaxes -- they should probably be
  changed to the new syntax as well (patches welcome!).
 
  $P1 = new .String  # deprecated
  $P1 = new String   # deprecated
 
 This would make a great CAGE task.  Would you be able to open a ticket
 for this with a list of the old syntaxes and what the new syntax
 should be?

Should it be a single ticket, or should we open tickets based on
subsystems?  I'm in favor of the latter, personally.

We also have a bug day coming up in a week (August 18), and this 
might be a great set of tasks for people to work on for bug day.
It'd be nice if we could come out of bugday having converted
most of the existing deprecated syntaxes into the new one.

Pm