Re: Is Parrot in a stable state?

2002-10-13 Thread Leopold Toetsch

Jerome Quelin wrote:


 eq S0, , FLOW_GO_WEST


[ branch not taken ]


 And while I'm talking about strange things... Due to the fact that Parrot 
 does not branch to the correct label, 


As strings are involved, could you insert:

sweepoff
collectoff

as the very first instructions, your interpreter executes?

It would also be a good idea, to provide the instructions/files, where 
you have this broken behaviour, so that other people can try to 
reproduce this problem.

leo




Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Larry Wall

On Fri, 4 Oct 2002, Michael Lazzaro wrote:

: Date: Fri, 4 Oct 2002 16:40:04 -0700
: From: Michael Lazzaro [EMAIL PROTECTED]
: To: [EMAIL PROTECTED]
: Subject: Draft Proposal: Declaring Classwide Attributes
: 
: (Disclaimer: My purpose in proposing this is not to recommend it, but 
: to document whether the idea should be endorsed, or shot down, and any 
: proposed canonical syntax.  Note that the later implications of these 
: choices are quite substantial.  Please discuss!)
: 
: [Draft Proposal: Declaring Classwide Attributes]
: 
: Within a class, classwide attributes are declared using the standard 
: my and our.
: 
: Example:
: 
:   class Zap {
:   my %zap_cache;  # a private classwide attribute
:   our $zap_count = 0; # a public classwide attribute
: 
:   attr $foo;
:   attr $bar;
:   }
: 
: 
: [Discussion]
: 
: Many OO-based languages have the concept of classwide attributes; 
: that is, attributes that only exist once, for the class (and all 
: subclasses?), as opposed to existing one for each instance of a class.  
: You can use these attributes as counters, or caches, or any other 
: common ground for use by all instances of the class.
: 
: Within a class definition, Perl simply uses the my/our keywords for 
: this purpose.
: 
: If any value is to be assigned to a classwide attributes, that 
: assignment is done once, upon initialization of the class.

If you want accessor methods, use the dot:

class Zap {
my %.zap_cache; # a private classwide attribute
our $.zap_count = 0;# a public classwide attribute

has $.foo;
has $.bar;
}

It may be that $.zap_count is public not so much because of the class definition
where it would default to private, but because $.zap_count's real global name is
$Zap::.zap_count.  To get a public accessor method you might still need to declare
it public.  And you could get a public accessor method to the my variable as well
the same way.  (That means is that the {...} of the class definition is really just
a closure that executes once when the class is built.)

Larry




RE: perl6 operator precedence table

2002-10-13 Thread fearcadi

in 
http://archive.develooper.com/perl6-language%40perl.org/msg11440.html
Larry Wall wrote:
I'm wondering whether the single ones could indicate parallel streams.
We had the difficulty of specifying whether the Cfor loop should
terminate on the shorter or the longer stream.  We could say that |
terminates on the longer, and  on the shorter.  Possibly there's
some relationship with any() and all() in there as well.  The | could
generally be construed as a comma that doesn't guarantee ordering.
So cases could be written

but then in the for  loop   a | b  should result in *ordered* 
any(a,b) because we need to distinguish the first and second stream when 
attaching to the arguments of - ... closure.

 While inside when  a|b results in unordered any(...). 
How this lives together?
arcadi.





RE: perl6 operator precedence table

2002-10-13 Thread fearcadi

in
 http://archive.develooper.com/perl6-language%40perl.org/msg11451.html
Larry Wall wrote:
 for cases ^| newcases - $x is rw | $y {...}

do I understand correctly that what happens is (more or less) --
any($a,$b) := any($x,$y)

?

arcadi





Re: perl6 operator precedence table

2002-10-13 Thread Luke Palmer

 Date: Fri, 11 Oct 2002 12:16:00 -0700 (PDT)
 From: Larry Wall [EMAIL PROTECTED]
 
 I'm wondering whether the single ones could indicate parallel streams.
 We had the difficulty of specifying whether the Cfor loop should
 terminate on the shorter or the longer stream.  We could say that |
 terminates on the longer, and  on the shorter.  Possibly there's
 some relationship with any() and all() in there as well.  The | could
 generally be construed as a comma that doesn't guarantee ordering.
 So cases could be written
 
 when 1 | 2 | 3{...}
 
 as well as with comma.  Saying
 
 when 1  2  3{...}
 
 might be short for
 
 when all(1,2,3)   {...}

Aha!  Superpositions.  | is for any,  is for all.  That works :).

Some of my students want to go:

 if ($x == 1 || 2) { ... }

Now they can:

 if $x == 1 | 2 { ... } 

It reads well in english (which I am a strong supporter of).  Better
than if x equals any one two.  I do very much like this idea.

Luke



Re: Slots

2002-10-13 Thread Larry Wall

On Fri, 4 Oct 2002, Michael Lazzaro wrote:
: Thanks, if it's looking like lvalues are really out I'll edit that draft
: to take out the lvalue stuff and do it the other way.

No, lvalue methods are definitely in, and pretty much always have been.
(There will be no problem with post-processing the value, as the next
Apocalypse will make clear.)

: (And if Damian's
: happy with slots, that probably means we can get a lot of the other
: attribute recipies out of the way pretty quick.  Huzzah!)
: 
: I had mixed feelings about defining and using a term like slots in a
: draft that could mutate into a faq/tutorial, and went back and forth on
: it (haven't done Self in years, and never in a non-academic setting.) 
: Think, think... Well, no, screw it: the best philosophy is to present
: and (re)define the terms ourselves, as many as we need, but perhaps with
: a footnote on language of origin.  We don't want to invent new
: terminology, we want to reuse it.  Duh.  :-P
: 
: If no objections, we'll use the term slots to mean the aforementioned
: attribute/method symmetry.  I'll edit the text to give a proposed perl6
: glossary definition.

Slots isn't quite right.  Inside the class we distinguish attributes from
methods.  It's only outside the class that they're all methods.

Larry




Re: popping an empty intlist

2002-10-13 Thread Leopold Toetsch

Jerome Quelin wrote:


 My goal is to provide a Befunge interpreter that just does the right thing 
 out of the box - that is, that does not need to patch Parrot in order to 
 function.


Arrays (and all classes) are currently reorganized. The mentioned patch 
is a current hack, to get your expected behaviour.


I'm not totally sure, how we will create all the array variants, we might need:


We have different data type:
- char/short/int/float/double/INTVAL/FLOATVAL/PMC/BIGINT
- bit would need an own class for the index calculation
Range checking:
- strict: throw an exception for get/set
- autoextend: throw an exception for get
- your case: be silent on out of bounds get/pop/shift

Creating a class for each combination would probably be overkill.
We could have classes for the currently used arrays, that is:
- PerlArray (data type PMC, autoextend)
- intlist (data type INTVAL, strict range check)

and a general array class, with an extended new .array, Px syntax, 
where Px holds the data type and range check behaviour.


 And remember that I want to have a Befunge interpreter that works as is. 
 ie, that uses only Parrot basics, and does not need to recompile...


Yes, of course, then ...

 Jerome


leo






Re: perl6 operator precedence table

2002-10-13 Thread Aaron Crane

Luke Palmer writes:
 Some of my students want to go:
 
  if ($x == 1 || 2) { ... }
 
 Now they can:
 
  if $x == 1 | 2 { ... } 

I like that a lot.  (Some of my students also want to do that.)

You can write an equivalent thing in Icon:

  if x = (0 | 1)

though (if memory serves) the parens are required.  And in Icon it's done
with backtracking, not superpositions.

-- 
Aaron Crane * GBdirect Ltd.
http://training.gbdirect.co.uk/courses/perl/



Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Me wrote:
: We also need a signifier for class methods (assuming
: a distinction is made).
: 
: Perhaps one could use an initial cap to indicate a class
: attribute/method:
: 
:   class foo {
:   my  $bar;# my is not used for attributes
:   our $baz;# neither is our
:   has qux; # instance attribute 
:   has Waldo;   # class attribute
:   method qwe;  # instance method
:   method Rty;  # class method
:   }
: 
: or similar.

I prefer to keep caps distinctions conventional rather than mandatory.
Maybe class methods could be indicated as in Ruby:

  method qwe;   # instance method
  method foo.rty;   # class method

But that wouldn't work as well for an anonymous class...

And Perl 5 certainly gets away without making the distinction.
And confusing the two does help if you want to write constructors
that can clone objects as well as create new ones.  Perhaps they
could be distinguished by the type of the invocant, if declared.

Larry




Re: Draft Proposal: Attributes: public vs. private

2002-10-13 Thread Larry Wall

On Sat, 5 Oct 2002, John Williams wrote:
: I think everyone agrees that some sort of simple accessor syntax will be 
: included (instead of the getX/setX hack).  But will accessors _look_ like 
: attributes or methods?
: 
:   # look like methods
:   object.foo($value);
: 
:   # look like attributes
:   object.foo = $value;
: 
: Personally, I hope they look like attributes.

They will, outside the class anyway.  Inside it's $.foo.

: But if they do, the perl5 
: lvalue subs are not the way to do it.  Why?  Because an lvalue sub returns 
: a lvalue which get set _after_ the sub returns.  At that point it is too 
: late for the sub to do anything useful with the new value.

Lvalue methods will have some kind of optional property which specifies
a closure to execute after the modification happens.

method foo {
my $handle = find_database(random criteria);
return $handle.fetch();

WRITE {
$handle.store(shift);
}
}

Or some such.  Note how the internal block allows capture of the $handle from
the original closure.   (A READ closure was also discussed in Zurich.)

Potentially there's also an also approach, which adds a closure to
an implicit autogenerated method:


has $.foo is public;

also foo is write { write_database($_) };

Except that $_ (the first arg) should maybe be the object, not the
new value.  How do we name the parameter?  Hmm...

also foo is write -:$newval { db_store($newval); .written(1); };

Yow.

Larry




Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Piers Cawley

Larry Wall [EMAIL PROTECTED] writes:

 On Sat, 12 Oct 2002, Me wrote:
 : We also need a signifier for class methods (assuming
 : a distinction is made).
 : 
 : Perhaps one could use an initial cap to indicate a class
 : attribute/method:
 : 
 :   class foo {
 :   my  $bar;# my is not used for attributes
 :   our $baz;# neither is our
 :   has qux; # instance attribute 
 :   has Waldo;   # class attribute
 :   method qwe;  # instance method
 :   method Rty;  # class method
 :   }
 : 
 : or similar.

 I prefer to keep caps distinctions conventional rather than mandatory.
 Maybe class methods could be indicated as in Ruby:

   method qwe; # instance method
   method foo.rty; # class method

 But that wouldn't work as well for an anonymous class...

 And Perl 5 certainly gets away without making the distinction.
 And confusing the two does help if you want to write constructors
 that can clone objects as well as create new ones.  Perhaps they
 could be distinguished by the type of the invocant, if declared.

I like that idea:

   class SomeClass { 
 method class_method ( Class $class: ... ) { ... }
 method instance_method  ( SomeClass $self : ... ) { ... }
 method dont_care_method (   $self : ... ) { ... }
   }

Or will 'Class' actually be CLASS by analogy with HASH, ARRAY etc?

-- 
Piers

   It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite.
 -- Jane Austen?



Re: Private contracts?

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Chris Dutton wrote:
: On Saturday, October 12, 2002, at 01:10  PM, Luke Palmer wrote:
: 
:  Date: Sat, 12 Oct 2002 08:43:46 -0700 (PDT)
:  From: Larry Wall [EMAIL PROTECTED]
: 
:  If we use | and  as sugar for any() and all(), then their precedence
:  should probably be the same as || and .
: 
:  Should they?  I had in mind something just above comparisons.  That
:  way:
: 
:  if $x == 3 || $y == 4 {...}
: 
:  and
: 
:  if $x == 1 | 2 { ... }
: 
:  both DWIM.  Is there a case for not doing this?
: 
: Just a thought, but don't we already have this with the smart match 
: operator?
: 
: if $x =~ (1, 2) { ... }

Yes, =~ implies an any() around a list.  But | could leave out the parens,
presuming the precedence is higher than =~.

: Or would  and | be a bit more strict in use, and thus easier for the 
: compiler to optimize?  For instance, would we be able to:
: 
: if $x == 1 | hello { ... }
: 
: or would both operands have to be of the same type?

I don't see why they'd have to be the same type.  There could well be
good reasons for superposing objects of different types.

Larry




Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Michael Lazzaro

Trey Harris wrote:
 
 In a message dated Sun, 13 Oct 2002, Piers Cawley writes:
  I like that idea:
 
 class SomeClass {
   method class_method ( Class $class: ... ) { ... }
   method instance_method  ( SomeClass $self : ... ) { ... }
   method dont_care_method (   $self : ... ) { ... }
 }
snip
 And I don't think you can do multiple-dispatch on topic, can you?

MD on topic could probably be easily allowed: sure, it's an invisible
argument, but it's still a parameter of the method invocation -- and
therefore internally could/should be a part of the method's full
signature.  The syntax might get scary, tho.

My temporary hack while writing the proto-recipes was that we'd have a
property that would simply declare a method to be a class method, but
I'm having a hard time coming up with an acceptable name to suggest for it:

method foo is class_method { ... }  # ???

It feels, conceptually, like something that should be a property.  The
other possibility is to use a keyword other than method for class
methods, but that would also require us to think of a word (and would
probably just be shorthand for a named property anyway).  So, I haven't
been able to come up with a single decent noun or adjective that means
class method, so far.  (classwide? static? blind? classmeth? cmethod? classorific?)

Regardless of how we declared it, my operating theory was that any
method declared as a class method would automatically be able to take
either a class or a class instance as it's invocant, and do the right
thing (i.e. when using an instance to invoke a class method, it would
automatically convert it to a class before assigning it as the topic, so
the implementing method wouldn't even notice, unless it went out of it's
way to look.)

This would DWIM, would mean we don't need multiple dispatch for it (at
least not in visible form) and would be in line with the common perl5 strategy:
$class = ref $class if ref $class;

If you *did* want a method that treated invoke-by-classname and
invoke-by-instance differently (i.e. a constructor), you simply wouldn't
declare it as a class method, and have the method check the topic itself.

MikeL



Re: [perl #17876] [PTACH] Parrot_snprintf writes 1 char too much

2002-10-13 Thread Leopold Toetsch

Tom Hughes wrote:

 In message [EMAIL PROTECTED]
   Leopold Toetsch (via RT) [EMAIL PROTECTED] wrote:

 It's probably best to do whatever C99 does, which I think is the same
 as what glibc does, namely to return the amount of space that would be
 needed to avoid truncation if the result is truncated.


Yep, exactly this, giving the caller a chance, to allocate more space 
and retry.


 Tom

leo






Re: popping an empty intlist

2002-10-13 Thread Leopold Toetsch

Jerome Quelin wrote:

 Hi there,
 
 I just discovered that:
  a) my befunge interpreter is broken (would you stop beaking it please? :o))
  b) push and pop operations are now supported by lists
  c) there's a pmc for handling list of integers: intlist 

 So, what else can I do? Catching exceptions (is that possible with Parrot)? 


Please have a look at list - not a PMC currently but can/does simulate 
intlist now for testing. just compile/link list instead of intlist.

list_pop(...)

   if (list-length == 0) {
return 0;
   }



Would just need one if in list_pop  near the end of the file to return 
what you want for empty list.


 Jerome


leo




Re: signal 11 when run on x86, JIT enabled

2002-10-13 Thread Steve Fink

On Fri, Oct 11, 2002 at 05:05:56PM -0700, Joe Wilson wrote:
 Perhaps this is a known issue...
 
 Most parrot programs seem to crash on x86 when the latest CVS parrot 
 is compiled with -O2 or -g -O2 and when JIT is enabled.
 The programs appear to run to completion and only crash prior to exitting.
 Repeatable on both Cygwin and Linux x86.
 When JIT is not used, everything is fine.

Ugh. That was a hairy one to track down. I have committed a fix. The
cause of the above problem was that the JIT was trampling over some
x86 registers that are supposed to be callee-saved in the cdecl
calling convention. By the time I finally figured that out, though, I
had fixed several other pretty major bugs in the jit.

Thanks for the report.



Re: popping an empty intlist

2002-10-13 Thread Jerome Quelin

On Saturday 12 October 2002 18:26, Brent Dax wrote:
 # So, what else can I do? Catching exceptions (is that possible
 # with Parrot)?
 Not just yet.  The ideas for exceptions are still bouncing around in the
 caverns of Dan's brain.  :^)

So, what am I suppose to do? Is there a way to get the behaviour I want, 
apart using my ugly trick in Parrot assembly that tests length of the list 
before popping?

Jerome
-- 
[EMAIL PROTECTED]



Re: Is Parrot in a stable state?

2002-10-13 Thread Steve Fink

On Sat, Oct 12, 2002 at 07:29:04PM +0200, Jerome Quelin wrote:
 FYI, I just rsync'ed this afternoon (12/10/2002 14:52 GMT) my Parrot, and did 
 the traditionnal: perl Configure.pl ; make; make test
 and yes, all the tests went ok...

I'll look into it, but could you try doing a make clean first? The
problem you are describing sounds suspiciously like the symptoms of
ops getting renumbered, as recently happened when I deleted a bunch of
two-arg ne and eq variants. If only we had a makefile with a complete
dependency graph...



RE: popping an empty intlist

2002-10-13 Thread Brent Dax



--Brent Dax [EMAIL PROTECTED]
@roles=map {Parrot $_} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
--Albert Einstein (explaining radio)

Jerome Quelin:
# So, what else can I do? Catching exceptions (is that possible 
# with Parrot)? 

Not just yet.  The ideas for exceptions are still bouncing around in the
caverns of Dan's brain.  :^)




Re: [perl #17865] [PATCH] Re-unite comment function

2002-10-13 Thread Steve Fink

On Fri, Oct 11, 2002 at 04:08:27PM +, Simon Glover wrote:
 # New Ticket Created by  Simon Glover 
 # Please include the string:  [perl #17865]
 # in the subject line of all future correspondence about this issue. 
 # URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17865 
 
 
 
  One of the comments in trace.c has got separated from the function it's
  describing. This patch puts it back in the right place.

Thanks, applied.



RE: popping an empty intlist

2002-10-13 Thread Brent Dax

Jerome Quelin:
# On Saturday 12 October 2002 18:26, Brent Dax wrote:
#  # So, what else can I do? Catching exceptions (is that 
# possible # with 
#  Parrot)? Not just yet.  The ideas for exceptions are still bouncing 
#  around in the caverns of Dan's brain.  :^)
# 
# So, what am I suppose to do? Is there a way to get the 
# behaviour I want, 
# apart using my ugly trick in Parrot assembly that tests 
# length of the list 
# before popping?

Not yet (although you could let that ugly hack handle the popping
itself).  Patience, young Skywalker--exceptions will be here soon.  :^)

--Brent Dax [EMAIL PROTECTED]
@roles=map {Parrot $_} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
--Albert Einstein (explaining radio)




Re: popping an empty intlist

2002-10-13 Thread Jerome Quelin

On Saturday 12 October 2002 17:56, Leopold Toetsch wrote:
  So, what else can I do? Catching exceptions (is that possible with
  Parrot)?
 Please have a look at list - not a PMC currently but can/does simulate
 intlist now for testing. just compile/link list instead of intlist.
 list_pop(...)

How should I change the default, and use list instead of intlist? But see 
below...


if (list-length == 0) {
 return 0;
}
 Would just need one if in list_pop  near the end of the file to return
 what you want for empty list.

My goal is to provide a Befunge interpreter that just does the right thing 
out of the box - that is, that does not need to patch Parrot in order to 
function.

Anyway, maybe the correct answer would be to create my own pmc class that 
would derive from your list, and that has the behaviour I want... But then 
the question would be: how should I do that?

And remember that I want to have a Befunge interpreter that works as is. 
ie, that uses only Parrot basics, and does not need to recompile...


Jerome
-- 
[EMAIL PROTECTED]



Re: Interfaces

2002-10-13 Thread Jonathan Scott Duff

On Fri, Oct 11, 2002 at 05:02:02PM -0700, Larry Wall wrote:
 On Fri, 11 Oct 2002, Michael Lazzaro wrote:
 : On Friday, October 11, 2002, at 04:11  PM, Larry Wall wrote:
 :has Nose $.snout;
 :has Ear  @.ears is cut(long);
 :has Leg  @.legs;
 :has Tail $.tail is cut(short);
 : 
 :method Wag () {...}
 :  }

I like has quite a bit.

 : 
 : What's the rationale again for the dot in $.snout?  Does it imply that 
 : it should be
 : 
 : method .Wag () {...}
 : 
 : to match?
 
 Yes, that's part of it, presuming you actually meant:
 
   method .snout () {...}

Actually, I think he meant

method .Wag () { ... }

Attribute declarations have their dots, why not methods?  or
something to that effect.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]



Re: popping an empty intlist

2002-10-13 Thread Steve Fink

On Sat, Oct 12, 2002 at 04:53:57PM +0200, Jerome Quelin wrote:
 But I have a problem. When popping a value from an empty list, I get a No 
 entries on list! exception. Instead, I want to get a zero. I can add 
 something like:
 
 CHECK_EMPTY:
   set I0, P2
   eq I0, 0, PUSH_ZERO
   ret
 PUSH_ZERO:
   push P2, 0 
   ret
 
 And then, before popping, I can add bsr CHECK_EMPTY...
 But that's clumsy IMHO.
 
 So, what else can I do? Catching exceptions (is that possible with Parrot)? 

Well, you could replace every 'pop I7, P2' with:

 set I7, P2
 unless I7, L1234
 pop I7, P2
L1234:
 ...program continues...

The two better answers are (1) create your own PMC subclassing the
IntList PMC, but override its pop() vtable entry with pasm code that
checks for emptiness first; or (2) wait until Leo makes Array and
PerlArray use list.c as their base implementations, and then you'll
get the speed advantage of IntList while still using what you're using
now. Note that #1 isn't possible yet either, and is probably a lot
further off. (Actually, I'm the one to blame for #2 not yet being
possible, because I've been stalling off committing Leo's PMC reorg
patch because it seemed like a bunch of bugs have recently crept into
the CVS tree, and I wanted a small set of recent changes to pore over
looking for the culprits.)



Re: Private contracts?

2002-10-13 Thread Larry Wall

On Fri, 11 Oct 2002, Trey Harris wrote:
: When you say subclass, do you mean below the current class in the
: naming heirarchy, i.e.
: 
:   class BTree;
:   our class Node {...}
: 
: would create BTree::Node?  Or do you really mean *subclass*, i.e., our
: class causes Node to inherit from BTree?  I hope it's the former, but the
: word subclass does usually imply inheritance

Sorry, I meant a class named within the current package, not a derived class.

Larry




Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Trey Harris

In a message dated Sun, 13 Oct 2002, Piers Cawley writes:
 I like that idea:

class SomeClass {
  method class_method ( Class $class: ... ) { ... }
  method instance_method  ( SomeClass $self : ... ) { ... }
  method dont_care_method (   $self : ... ) { ... }
}

I was going to say the same thing, but then I remembered that Perl 6
methods, unlike the sub 'methods' in Perl 5, won't get the invocant as the
first real argument--it will be the topic instead.  And I don't think you
can do multiple-dispatch on topic, can you?

Trey




Re: Private contracts?

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Larry Wall wrote:
: The precedence is screwed up though.  It'd have to be
: 
: use Acme[ (1;17..) | (2;0..) ];

Or maybe this:

use Acme[1;17..] |
Acme[2;0..];

That doesn't, of course, express any preference for one version over another,
since | logically happens in parallel universes, in constant time.  It also
doesn't let you pass different arguments to different versions.  It does, however,
let you try using differently named modules that provide the same interface:

use Acle[1;17..] |
Acme[1;13..] |
Acne[1;14..];

That syntax doesn't, however, let you alias the interface to a single name.
Hmm.

class MyAc is really(Acle[1;17..] | Acme[1;13..] | Acne[1;14..]);
use MyAc 1,2,3;

Seems a little odd to do the use on the alias, but it seems like it could
work.  I'm not quite sure when a class wave function collapses though...

Larry




Re: Private contracts?

2002-10-13 Thread Larry Wall

On Fri, 11 Oct 2002, Luke Palmer wrote:
: I now realize I'm a little fuzzy on the yada-yada-yada operator.  What
: exactly is it... or what does it do?  Is it a statement, an
: expression?

It's a term.

: Could you say things like:
: 
: foo(...);

Yes.

: (Admittedly I have no idea what that would mean)  Is it just something
: that does nothing?

Nope, it issues a warning (or maybe an exception) if you try to execute it.
It's basically for stubbing things out when you're doing rapid prototyping,
but that's kind of what is happening with forward declarations as well.

: sub f() {
: print Don't see me\n;
: }
: sub f() {
: # do other stuff
: }
: f;
: 
: Would do the same as using ... in the former? I hope not (though I
: suppose that's what Perl 5 does). Is it more special than that?

Well, redefining a function with {...} certainly shouldn't produce a
warning about redefinition.  Other than that, it should act similarly.

I was only half joking when I said we might have !!! and ??? as well.
Maybe ??? never complains and !!! always throws an exception.  Except
then everyone will be declaring their functions using !!! instead of ... .
Maybe !!! is the okay one, and ??? is warns, and ... is fatal.
But it seems mnemonic to identify !!! with $!, and ??? with something
that is questionable.  That would make ... a no-op.

But maybe we just stick with ... and make its behavior pragmatically
controllable.

Larry




Re: Private contracts?

2002-10-13 Thread Luke Palmer

 Date: Sat, 12 Oct 2002 08:43:46 -0700 (PDT)
 From: Larry Wall [EMAIL PROTECTED]

 If we use | and  as sugar for any() and all(), then their precedence
 should probably be the same as || and . 

Should they?  I had in mind something just above comparisons.  That
way:

if $x == 3 || $y == 4 {...}

and

if $x == 1 | 2 { ... }

both DWIM.  Is there a case for not doing this?

Luke



Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Me

I've looked before for discussion of the rationale behind
introducing attr/has and failed to find it. I noticed you
mention Zurich, so perhaps this decision followed from
discussion in living color (as against b+w).

Anyhow, what was deemed wrong with using my/our?

And...

 class Zap {
 my %.zap_cache; # a private classwide attribute
 our $.zap_count = 0; # a public classwide attribute

 has $.foo;
 has $.bar;
 }

 It may be that $.zap_count is public not so much because of the class
definition
 where it would default to private, but because $.zap_count's real
global name is
 $Zap::.zap_count.  To get a public accessor method you might still
need to declare
 it public.  And you could get a public accessor method to the my
variable as well
 the same way.

So:

class Zap {
  my %zap_cache; # var, lexical
  my %.zap_cache;# class attr, lexical
  my %.zap_cache is public;  # class attr, lexical/public
  our $zap_count = 0;# var, lexical/global
  our $.zap_count = 0;   # class attr, lexical/global
  our $.zap_count = 0 is public; # class attr, lexical/public/global
  has $.foo; # instance attr, lexical
  has $.bar is public;   # instance attr, lexical/public
}

Yes?

What about something like:

  my  $.foo;   # private instance attr
  our $.foo;   # public  instance attr

  my  $foo;# as p5
  our $foo;# as p5

  MY  $.foo;   # private class attr
  OUR $.foo;   # public class attr

  MY  $foo;# invalid?
  OUR $foo;# invalid?

  method bar;  # public  instance method
  my  method bar;  # private instance method
  our method bar;  # public  instance method
  MY  method bar;  # private classmethod
  OUR method bar;  # public  classmethod

--
ralph




Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Me

 Nothing the matter with our for class attributes since they're
 already stored in the package if we follow Perl 5's lead.  But using
 my for instance attributes is problematic if we allow a class to
 be reopened:
 
 class Blurfl {
 my $.foo;
 }
 ...
 class Blurfl is continued {
 print $.foo;
 }
 
 This violates the Perl 6 rule that my is always limited to a block.
 That's why we came up with attr, which has since mutated to has.

[snip]

 It's my gut feeling that class variables are already pretty close to
 our variables, so we only need a new word for instance variables,
 which have a very different scope from any variables in Perl 5.

Ok.

We also need a signifier for class methods (assuming
a distinction is made).

Perhaps one could use an initial cap to indicate a class
attribute/method:

  class foo {
  my  $bar;# my is not used for attributes
  our $baz;# neither is our
  has qux; # instance attribute 
  has Waldo;   # class attribute
  method qwe;  # instance method
  method Rty;  # class method
  }

or similar.

--
ralph



Re: Private contracts?

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Luke Palmer wrote:
:  Date: Sat, 12 Oct 2002 08:43:46 -0700 (PDT)
:  From: Larry Wall [EMAIL PROTECTED]
: 
:  If we use | and  as sugar for any() and all(), then their precedence
:  should probably be the same as || and . 
: 
: Should they?  I had in mind something just above comparisons.  That
: way:
: 
:   if $x == 3 || $y == 4 {...}
: 
: and
: 
:   if $x == 1 | 2 { ... }
: 
: both DWIM.  Is there a case for not doing this?

Mmm, only a precedence simplification case.  I'd forgotten about
the comparison ops.  Right above them is probably a good place.

Larry




Re: Interfaces

2002-10-13 Thread Larry Wall

On Thu, 10 Oct 2002, Larry Wall wrote:
: Anyway, I don't see offhand why composition can't simply be done with
: attributes as it is in C++, especially since attributes manifest as
: methods outside the class.  I don't think $car.cd.eject() is all that
: horrible to contemplate.

By the way, ever since we came up with attr in Zurich, I've been
hating it more and more.  I'm thinking that has reads a lot better:

class Dog is Mammal {
has Nose $.snout;
has Ear  .ears is cut(long);
has Leg  .legs;
has Tail $.tail is cut(short);

method Wag () {...}
}

Or, along the lines of my lists:

class Dog is Mammal {
has (
Nose $.snout,
Ear  .ears is cut(long),
Leg  .legs,
Tail $.tail is cut(short),
);

method Wag () {...}
}

Larry




Re: Interfaces

2002-10-13 Thread Michael Lazzaro


On Friday, October 11, 2002, at 04:11  PM, Larry Wall wrote:
   has Nose $.snout;
   has Ear  .ears is cut(long);
   has Leg  .legs;
   has Tail $.tail is cut(short);

   method Wag () {...}
 }

What's the rationale again for the dot in $.snout?  Does it imply that 
it should be

method .Wag () {...}

to match?

MikeL




Re: Private contracts?

2002-10-13 Thread chromatic

On Sat, 12 Oct 2002 08:43:46 -0700, Larry Wall wrote:

 On Sat, 12 Oct 2002, Graham Barr wrote:
 : Or even something like
 :
 :   use Acme[1.0];
 
 Hmm.  Looks kinda like a subscript, which could be sliced to give an
 acceptable version range:
 
 use Acme[1;0..];

Might it be possible to say use any installed version of Acme below 2.0?

use Acme[..2;0];

That could also be helpful.

-- c



Re: perl6 operator precedence table

2002-10-13 Thread Larry Wall

On Fri, 11 Oct 2002, Dan Sugalski wrote:
: I think that, for me at least, it'll be close enough to C to be 
: really confusing. (I already have the problem of leaving parens off 
: of my function calls when I write XS code...) There's a certain 
: appeal to not having to swap in almost-but-not-quite-the-same sets of 
: punctuations when moving from language to language.

And now for something completely not quite different...

bits($x  $y)
bits($x | $y)

That is, bits() could just be a function that takes a superposition
and interprets it as bitops, which makes an odd kind of sense.
Or we could fix the if this number was never used as a string
problem by differentiating integer ops from string ops:

intbits($x  $y)
intbits($x | $y)
strbits($x  $y)
strbits($x | $y)

One could maybe shrink that down to

int($x  $y)
int($x | $y)
str($x  $y)
str($x | $y)

Except that's not really much different than:

+($x  $y)
+($x | $y)
_($x  $y)
_($x | $y)

And that would conflict with Damian's current notions of how superpositions
behave in numeric or string context.  Still, you can see how

bits(1|2|4|8)

could be made to work even if it really meant

bits(any(1,2,4,8))

Larry, still thinking about a language vaguely resembling Perl 5.  :-)




Re: Is Parrot in a stable state?

2002-10-13 Thread Jerome Quelin

On Sunday 13 October 2002 12:11, Leopold Toetsch wrote:
 Jerome Quelin wrote:
  eq S0, , FLOW_GO_WEST
 [ branch not taken ]
  And while I'm talking about strange things... Due to the fact that Parrot
  does not branch to the correct label,
 As strings are involved, could you insert:
   sweepoff
   collectoff
 as the very first instructions, your interpreter executes?

Using those instructions make the whole work, hurray! :-)


 It would also be a good idea, to provide the instructions/files, where
 you have this broken behaviour, so that other people can try to
 reproduce this problem.

Ok, here is the complete thing.
$ rsync -avz --delete cvs.perl.org::parrot-HEAD parrot 
$ cd parrot
$ perl Configure.pl --debugging
$ make
[...]
$ make test
[...]
All tests successful, 5 subtests skipped.
Files=29, Tests=457, 192 wallclock secs (154.47 cusr + 17.44 csys = 171.91 
CPU)
$ cd languages/Befunge-93
== apply the patch provided (but not on the master CVS :-)
== or add the traces yourself on line 57 in befunge.pasm
$ perl ../../assemble.pl befunge.pasm  befunge.pbc
$ ../../parrot  befunge.pbc -v test.bef | less
== Look for the string before []
== There should be the following line just before:
(9,8) - '' (ord=60) dir=2   stack=

If you want details, I'm on IRC rhizomatic#parrot

Jerome
-- 
[EMAIL PROTECTED]


? befunge-add-traces.patch
Index: befunge.pasm
===
RCS file: /cvs/public/parrot/languages/Befunge-93/befunge.pasm,v
retrieving revision 1.2
diff -u -d -r1.2 befunge.pasm
--- befunge.pasm	14 Sep 2002 13:56:44 -	1.2
+++ befunge.pasm	13 Oct 2002 15:22:58 -
@@ -54,7 +54,13 @@
 eq S0, ^, FLOW_GO_NORTH
 eq S0, , FLOW_GO_EAST
 eq S0, v, FLOW_GO_SOUTH
+print before [
+print S0
+print ]\n
 eq S0, , FLOW_GO_WEST
+print after  [
+print S0
+print ]\n
 eq S0, ?, FLOW_GO_AWAY
 
 # Flow control.
Index: befunge.pbc
===
RCS file: /cvs/public/parrot/languages/Befunge-93/befunge.pbc,v
retrieving revision 1.2
diff -u -d -r1.2 befunge.pbc
Binary files /tmp/cvsVaYITO and befunge.pbc differ



Is Parrot in a stable state?

2002-10-13 Thread Jerome Quelin

From my point of view - it isn't.

As I said in an earlier post, my Befunge interpreter is broken. It was doing 
well not so long ago. Anyway, since I wanted to add intlists and push/pop, I 
made some modifications. But I can't test them, since Parrot seems to be 
badly broken...

At first, I thought maybe I made some mistakes. But then I added some traces 
here and there, and I ended up with:

print before [
print S0
print ]\n
eq S0, , FLOW_GO_WEST
print after  [
print S0
print ]\n


The initial code was the line with the eq op.

Then I ran it, and got (amongst other traces):

(9,8) - '' (ord=60) dir=2   stack=
before []
after  []

 
That is, the branch does not seem to happen!

But it's even weirder than that... The first instruction of my test is indeed 
a  instruction (go west), and the interpreter then behaves correctly!

And while I'm talking about strange things... Due to the fact that Parrot 
does not branch to the correct label, I have an infinite loop (of course, 
since the program flow does not follow the wanted path). Sometimes Parrot 
loops infinitely, and sometimes it crashes with a segfault. I must say that I 
don't push elements during the infinite loop, it is an infinite loop of 
no-ops.

FYI, I just rsync'ed this afternoon (12/10/2002 14:52 GMT) my Parrot, and did 
the traditionnal: perl Configure.pl ; make; make test
and yes, all the tests went ok...

So, when I ask Is Parrot in a stable state?, it's in fact not a question - 
I have my answer, and it's definitely a NO answer.

I don't know where the problem lies. And I really think it's Parrot, since my 
interpreter was broken when I rsync'ed my version of Parrot, although it was 
performing well before. Before here means sthg about two or three weeks (I 
know it's quite a long time), since I haven't looked at Parrot since.

If someone wants to investigate the problem but is afraid of Befunge (one 
could wonder why Befunge would scare someone :-) ), just ask... 


Jerome, in a very perplexed mind
-- 
[EMAIL PROTECTED]



Re: Is Parrot in a stable state?

2002-10-13 Thread Jerome Quelin

On Sunday 13 October 2002 12:16, Steve Fink wrote:
 On Sat, Oct 12, 2002 at 07:29:04PM +0200, Jerome Quelin wrote:
  FYI, I just rsync'ed this afternoon (12/10/2002 14:52 GMT) my Parrot, and
  did the traditionnal: perl Configure.pl ; make; make test
  and yes, all the tests went ok...
 I'll look into it, but could you try doing a make clean first? The
 problem you are describing sounds suspiciously like the symptoms of
 ops getting renumbered, as recently happened when I deleted a bunch of
 two-arg ne and eq variants. If only we had a makefile with a complete
 dependency graph...

I already make clean, since Brent asked me to compile my parrot with 
--debugging. make clean, perl Configure.pl --debugging ; make ; make test and 
then make test in languages/Befunge-93 is still borken. 
Look at my precedent post to Leopold Toetsch.

Jerome
-- 
[EMAIL PROTECTED]



Re: Draft Proposal: Declaring Classwide Attributes

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Me wrote:
: I've looked before for discussion of the rationale behind
: introducing attr/has and failed to find it. I noticed you
: mention Zurich, so perhaps this decision followed from
: discussion in living color (as against b+w).
: 
: Anyhow, what was deemed wrong with using my/our?

Nothing the matter with our for class attributes since they're
already stored in the package if we follow Perl 5's lead.  But using
my for instance attributes is problematic if we allow a class to
be reopened:

class Blurfl {
my $.foo;
}
...
class Blurfl is continued {
print $.foo;
}

This violates the Perl 6 rule that my is always limited to a block.
That's why we came up with attr, which has since mutated to has.

: And...
: 
:  class Zap {
:  my %.zap_cache; # a private classwide attribute
:  our $.zap_count = 0; # a public classwide attribute
: 
:  has $.foo;
:  has $.bar;
:  }
: 
:  It may be that $.zap_count is public not so much because of the class
: definition
:  where it would default to private, but because $.zap_count's real
: global name is
:  $Zap::.zap_count.  To get a public accessor method you might still
: need to declare
:  it public.  And you could get a public accessor method to the my
: variable as well
:  the same way.
: 
: So:
: 
: class Zap {
:   my %zap_cache; # var, lexical
:   my %.zap_cache;# class attr, lexical
:   my %.zap_cache is public;  # class attr, lexical/public
:   our $zap_count = 0;# var, lexical/global
:   our $.zap_count = 0;   # class attr, lexical/global
:   our $.zap_count = 0 is public; # class attr, lexical/public/global
:   has $.foo; # instance attr, lexical
:   has $.bar is public;   # instance attr, lexical/public
: }
: 
: Yes?

No yes till Apo 12.  :-)

And probably not yes then.  These are all provisional notions.
Note that attr only lasted a month...but then, I said when I made
it up in Zurich that it was a placeholder because I couldn't think of
anything better.  And the whole public/private thing is a placeholder
for whatever we eventually come up with to deal with access control.
We're just as likely to end up with is rw or some such, especially
if we decide to allow you to declare attributes that are readable
but not writeable through the class interface.

: What about something like:
: 
:   my  $.foo;   # private instance attr
:   our $.foo;   # public  instance attr
: 
:   my  $foo;# as p5
:   our $foo;# as p5
: 
:   MY  $.foo;   # private class attr
:   OUR $.foo;   # public class attr
: 
:   MY  $foo;# invalid?
:   OUR $foo;# invalid?
: 
:   method bar;  # public  instance method
:   my  method bar;  # private instance method
:   our method bar;  # public  instance method
:   MY  method bar;  # private classmethod
:   OUR method bar;  # public  classmethod

Doesn't do much for me.  I think it's a mistake to overload my/our with
private/public distinctions because we might also want to distinguish
read/write.  More subtly, it changes the me of my/our to mean the
current object or class rather than the current lexical scope, which
is going to be intrinsically confusing.

Plus it's not clear that class attributes are worth SHOUTING over.

It's my gut feeling that class variables are already pretty close to
our variables, so we only need a new word for instance variables,
which have a very different scope from any variables in Perl 5.
Plus I like emphasizing the has/is distinction to help keep people
from using inheritance when they should be using composition.

At least, that's what I like this week...

Larry




Re: Interfaces

2002-10-13 Thread Larry Wall

On Fri, 11 Oct 2002, Larry Wall wrote:
: You can certainly drop it within the methods,
: since there's also the accessor methods.

But I should point out that there's a semantic difference between
$.foo and .foo, in that $.foo is guaranteed to get my copy of the
attribute, while .foo might just go haring off after a virtual method
in a subclass, if the subclass puts a wrapper method around this
class's .foo method.

Larry




Re: Draft Proposal: Attributes: public vs. private

2002-10-13 Thread John Williams

On Sat, 12 Oct 2002, Larry Wall wrote:
 On Sat, 5 Oct 2002, John Williams wrote:
 : Personally, I hope they look like attributes.

 They will, outside the class anyway.  Inside it's $.foo.

 : But if they do, the perl5
 : lvalue subs are not the way to do it.  Why?  Because an lvalue sub returns
 : a lvalue which get set _after_ the sub returns.  At that point it is too
 : late for the sub to do anything useful with the new value.

 Lvalue methods will have some kind of optional property which specifies
 a closure to execute after the modification happens.

 method foo {
   my $handle = find_database(random criteria);
   return $handle.fetch();

   WRITE {
   $handle.store(shift);
   }
 }

 Or some such.  Note how the internal block allows capture of the $handle from
 the original closure.   (A READ closure was also discussed in Zurich.)

That looks good.  I was actually imagining some sort of tie-like routine
which would be called whenever the variable was accessed.

   method foo is accessor ($stuff_i_might_need_to_know, $new_value) {
  if exists($new_value) {
 ...
 $.foo = $new_value;
  }
  ...
  return $.foo;
   }

lvalue methods still seem to work in reverse to me though.  If I say
   $x = $object.foo = $y;
then first an lvalue accessor returns an object to receive the value of
$y.  Next the write (oh by the way...) closure is called.  Finally the
value of $y is passed on to $x, but its too late for foo to change its
mind about what its own value will be if something in write{} caused the
collapse of its quantum state.

An accessor like the above could return a different value than it was
given, which would admittedly be an odd thing to do, but perl users being
what they are, someone would think of a reason to do it.

By the way, which apocalypse will describe how properties work?
It seems like they will need some similar way of taking control when a
variable or value (or method or class or whatever) is accessed.

~ John Williams





Re: perl6 operator precedence table

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Dan Kogai wrote:
: Objection, your honor.
: 
: perl5 ($x  $y) might be uncommon enough to justify this.  But how 
: about = vs. =, |= vs. ||= ?  Those are both used very often so by 
: saving one symbol we lose consistency.

Ouch.  You're right.  That's a bit of a problem for bits($x | $y) too.

Hmm.

a ^|||= 1;
a ^bor= 1;
a ^.|= 1;

Yow.  Those are all pretty ugly.  But the first one is the least ugly.
And I really do like | for any().  And I can see using it like this:

cases ^|= newcases;

to mean

for cases | newcases - $x is rw | $y {
$x = any($x, $y);
}

Another question is whether using a superposition to represent parallel
streams in for is doing the any concept too much violence.  Really,
it's more of a hyper-any, at least on the left:

for cases ^| newcases - $x is rw | $y {...}

But note that ^ automatically gives us the shorter of the two lists.

Maybe...

Just thinking...  :-)

Larry




Re: Private contracts?

2002-10-13 Thread Chris Dutton

On Saturday, October 12, 2002, at 01:10  PM, Luke Palmer wrote:

 Date: Sat, 12 Oct 2002 08:43:46 -0700 (PDT)
 From: Larry Wall [EMAIL PROTECTED]

 If we use | and  as sugar for any() and all(), then their precedence
 should probably be the same as || and .

 Should they?  I had in mind something just above comparisons.  That
 way:

   if $x == 3 || $y == 4 {...}

 and

   if $x == 1 | 2 { ... }

 both DWIM.  Is there a case for not doing this?

Just a thought, but don't we already have this with the smart match 
operator?

if $x =~ (1, 2) { ... }

Or would  and | be a bit more strict in use, and thus easier for the 
compiler to optimize?  For instance, would we be able to:

if $x == 1 | hello { ... }

or would both operands have to be of the same type?




Re: Private contracts?

2002-10-13 Thread Larry Wall

On Sat, 12 Oct 2002, Graham Barr wrote:
: Or even something like
: 
:   use Acme[1.0];

Hmm.  Looks kinda like a subscript, which could be sliced to give an
acceptable version range:

use Acme[1;0..];

Except slices aren't powerful enough to say what you really want to say:

use Acme[1;17.. | 2;0..];

Er, or maybe they are now...

The precedence is screwed up though.  It'd have to be

use Acme[ (1;17..) | (2;0..) ];

If we use | and  as sugar for any() and all(), then their precedence
should probably be the same as || and .  But that still doesn't
help for superposed slices or lists, since commas and semicolons are
lower precedence yet.  I'm afraid any() and all() don't help either.

Please don't anyone suggest special low-precedence versions...

Larry




[perl #17896] [PATCH] PerlHash tests

2002-10-13 Thread via RT

# New Ticket Created by  Simon Glover 
# Please include the string:  [perl #17896]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17896 



 This patch:

  i)  Adds several new tests for PerlHash, specifically:
  - storing scalar PMCs, and retrieving their values into PMC
  registers and into INT/NUM/STRING registers as appropriate

  (Some of this is already tested in the clone test, but really
   deserves a stand-alone test)

  - retrieving undefined values

  - if (PerlHash), unless(PerlHash)

  ii) Removes one test -- the former test no. 1 -- which tests exactly the
  same functionality as a (more complete) later test

  iii) Reorders the tests into a more rational order: we now test simple
  things (like getting  setting STRINGs, INTs  NUMs) near the top, and
  more complex things (clone, compound keys etc.) near the end. I find
  this makes it easier to figure out what we're actually testing.

 Simon

--- t/pmc/perlhash.t.oldSun Oct 13 10:48:53 2002
+++ t/pmc/perlhash.tSun Oct 13 12:04:26 2002
 -1,27 +1,59 
 #! perl

-use Parrot::Test tests = 17;
+use Parrot::Test tests = 21;
 use Test::More;

-output_is('CODE', OUTPUT, simple set / get);
-   new P0, .PerlHash
-   set S0, one
-   set S1, two
+output_is(CODE, OUTPUT, Initial PerlHash tests);
+   new P0, .PerlHash

-   set P0[S0], 1   # $P0{one} = 1
-   set P0[S1], 2   # $P0{two} = 2
+   set P0[foo], -7
+   set P0[bar], 3.5
+   set P0[baz], value

-   set I0, P0[S0]
-   set I1, P0[S1]
+   set I0, P0[foo]
+   set N0, P0[bar]
+   set S0, P0[baz]
+
+   eq  I0,-7,OK_1
+   print   not 
+OK_1:  print   ok 1\\n
+   eq  N0,3.50,OK_2
+   print   N0
+OK_2:  print   ok 2\\n
+   eq  S0,value,OK_3
+   print   S0
+OK_3:  print   ok 3\\n
+
+set S1, oof
+set S2, rab
+set S3, zab
+
+   set P0[S1], 7
+   set P0[S2], -3.5
+   set P0[S3], VALUE
+
+   set I0, P0[S1]
+   set N0, P0[S2]
+   set S0, P0[S3]
+
+   eq  I0,7,OK_4
+   print   not 
+OK_4:  print   ok 4\\n
+   eq  N0,-3.50,OK_5
+   print   N0
+OK_5:  print   ok 5\\n
+   eq  S0,VALUE,OK_6
+   print   S0
+OK_6:  print   ok 6\\n

-   print I0
-   print \n
-   print I1
-   print \n
end
 CODE
-1
-2
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
 OUTPUT

 output_is('CODE', OUTPUT, more than one PerlHash);
 -111,6 +143,21  CODE
 2
 OUTPUT

+# NB Next test depends on key2 hashing to zero, which it does with
+# the current algorithm; if the algorithm changes, change the test!
+
+output_is('CODE', OUTPUT, key that hashes to zero);
+new P0, .PerlHash
+set S0, key2
+set P0[S0], 1
+set I0, P0[S0]
+   print I0
+   print \n
+   end
+CODE
+1
+OUTPUT
+
 output_is('CODE', OUTPUT, size of the hash);
new P0, .PerlHash

 -136,50 +183,6  CODE
 2
 OUTPUT

-
-# NB Next test depends on key2 hashing to zero, which it does with
-# the current algorithm; if the algorithm changes, change the test!
-
-output_is('CODE', OUTPUT, key that hashes to zero);
-new P0, .PerlHash
-set S0, key2
-set P0[S0], 1
-set I0, P0[S0]
-   print I0
-   print \n
-   end
-CODE
-1
-OUTPUT
-
-output_is(CODE, OUTPUT, Initial PerlHash tests);
-   new P0, .PerlHash
-
-   set P0[foo], -7
-   set P0[bar], 3.5
-   set P0[baz], value
-
-   set I0, P0[foo]
-   set N0, P0[bar]
-   set S0, P0[baz]
-
-   eq  I0,-7,OK_1
-   print   not 
-OK_1:  print   ok 1\\n
-   eq  N0,3.50,OK_2
-   print   N0
-OK_2:  print   ok 2\\n
-   eq  S0,value,OK_3
-   print   S0
-OK_3:  print   ok 3\\n
-
-   end
-CODE
-ok 1
-ok 2
-ok 3
-OUTPUT
-
 output_is(CODE, OUTPUT, stress test: loop(set, check));
new P0, .PerlHash

 -288,21 +291,6  CODE
 done
 OUTPUT

-output_is(CODE, OUTPUT, String as keys);
-new P0,.PerlHash
-new P1,.PerlArray
-new P2,.PerlArray
-set P1[4],string
-set P0[one],P1
-set P2,P0[one]
-set S0,P2[4]
-print S0
-print \\n
-end
-CODE
-string
-OUTPUT
-
 output_is('CODE', OUTPUT, Testing two hash indices with integers at a time);
   new P0, .PerlHash

 -411,6 +399,138  ok 3
 ok 4
 OUTPUT

+
+# So far, we've only used INTVALs, FLOATVALs and STRINGs as values
+# and/or keys. Now we try PMCs.
+
+output_is('CODE', OUTPUT, Setting  getting scalar PMCs);
+  new P0, .PerlHash
+  new P1, .PerlInt
+  new P2, .PerlInt
+
+  set S0, non-PMC key
+
+  set P1, 10
+  set P0[S0], P1
+  set P2, P0[S0]
+  eq P2, P1, OK1
+  print not 
+OK1:  print ok 1\n
+
+  set P1, -1234.00
+  set P0[S0], P1
+   

Re: signal 11 when run on x86, JIT enabled

2002-10-13 Thread Nicholas Clark

On Sun, Oct 13, 2002 at 03:06:48AM -0700, Steve Fink wrote:
 On Fri, Oct 11, 2002 at 05:05:56PM -0700, Joe Wilson wrote:
  Perhaps this is a known issue...
  
  Most parrot programs seem to crash on x86 when the latest CVS parrot 
  is compiled with -O2 or -g -O2 and when JIT is enabled.
  The programs appear to run to completion and only crash prior to exitting.
  Repeatable on both Cygwin and Linux x86.
  When JIT is not used, everything is fine.
 
 Ugh. That was a hairy one to track down. I have committed a fix. The
 cause of the above problem was that the JIT was trampling over some
 x86 registers that are supposed to be callee-saved in the cdecl
 calling convention. By the time I finally figured that out, though, I
 had fixed several other pretty major bugs in the jit.

I'm seeing this on x86 FreeBSD with the JIT:

t/op/interp.NOK 2# Failed test (t/op/interp.t at line 21)
Use of uninitialized value in concatenation (.) or string at lib/Test/Builder.pm
 line 999.
#   'ok 1   
# ok 2
# ok 3
# ok 3
# '
# doesn't match '/^ok\s1\n
# (?:PC=8.*)?\n
# ok\s2\n
# (?:PC=11.*)?\n
# (?:PC=13.*)?\n
# ok\s3\n$/x
# '
# Looks like you failed 1 tests of 2.
t/op/interp.dubious 
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 2
Failed 1/2 tests, 50.00% okay

is this to be expected? It's now the only regression test that fails under
the JIT. Previously I think several were, but I can't remember for sure.

Nicholas Clark
-- 
Even better than the real thing:http://nms-cgi.sourceforge.net/



[perl #17899] [PATCH] .include macros (and misc. documentation)

2002-10-13 Thread via RT

# New Ticket Created by  Simon Glover 
# Please include the string:  [perl #17899]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17899 



  This patch:

  1) Fixes some minor nits in the assembler documentation (mostly POD
  formatting issues)

  2) Documents the .include macro

  3) Fixes a bug in the code that handles includes: we weren't stripping
  off extraneous whitespace, so macros in included files weren't being
  recognised as such.

  4) Adds two tests for .include to macro.t

 NB Patches attached rather than appended, in an effort to avoid mailer
 mangling

 Simon




-- attachment  1 --
url: http://rt.perl.org/rt2/attach/39757/32183/2bd328/ass.patch

-- attachment  2 --
url: http://rt.perl.org/rt2/attach/39757/32184/49a883/mac.patch



--- assemble.pl.old Sun Oct 13 16:19:11 2002
+++ assemble.pl Sun Oct 13 17:59:15 2002
 -1,6 +1,6 
 #!/usr/bin/perl -w
 
-=head2 Parrot Assembler
+=head1 Parrot Assembler
 
 The Parrot Assembler's job is to take .pasm (Parrot Assembly) files and assemble
 them into Parrot bytecode. Plenty of references for Parrot assembly syntax
 -22,9 +22,9  accumulates the (finally completely nume
 The XS portion takes the constants and bytecode, generates a header, tacks the
 constants and bytecode on, and finally prints out the string.
 
-=head1 Macro
+=head2 Macro
 
-The Parrot assebler's macro layer has now been more-or-less defined, with one
+The Parrot assembler's macro layer has now been more-or-less defined, with one
 or two additions to come. The addition of the '.' preface will hopefully make
 things easier to parse, inasmuch as everything within an assembler file that
 needs to be expanded or processed by the macro engine will have a period ('.')
 -132,6 +132,8  use Parrot::PMC qw(%pmc_types);
 
 =head2 Macro class
 
+=over 4
+
 =item new
 
 Create a new Macro instance. Simply take the argument list and treat it as a
 -145,7 +147,7  sub new {
   my $self;
   #
   # Read the files, strip leading and trailing whitespace, and put the lines
-  # into an array in $self-{contents}.
+  # into an array in $self-{cur_contents}.
   #
   for(_) {
 open FILE, $_ or
 -207,33 +209,54  compilation.
   .constant name {string constant}
   .constant name {'string constant'}
 
-Are removed from the array. Given the line:
+are removed from the array. Given the line:
+
+  '.constant HelloWorld Hello, World!'
+
+one can expand HelloWorld via:
+
+  'print .HelloWorld' # Note the period to indicate a thing to expand.
+
+Some predefined constants exist for your convenience, namely:
+
+  .Array
+  .PerlHash
+  .PerlArray
+
+and the other PMC types.
+(This should be generated from include/parrot/pmc.h, but isn't at the moment.)
+
+The contents of external files can be included by use of the C.include 
+macro:
 
-'.constant HelloWorld Hello, World!'
+  .include {filename} 
 
-One can expand HelloWorld via:
+The contents of the included file are inserted at the point where the
+C.include macro occurs. This means that code like this:
 
-'print .HelloWorld' # Note the period to indicate a thing to expand.
+  print Hello 
+  .include foo.pasm
+  end
+
+where Ffoo.pasm contains:
 
-Some predefined constants exist for your convenience, namely:
+  print World \n
 
-  .Array
-  .PerlHash
-  .PerlArray
-  and the other PMC types.
+becomes:
 
-This should be generated from include/parrot/pmc.h, but isn't at the moment.
-A .include should be added, but currently is awaiting more time and sleep.
+  print Hello 
+  print World \n
+  end
 
-  .include {file name} # Not quite ready.
+Attempting to include a non-existent file is a non-fatal error.
 
   .macro name ({arguments?})
   ...
   .endm
 
-Optional arguments are simply identifiers separated by commas. These
-arguments are matched to instances inside the macro named '.foo'. A
-simple example follows:
+Optional arguments are simply identifiers separated by commas. These
+arguments are matched to instances inside the macro named '.foo'. A
+simple example follows:
 
   .macro inc3 (A,BLAM)
 inc .A # Mark the argument to expand with a '.'.
 -292,6 +315,7  sub preprocess {
 my include;
 while(FOO) {
   chomp;
+  s/(^\s+|\s+$)//g;# Need to strip leading  trailing whitespace
   push(include,$_);
 }
 unshift(todo,include);
 -381,6 +405,8  sub preprocess {
 Access the C$self-{contents} internal array, where the post-processed data
 is stored.
 
+=back
+
 =cut
 
 sub contents {
 -404,6 +430,8  use Parrot::Config;
 
 =head2 Assembler class
 
+=over 4
+
 =item new
 
 Create a new Assembler instance.
 -908,6 +936,8  internal PC 

[perl #17901] [PATCH] More PMC tests

2002-10-13 Thread via RT

# New Ticket Created by  Simon Glover 
# Please include the string:  [perl #17901]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17901 



  Patch below adds tests for the eq, ne, lt, le, gt, ge  neg ops for
  PerlInts and PerlNums.

  Simon

--- t/pmc/pmc.t.old Sun Oct 13 16:31:50 2002
+++ t/pmc/pmc.t Sun Oct 13 19:38:22 2002
 -1,6 +1,6 
 #! perl -w

-use Parrot::Test tests = 72;
+use Parrot::Test tests = 79;
 use Test::More;
 use Parrot::PMC qw(%pmc_types);

 -1616,4 +1616,389  CODE
 All names and ids ok.
 OUTPUT

+output_is('CODE', OUTPUT, eq_p_p);
+  new P0, .PerlInt
+  new P1, .PerlInt
+
+  set P0, 10
+  set P1, 10
+
+  eq P0, P1, OK1
+  print not 
+OK1:  print ok 1\n
+
+  set P0, 11
+  eq P0, P1, BAD2
+  branch OK2
+BAD2: print not ok 2\n
+OK2:  print ok 2\n
+
+  new P0, .PerlNum
+  new P1, .PerlNum
+
+  set N0, 4.5
+  set P0, N0
+  set P1, N0
+
+  eq P0, P1, OK3
+  print not 
+OK3:  print ok 3\n
+
+  set P0, 0.0
+  eq P0, P1, BAD4
+  branch OK4
+BAD4: print not ok 4\n
+OK4:  print ok 4\n
+
+  new P0, .PerlString
+  new P1, .PerlString
+
+  set S0, Artichoke
+  set P0, S0
+  set P1, S0
+
+  eq P0, P1, OK5
+  print not 
+OK5:  print ok 5\n
+
+  set P0, Cabbage
+  eq P0, P1, BAD6
+  branch OK6
+BAD6: print not ok 6\n
+OK6:  print ok 6\n
+  end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+OUTPUT
+
+output_is('CODE', OUTPUT, ne_p_p);
+  new P0, .PerlInt
+  new P1, .PerlInt
+
+  set P0, 1
+  set P1, 11
+
+  ne P0, P1, OK1
+  print not 
+OK1:  print ok 1\n
+
+  set P0, 11
+  ne P0, P1, BAD2
+  branch OK2
+BAD2: print not ok 2\n
+OK2:  print ok 2\n
+
+  new P0, .PerlNum
+  new P1, .PerlNum
+
+  set N0, 4.5
+  set P0, N0
+  set P1, 0.0
+
+  ne P0, P1, OK3
+  print not 
+OK3:  print ok 3\n
+
+  set P1, N0
+  ne P0, P1, BAD4
+  branch OK4
+BAD4: print not ok 4\n
+OK4:  print ok 4\n
+
+  new P0, .PerlString
+  new P1, .PerlString
+
+  set S0, Artichoke
+  set P0, S0
+  set P1, Artichoke...
+
+  ne P0, P1, OK5
+  print not 
+OK5:  print ok 5\n
+
+  set P1, S0
+  ne P0, P1, BAD6
+  branch OK6
+BAD6: print not ok 6\n
+OK6:  print ok 6\n
+  end
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+OUTPUT
+
+output_is('CODE', OUTPUT, lt_p_p);
+  new P0, .PerlInt
+  new P1, .PerlInt
+
+  set P0, 1
+  set P1, -1
+
+  lt P1, P0, OK1
+  print not 
+OK1:  print ok 1\n
+
+  lt P0, P1, BAD2
+  branch OK2
+BAD2: print not ok 2\n
+OK2:  print ok 2\n
+
+  lt P1, P1, BAD3
+  branch OK3
+BAD3: print not ok 3\n
+OK3:  print ok 3\n
+
+  new P2, .PerlNum
+  new P3, .PerlNum
+
+  set P2, 12.49
+  set P3, 12.5
+
+  lt P2, P3, OK4
+  print not 
+OK4:  print ok 4\n
+
+  lt P3, P2, BAD5
+  branch OK5
+BAD5: print not ok 5\n
+OK5:  print ok 5\n
+
+  lt P3, P3, BAD6
+  branch OK6
+BAD6: print not ok 6\n
+OK6:  print ok 6\n
+
+  end
+
+
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+OUTPUT
+
+output_is('CODE', OUTPUT, le_p_p);
+  new P0, .PerlInt
+  new P1, .PerlInt
+
+  set P0, 1
+  set P1, -1
+
+  le P1, P0, OK1
+  print not 
+OK1:  print ok 1\n
+
+  le P0, P1, BAD2
+  branch OK2
+BAD2: print not ok 2\n
+OK2:  print ok 2\n
+
+  le P1, P1, OK3
+  print not 
+OK3:  print ok 3\n
+
+  new P2, .PerlNum
+  new P3, .PerlNum
+
+  set P2, 12.49
+  set P3, 12.5
+
+  le P2, P3, OK4
+  print not 
+OK4:  print ok 4\n
+
+  le P3, P2, BAD5
+  branch OK5
+BAD5: print not ok 5\n
+OK5:  print ok 5\n
+
+  le P3, P3, OK6
+  print not 
+OK6:  print ok 6\n
+
+  end
+
+
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+OUTPUT
+
+output_is('CODE', OUTPUT, gt_p_p);
+  new P0, .PerlInt
+  new P1, .PerlInt
+
+  set P0, 10
+  set P1, 0
+
+  gt P0, P1, OK1
+  print not 
+OK1:  print ok 1\n
+
+  gt P1, P0, BAD2
+  branch OK2
+BAD2: print not ok 2\n
+OK2:  print ok 2\n
+
+  gt P1, P1, BAD3
+  branch OK3
+BAD3: print not ok 3\n
+OK3:  print ok 3\n
+
+  new P2, .PerlNum
+  new P3, .PerlNum
+
+  set P2, 1000.0
+  set P3, 100.0
+
+  gt P3, P2, OK4
+  print not 
+OK4:  print ok 4\n
+
+  gt P2, P3, BAD5
+  branch OK5
+BAD5: print not ok 5\n
+OK5:  print ok 5\n
+
+  gt P3, P3, BAD6
+  branch OK6
+BAD6: print not ok 6\n
+OK6:  print ok 6\n
+
+  end
+
+
+CODE
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+OUTPUT
+
+output_is('CODE', OUTPUT, ge_p_p);
+  new P0, .PerlInt
+  new P1, .PerlInt
+
+  set P0, 10
+  set P1, 0
+
+  ge P0, P1, OK1
+  print not 
+OK1:  print ok 1\n
+
+  ge P1, P0, BAD2
+  branch OK2
+BAD2: print not ok 2\n
+OK2:  print ok 2\n
+
+  ge P1, P1, OK3
+  print not 
+OK3:  print ok 3\n
+

[perl #17903] [PATCH] sprintf test

2002-10-13 Thread via RT

# New Ticket Created by  Simon Glover 
# Please include the string:  [perl #17903]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17903 



 Here's a brief test for the PMC, PMC, PMC form of the sprintf op;
 as an added bonus, it also tests two of the formats not previously
 tested (%b and %o).

 Simon

--- t/op/string.t.old   Sun Oct 13 19:45:44 2002
+++ t/op/string.t   Sun Oct 13 20:04:21 2002
 -1,6 +1,6 
 #! perl -w

-use Parrot::Test tests = 96;
+use Parrot::Test tests = 97;
 use Test::More;

 output_is( 'CODE', OUTPUT, set_s_s|sc );
 -1500,6 +1500,35  Hello, Hello, Pa!
 That's all, folks!
 OUTPUT

+output_is('CODE', OUTPUT, other form of sprintf op);
+branch MAIN
+
+PRINTF:
+sprintf P3, P2, P1
+print P3
+ret
+
+MAIN:
+new P3, .PerlString
+
+new P2, .PerlString
+set P2, 15 is %b\n
+new P1, .PerlArray
+set P1[0], 15
+bsr PRINTF
+
+new P2, .PerlString
+set P2, 128 is %o\n
+new P1, .PerlArray
+set P1[0], 128
+bsr PRINTF
+
+end
+CODE
+15 is 
+128 is 200
+OUTPUT
+
 # Set all string registers to values given by $_[0](reg num)
 sub set_str_regs {
   my $code = shift;






Re: signal 11 when run on x86, JIT enabled

2002-10-13 Thread Steve Fink

On Sun, Oct 13, 2002 at 11:08:02PM +0100, Nicholas Clark wrote:
 On Sun, Oct 13, 2002 at 03:06:48AM -0700, Steve Fink wrote:
  On Fri, Oct 11, 2002 at 05:05:56PM -0700, Joe Wilson wrote:
   Perhaps this is a known issue...
   
   Most parrot programs seem to crash on x86 when the latest CVS parrot 
   is compiled with -O2 or -g -O2 and when JIT is enabled.
   The programs appear to run to completion and only crash prior to exitting.
   Repeatable on both Cygwin and Linux x86.
   When JIT is not used, everything is fine.
  
  Ugh. That was a hairy one to track down. I have committed a fix. The
  cause of the above problem was that the JIT was trampling over some
  x86 registers that are supposed to be callee-saved in the cdecl
  calling convention. By the time I finally figured that out, though, I
  had fixed several other pretty major bugs in the jit.
 
 I'm seeing this on x86 FreeBSD with the JIT:

Yes, I get this also. I was trying to figure out how to properly use
TODO or SKIP or something to suppress this, but none of them worked
quite right -- it would say that the failed test was a TODO, but it
still counted it as a failure. Locally, I am using the following
(incorrect) patch. Could someone who understands this better do it the
right way?

The problem is that the JIT doesn't support tracing. I could imagine
ways of fixing this -- make it drop into a non-JIT core if tracing is
turned on, or generate another JITed version of the program with calls
to the trace function after every op and switch to that version when
tracing is on -- but unless somebody really feels the urge to work on
it, I think the best thing to do is to make it either a TODO or SKIP.

Index: t/op/interp.t
===
RCS file: /cvs/public/parrot/t/op/interp.t,v
retrieving revision 1.6
diff -p -u -r1.6 interp.t
--- t/op/interp.t   22 Sep 2002 01:05:31 -  1.6
+++ t/op/interp.t   14 Oct 2002 00:40:33 -
 -18,7 +18,21  In 2
 ending
 OUTPUT
 
-output_like('CODE', 'OUTPUT', restart trace);
+# I couldn't figure out how to use TODO correctly.
+my $expected = 'OUTPUT';
+/^ok\s1\n
+(?:PC=8.*)?\n
+ok\s2\n
+(?:PC=11.*)?\n
+(?:PC=13.*)?\n
+ok\s3\n$/x
+OUTPUT
+if ($ENV{TEST_PROG_ARGS} =~ /-j/) {
+$expected = '/';
+$expected .= ok\\s$_\\n for 1..3;
+$expected .= '/';
+}
+output_like('CODE', $expected, restart trace);
print 2, ok 1\n
set I0, 1
trace I0
 -28,12 +42,5  output_like('CODE', 'OUTPUT', resta
print 2, ok 3\n
end
 CODE
-/^ok\s1\n
-(?:PC=8.*)?\n
-ok\s2\n
-(?:PC=11.*)?\n
-(?:PC=13.*)?\n
-ok\s3\n$/x
-OUTPUT
 
 1;




Re: signal 11 when run on x86, JIT enabled

2002-10-13 Thread Simon Glover


On Sun, 13 Oct 2002, Steve Fink wrote:

 [Discussion snipped]

 Yes, I get this also. I was trying to figure out how to properly use
 TODO or SKIP or something to suppress this, but none of them worked
 quite right -- it would say that the failed test was a TODO, but it
 still counted it as a failure. Locally, I am using the following
 (incorrect) patch. Could someone who understands this better do it the
 right way?

 Your problem was probably forgetting to use Test::More (which defines
 skip). In any case, the enclosed patch should do the trick.

 Simon

--- t/op/interp.t.old   Sun Oct 13 20:48:36 2002
+++ t/op/interp.t   Sun Oct 13 20:50:53 2002
 -1,6 +1,7 
 #! perl -w

 use Parrot::Test tests = 2;
+use Test::More;

 output_is('CODE', 'OUTPUT', runinterp);
newinterp P0, 0
 -18,6 +19,7  In 2
 ending
 OUTPUT

+SKIP: { skip(Doesn't work with JIT enabled, 1);
 output_like('CODE', 'OUTPUT', restart trace);
print 2, ok 1\n
set I0, 1
 -35,5 +37,6  ok\s2\n
 (?:PC=13.*)?\n
 ok\s3\n$/x
 OUTPUT
+}

 1;




[perl #17907] [PATCH docs/parrot_assembly.pod] Minor typos and consistencies

2002-10-13 Thread via RT

# New Ticket Created by  chromatic 
# Please include the string:  [perl #17907]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=17907 


I've been browsing the docs, and took the time to do a bit of copyediting.  
There's room for more consistency -- sometimes the registers are called 'X' 
and 'Y' and other times 'x' and 'y'.

Most of the patch is just prettification, from an English-language point of 
view.

-- c



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/39768/32196/db6a98/assembly.patch



--- parrot_assembly.pod~	Sun Oct 13 19:04:11 2002
+++ parrot_assembly.pod	Sun Oct 13 19:18:05 2002
 -251,7 +251,7 
 
 =head2 Data manipulation
 
-These ops handle manipulating the data in registers
+These ops handle manipulating the data in registers.
 
 =over 4
 
 -267,7 +267,7 
 
 =item set Px, Py
 
-Copies the pmc pointer in Py into Px, both registers now refer to
+Copies the pmc pointer in Py into Px.  Both registers now refer to
 the Bsame pmc.  Use Lclone to copy pmc contents.
 
 =item clone Px, Py
 -283,13 +283,13 
 =item add tx, ty, tz *
 
 Add registers y and z and store the result in register
-x. (x = y + z) The registers must all be the same type, PMC, integer,
+x. (x = y + z) The registers must all be the same type: PMC, integer,
 or number.
 
 =item sub tx, ty, tz *
 
 Subtract register z from register y and store the result in register
-x. (x = y - z) The registers must all be the same type, PMC, integer,
+x. (x = y - z) The registers must all be the same type: PMC, integer,
 or number.
 
 =item mul tx, ty, tz *
 -335,85 +335,85 
 
 =item sin nx, ty
 
-Return the sine of the number in Y
+Return the sine of the number in Y.
 
 =item cos nx, ty
 
-Return the cosine of the number in Y
+Return the cosine of the number in Y.
 
 =item tan nx, ty
 
-Return the tangent of the number in Y
+Return the tangent of the number in Y.
 
 =item sec nx, ty
 
-Return the secant of the number in Y
+Return the secant of the number in Y.
 
 =item atan nx, ty
 
-Return the arctangent of Y
+Return the arctangent of Y.
 
 =item atan2 nx, ty
 
-Return the result of atan2 of Y
+Return the result of atan2 of Y.
 
 =item asin nx, ty
 
-Return the arcsine of y
+Return the arcsine of y.
 
 =item acos nx, ty
 
-Return the arccosine of y
+Return the arccosine of y.
 
 =item asec nx, ty
 
-Return the arcsecant of y
+Return the arcsecant of y.
 
 =item cosh nx, ty
 
-Return the hyperbolic cosine of y
+Return the hyperbolic cosine of y.
 
 =item sinh nx, ty
 
-Return the hyperbolic sine of y
+Return the hyperbolic sine of y.
 
 =item tanh nx, ty
 
-Return the hyperbolic tangent of y
+Return the hyperbolic tangent of y.
 
 =item sech nx, ty
 
-Return the hyperbolic secant of y
+Return the hyperbolic secant of y.
 
 =item log2 nx, ty
 
-Return the base 2 log of y
+Return the base 2 log of y.
 
 =item log10 nx, ty
 
-Return the base 10 log of y
+Return the base 10 log of y.
 
 =item ln Nx, ty
 
-Return the base e log of y
+Return the base e log of y.
 
 =item log nx, ty, tz
 
-Return the base Z log of Y
+Return the base Z log of Y.
 
 =item pow nx, ty, tz
 
-Return Y to the Z power
+Return Y to the Z power.
 
 =item exp nx, ty
 
-Return e to the Y power
+Return e to the Y power.
 
 =back
 
 =head2 Register and stack ops
 
-These opcodes deal with registers and stacks
+These opcodes deal with registers and stacks.
 
 =over 4
 
 -469,39 +469,39 
 
 =item save_i Ix
 
-Push register X onto the generic stack
+Push register X onto the generic stack.
 
 =item save_s Sx
 
-Push register X onto the generic stack
+Push register X onto the generic stack.
 
 =item save_p Px
 
-Push register X onto the generic stack
+Push register X onto the generic stack.
 
 =item save_n Nx
 
-Push register X onto the generic stack
+Push register X onto the generic stack.
 
 =item restore_i Ix
 
-Restore register X from the generic stack
+Restore register X from the generic stack.
 
 =item restore_s Ix
 
-Restore register X from the generic stack
+Restore register X from the generic stack.
 
 =item restore_p Px
 
-Restore register X from the generic stack
+Restore register X from the generic stack.
 
 =item restore_n Nx
 
-Restore register X from the generic stack
+Restore register X from the generic stack.
 
 =item entrytype Ix, iy
 
-Put the type of stack entry Y into integer register X
+Put the type of stack entry Y into integer register X.
 
 =item set_warp string
 
 -545,7 +545,7 
 =item find_global Px, sy, sz
 
 Find the PMC for the global variable sy from the table sz and store it
-in register X
+in register X.
 
 =item find_global Px, sy
 
 -553,7 +553,7 
 
 =item find_global_table Px, sy
 
-Find the global symbol table Y and store its PMC in X
+Find the global symbol table Y and store its PMC in X.
 
 =item find_global_slot ix, Py, sz
 
 -562,13 +562,13 
 
 =item fetch_lex Px, iy, iz
 
-Fetch the lexical in slot y of 

Intlist question

2002-10-13 Thread Simon Glover


  I've just tried to write PASM like:

new P0, .IntList
new P1, .PerlInt

set P1, 20
set P0[0], P1
...
end

  only to have it fail with the message:

   'Subscript on something that's not an aggregate!'

  Is this a bug or a feature?

  Simon








RE: signal 11 when run on x86, JIT enabled

2002-10-13 Thread Brent Dax

Simon Glover:
# On Sun, 13 Oct 2002, Steve Fink wrote:
#  Your problem was probably forgetting to use Test::More 
# (which defines  skip). In any case, the enclosed patch should 
# do the trick.
# 
# +SKIP: { skip(Doesn't work with JIT enabled, 1);
#  output_like('CODE', 'OUTPUT', restart trace);
#   print 2, ok 1\n
#   set I0, 1

But that doesn't discriminate between having the JIT enabled and not
having it.  That test *should* run if the JIT isn't activated.

--Brent Dax [EMAIL PROTECTED]
@roles=map {Parrot $_} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
--Albert Einstein (explaining radio)




Re: Intlist question

2002-10-13 Thread Steve Fink

On Sun, Oct 13, 2002 at 11:43:23PM -0400, Simon Glover wrote:
 
   I've just tried to write PASM like:
 
 new P0, .IntList
 new P1, .PerlInt
 
 set P1, 20
 set P0[0], P1
 ...
 end
 
   only to have it fail with the message:
 
'Subscript on something that's not an aggregate!'
 
   Is this a bug or a feature?

Was that before or after the big PMC reorganization commit?

I get something similar. If I run the above code, I get

  get_integer_keyed() not implemented in class 'PerlInt'

However, if I run the same code with tracing enabled, I get

  get_number() not implemented in class 'IntList'

I'll try to take a look at it soon, unless somebody else beats me to
it (please?). When I implemented the IntList PMC, I didn't bother to
implement every variation of the different vtable entries, partly from
laziness and partly because I expected the PMC hierarchy to change so
I might not need to. However, that wouldn't explain any of the above
errors.

Oh, I see why the behavior changes with tracing: fairly recently, I
committed someone's patch (Brent Dax, I think) that makes it print out
PMCs during tracing by printing their pointer, string, number, and
integer values. That's more likely to cause a problem now that many
more operations throw exceptions when you try to call an unimplemented
vtable entry (such as get_number on an IntList).

Probably that should be fixed by trapping exceptions when dumping a
PMC? As soon as exceptions are designed and implemented, that is.

Ok, so that narrows it down to the get_integer_keyed thing.