request for addition to administative field to Synopsis

2006-09-17 Thread Mark Stosberg

Hello,

As I've worked on smart linking, I've found some gaps in the spec, often
 of the variety of "obvious" parts that should largely work the same as
Perl 5. For example, "say" was formally spec'ed until recently, or
"print" for that matter.

I have a suggestion which I believe make the docs more useful to users
as well as the spec maintainers, in addition to helping the smart
linking work flow.

I would like a new heading at the bottom of each synposis that would be
there to be a target for smart links, which clearly should be associated
with this particular synopsis, but are lacking a specific target,
because the spec is incomplete or missing. This is different than
"unspecced" features, it more about features like "print", that are so
obvious they have been left out until now.

To users, it would be convey that there is already functionality they
can review related to the synopsis, that might be fully spec'ed yet.

To spec maintainers, it provides a kind of TODO list of things that need
to be clarified.

To smart linkers, it makes better use of our time than making no link,
or linking to something suboptimal, with no visible result that we found
something that needed attention.

A name for this section might be "To Be Clarified"

 The boilerplate text might be: "The following tests relate to this
 synopsis, but need further spec clarifications so that a specific smart
 link can be created.



As an example, today's discovery was that the auto-increment and
decrement operators aren't spec'ed, beyond mentioning them in a
precedence table. This specific example also illustrates why just
pointing to "how Perl 5 works" isn't a good idea.

The first sentence of the Perl 5 docs work are:
 '"++" and "--" work as in C ...'

While I realize creating a self-contained Perl 6 spec is leaves
significantly more work, It has the important benefit of clarifying
exactly how large of a task it is to create something which is
"official" in the sense that it complies with such a large volume of
documentation, which will finally be available all in one place.

  Mark



Re: PCR replaces PGE in Pugs

2006-09-17 Thread Christopher D. Malon

On Sep 17, 2006, at 4:32 AM, Agent Zhang wrote:


Tonight, Audrey implemented the bridge between Pugs' Haskell core and
the Perl 5 module Pugs::Compiler::Rule, thus bringing rules support to
our pugs ``for free''. This is really good news to us. :)

For more than one year, Pugs had required parrot to provide full Perl
6 regexes (rules) support since Pugs didn't have its own grammar
engine. In those early days, parrot's PGE (Parrot Grammar Engine) was
the only choice.


This sounds like good news and excellent work by a lot of people,
but I'm a bit afraid to upgrade, having just started to learn to
work around PGE's idiosyncracies.  Is it still possible to use PGE
for rules support?  How is this controlled?

Also, I just noticed that there's a choice between embedding Parrot
and using Parrot externally (I presume the latter happens if I set
PARROT_PATH without PUGS_EMBED=parrot.)  What functionality
do I lose without an embedded parrot?  Why is an embedded Parrot
not recommended?  Does PUGS_EMBED="parrot perl5" create
any sort of a conflict?

BTW, I'd appreciate more documentation on PUGS_EMBED and
the effect of the -B and -C switches in general, somewhere
along with README and INSTALL in the top-level directory.
I remember being surprised to learn from "pugs --help" that
Pugs, PIL2, and GHC were different backends, and I still don't
understand it.  The documentation should be newer and more
user-oriented than STATUS, and contain references to which portions
of the source tree are involved when you choose a particular
set of options.  README itself would be a good place for it.
sanug++'s pictures were beautiful (maybe too hard to update?),
but there's a bit of reality impedance, and a look at
Perl_6_on_Haskell_is_Pugs.jpg only strengthens my expectation
that the Pugs, PIL2, and GHC backends (maybe even PIL2-YAML)
should be the same.

Thanks!
Christopher



RFC: Consolidate stack-unwinding code

2006-09-17 Thread Bob Rogers
   The attached patch consolidates most of the existing stack-unwinding
code into Continuation:invoke; previously, RetContinuation:invoke and
find_exception_handler also did stack-unwinding, and none of the three
did it quite the same way.

   Here are the effects:

   1.  Improved code sharing, a prerequisite for improving semantics.

   2.  Actions are now triggered when a continuation is called, fixing
two TODO cases (and also two others which were looking for the buggy
behavior).  Previously, this only worked for exception handling and
RetContinuation.

   3.  Actions are no longer triggered as a side-effect of discovering
that there are no active exception handlers, which is more in the spirit
of PDD23.

   4.  Variable names are now more consistent between
Continuation:invoke and RetContinuation:invoke (or what's left of it).

   Questions:

   1.  I notice that parameter passing is handled by Continuation:invoke
but not by RetContinuation:invoke.  Currently I have to use some
cumbersome "Am I a RetContinuation?" logic in what is supposed to be the
generic method in order to deal with this.  It would be nicer if they
both passed parameters in the same way.  Is there some reason this can't
be done?

   2.  The exception handling case is not as efficient as it could be
(quadratic handler search followed by re-searching for the handler's
stack entry).  This would be helped by splitting the unwinding code into
a separate routine, and calling it from each of the invoke methods,
rather than trying to use inheritance.  But I assume this will need to
be rewritten anyway when PDD23 is fully implemented.  With that in mind,
is this OK for now?

   3.  Around src/exceptions.c:268 (unpatched) there is an assignment of
e->entry_type to NO_STACK_ENTRY_TYPE, after a comment explaining why.
The patch disables this assignment, with no ill effect.  If the code is
still needed for some reason, it will have to be moved to
RetContinuation:invoke, but I don't have a test case to ensure that I've
done this right.  Should I just chuck it?

   Suggestions are cordially invited.  If I hear no complaints by
tomorrow night, I will assume all answers are "yes," and commit this (or
something close to it).

-- Bob Rogers
   http://rgrjr.dyndns.org/

Index: src/pmc/retcontinuation.pmc
===
--- src/pmc/retcontinuation.pmc (revision 14640)
+++ src/pmc/retcontinuation.pmc (working copy)
@@ -76,55 +76,19 @@
 
 =item C
 
-Restores the "context" by calling the superclass's C and places
-the frame pointer in the stack frame cache.
+Transfers control to the calling context, and frees the current context.
 
 =cut
 
 */
 
 void* invoke (void* next) {
-Stack_Chunk_t *ctr_stack, *stack_now;
 struct Parrot_cont * cc = PMC_cont(SELF);
-parrot_context_t *caller_ctx;
-struct PackFile_ByteCode *seg;   /* bytecode segment */
-/*
-* unwind control stack
-*/
-stack_now = CONTEXT(INTERP->ctx)->control_stack;
-caller_ctx = cc->to_ctx;
-ctr_stack = caller_ctx->control_stack;
-while (stack_now != ctr_stack) {
-if (!stack_now || !ctr_stack)
-internal_exception(1, "Control stack damaged");
-/*
- * this automagically runs all pushed action
- * handler during pop - see cleanup stuff
- * in stack_pop
- */
-(void)stack_pop(INTERP, &stack_now,
-NULL, NO_STACK_ENTRY_TYPE);
-}
+parrot_context_t *from_ctx = cc->from_ctx;
+struct PackFile_ByteCode * const seg = cc->seg;
 
-/* debug print before context is switched */
-if (Interp_trace_TEST(INTERP, PARROT_TRACE_SUB_CALL_FLAG)) {
-Interp *tracer;
-
-PMC *to_sub = caller_ctx->current_sub;
-PMC *from_sub = cc->from_ctx->current_sub;
-
-tracer = interpreter->debugger ? 
-interpreter->debugger : interpreter;
-PIO_eprintf(tracer, "# Back in sub '%Ss' from '%Ss'\n",
-Parrot_full_sub_name(INTERP, to_sub),
-Parrot_full_sub_name(INTERP, from_sub));
-}
-CONTEXT(INTERP->ctx) = caller_ctx;
-INTERP->ctx.bp = caller_ctx->bp;
-INTERP->ctx.bp_ps = caller_ctx->bp_ps;
-next = cc->address;
-Parrot_free_context(INTERP, cc->from_ctx, 1);
-seg = cc->seg;
+   next = SUPER(next);
+   Parrot_free_context(INTERP, from_ctx, 1);
 #ifdef NDEBUG
 /* the continuation is dead - delete and destroy it */
 mem_sys_free(cc);
@@ -147,7 +111,6 @@
  */
 cc->to_ctx = NULL;
 #endif
-INTERP->current_args = NULL;
 if (INTERP->code != seg) {
 Parrot_switch_to_cs(INTERP, seg, 1);
 }
Index: src/pmc/continuation.pmc
=

Re: perl6 and a multi-interpreted-language example

2006-09-17 Thread Larry Wall
Okay, combining all these approaches minimalistically but without
golfing we get something like:

my @numbers = sort { rand }, constant @goal = 1..9;
my $steps = 0;

until @numbers ~~ @goal {
   say [EMAIL PROTECTED];
   @numbers[ 0 ..^ prompt "Reverse how many? " ] .= reverse;
   ++$steps;
}

say "Done! That took you $steps steps.";

Larry


[perl #40347] Can't determine revision under Subversion 1.4.0

2006-09-17 Thread via RT
# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #40347]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=40347 >


This is because Parrot::Revision scans .svn/entries directly, but the
Subversion folks changed the working copy format in 1.4.

(The revision seems required for submitting smoke results.)

Determining Parrot's revision...
Setting Configuration Data:
(
revision => '0',
SVN_ENTRIES => '.svn/entries',
);
.done.


>svn --version
svn, version 1.4.0 (r21228)
   compiled Sep  8 2006, 18:45:08


>svn info
Path: .
URL: http://svn.perl.org/parrot/trunk
Repository Root: http://svn.perl.org/parrot
Repository UUID: d31e2699-5ff4-0310-a27c-f18f2fbe73fe
Revision: 14634
Node Kind: directory
Schedule: normal
Last Changed Author: tewk
Last Changed Rev: 14634
Last Changed Date: 2006-09-17 04:22:01 +0200 (Sun, 17 Sep 2006)


>cat .svn/format
8

Ron


Re: perl6 and a multi-interpreted-language example

2006-09-17 Thread Ilmari Vacklin
su, 2006-09-17 kello 20:36 +0200, Juerd kirjoitti:
> while ("@numbers[]" ne "@numbers.sort()") {

Should C be used here?

while @numbers !eqv @numbers.sort {

-- 
Ilmari Vacklin <[EMAIL PROTECTED]>


signature.asc
Description: Digitaalisesti allekirjoitettu viestin osa


Re: perl6 and a multi-interpreted-language example

2006-09-17 Thread A. Pagaltzis
* William Herrera <[EMAIL PROTECTED]> [2006-09-17 21:50]:
> perl 5 (9 lines, 353 bytes)
> 
> use FreezeThaw qw(cmpStr);
> 
> my @a1_9  = (1 .. 9);
> my @numbers = sort {rand(10) > $a} @a1_9;
> 
> for (my $steps = 0; cmpStr([EMAIL PROTECTED], [EMAIL PROTECTED]); ++$steps) {
>print join(" ", @numbers), "\nReverse how many? ";
>my $flipcount = ;
>@numbers[0..$flipcount - 1] = reverse(@numbers[0..($flipcount-1)]);
> }
> 
> print "Done! That took you $steps steps.\n";

To be fair, Perl 5 can be a good deal nicer. 10 lines, 316 bytes,
and much less punctuation:

use List::Util 'shuffle';

my @numbers = shuffle my @goal = ( 1 .. 9 );
my $num_steps;

while ( "@numbers" ne "@goal" ) {
   print "@numbers\nReverse how many? ";
   my @slice = 0 ..  - 1;
   @numbers[ @slice ] = reverse @numbers[ @slice ];
   ++$num_steps;
}

print "Done! That took you $num_steps steps.\n";

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;


Re: more on perl5 modules

2006-09-17 Thread A. Pagaltzis
* Richard Hainsworth <[EMAIL PROTECTED]> [2006-09-17 18:05]:
> The .can workaround doesnt seem to work for more complex
> modules.

Err, the .can workaround is a way to get past missing sub
exports. Methods are never exported. Why are you using the
workaround for sub exports on methods.

> Here is a working perl5 program that puts up a message with two
> buttons.
> 
> use strict;
> use Gtk2 -init;
> use Gtk2::Ex::Dialogs(destroy_with_parent=>-1, modal=>-1, no_separator => 0);
> my $window = Gtk2::Window->new('toplevel');
> Gtk2::Ex::Dialogs->set_parent_window( $window );
> my $r = Gtk2::Ex::Dialogs::Question->ask( "Is Perl only hackers glue?");
> if ($r) {print "yes\n";} else {print "no\n";};

Should be simply:

use perl5:Gtk2 '-init';
use perl5:Gtk2::Ex::Dialogs :destroy_with_parent( -1 ) :modal( -1 ) 
:!no_separator;
my $window = Gtk2::Window.new( 'toplevel' );
Gtk2::Ex::Dialogs.set_parent_window( $window );
my $r = Gtk2::Ex::Dialogs::Question.ask( "Is Perl only hackers glue?" );
say $r ?? 'yes' !! 'no';

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;


Re: Web development I: Web::Toolkit

2006-09-17 Thread Juerd
Aankhen skribis 2006-09-17 11:54 (-0700):
> The point is not to have autogenerated code conform to the XHTML
> standard.  The point is to not use XHTML simply because it's shiny.

That's a good point, but my point was different.

XHTML should be a conscious choice, not a default, in a general purpose
web development library.
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <[EMAIL PROTECTED]>  
  convolution: ict solutions and consultancy <[EMAIL PROTECTED]>


Re: perl6 and a multi-interpreted-language example

2006-09-17 Thread Juerd
William Herrera skribis 2006-09-17 13:45 (-0600):
> Ruby (10 lines, 274 bytes)

This is the nicest example, so I'll base my response off this one.

my @numbers = (1..9).sort:{ rand };
my $steps = 0;
while ("@numbers[]" ne "@numbers.sort()") {
say "@numbers";
my $flipcount = prompt "Reverse how many?";
@numbers[0..^$flipcount].=reverse;
$steps++;
}
say "Done! That took you $steps steps.\n";

> Does perl6's Array class allow for more compact syntax, without 
> FreezeThaw.pm?

Interpolate the arrays:

while ("@numbers" ne "@{[ sort @numbers ]}") { ... }

-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <[EMAIL PROTECTED]>  
  convolution: ict solutions and consultancy <[EMAIL PROTECTED]>


Re: Web development I: Web::Toolkit

2006-09-17 Thread Juerd
Amir E. Aharoni skribis 2006-09-17 17:22 (+0300):
> 17/09/06, Juerd <[EMAIL PROTECTED]> skribis:
> > This is a very strict language, though, as it is based on XML.
> > A document is either valid and unambiguous, or completely invalid.
> Just like any programming language should be.

X?HTML is not a programming language. But I don't want to discuss the
benefits and disadvantages of XHTML at all, except to mention that both
do have benefits and disadvantages.

> > Because of this, XHTML needs to be a conscious choice, and never the
> > default.
> WordPress is an example of a webserver software tool that does try to
> produce standard XHTML.

That's great. Our tool will not produce documents, though.

Our tool will produce incomplete X?HTML, and thus must support both HTML
and XHTML. An empty tag created for XHTML is not valid HTML, and vice
versa.

XHTML is a promise for very strict output. HTML is so much less. We
should try to avoid promising things on our users' behalves.

People who wish to output XHTML from a program that they write, have
consciously chosen for it. HTML on the other hand can safely be assumed
by default: browsers won't display error pages on invalid input.

> It does it by default and very few bloggers who use it care about it
> or, for that matter, notice it.  FuturisticPerl6WebPackage.pm should
> be like that too. 

I disagree strongly. If we were publishing entire documents, then by all
means let it be XHTML, as it is expected to be the future standard. But
we're not!

> I see no reason that autogenerated code won't conform to standard
> XHTML.

Open your eyes.

> Every deviation from standards and XML well-formedness should produce
> a warning.

You seem to be forgetting that Perl is all-purpose, and has a very
different cultural background than XML.

> Wishful thinking: FuturisticPerl6WebPackage.pm could have
> functionality that will output XHTML that adheres to both the
> w3c-standard and the defacto-standard (warning about tags that only
> works in certain browsers etc.) It might make it easier for developers
> to test their sites on several browsers and platforms.

I do not want to use any web programming toolkit, Perl or other
language, that without my explicit request scans my output and/or whines
about it.
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <[EMAIL PROTECTED]>  
  convolution: ict solutions and consultancy <[EMAIL PROTECTED]>


perl6 and a multi-interpreted-language example

2006-09-17 Thread William Herrera
I just took a second glance at my post and saw the scoping error in the 
$steps variable.  Please don't bother fixing it-- I want to know what a 
perl6 version would be like :)


perl6 and a multi-interpreted-language example

2006-09-17 Thread William Herrera
Hi!  I was wondering what a perl 6 program of a game of Reverse would 
look like?


see http://e-scribe.com/news/193



Ruby (10 lines, 274 bytes)

numbers = (1..9).sort_by{ rand }
steps = 0

while numbers != numbers.sort
 puts numbers.join(" ")
 print "Reverse how many? "
 flipcount = gets.to_i
 numbers[0...flipcount] = numbers[0...flipcount].reverse
 steps += 1
end

print "Done! That took you #{steps} steps.\n"

=

Python (9 lines, 304 bytes)

import random

numbers = random.sample(range(1,10), 9)
steps = 0

while numbers != sorted(numbers):
   print " ".join(map(str, numbers))
   flipcount = int(raw_input("Reverse how many? "))
   numbers[:flipcount] = reversed(numbers[:flipcount])
   steps += 1

print "Done! That took you %d steps." % steps


=

PHP (12 lines, 381 bytes)

$numbers = range(1, 9);
shuffle($numbers);
$sorted = $numbers;
sort($sorted);
$steps = 0;

while ($numbers != $sorted)
   {
   print implode(" ", $numbers) . "\n";
   print "Reverse how many? ";
   $flipcount = (int)trim(fgets(STDIN));
   array_splice($numbers, 0, $flipcount, 
array_reverse(array_slice($numbers, 0, $flipcount)));

   $steps++;
   }

print "Done! That took you $steps steps.\n";

==

perl 5 (9 lines, 353 bytes)

use FreezeThaw qw(cmpStr);

my @a1_9  = (1 .. 9);
my @numbers = sort {rand(10) > $a} @a1_9;

for (my $steps = 0; cmpStr([EMAIL PROTECTED], [EMAIL PROTECTED]); ++$steps) {
   print join(" ", @numbers), "\nReverse how many? ";
   my $flipcount = ;
   @numbers[0..$flipcount - 1] = reverse(@numbers[0..($flipcount-1)]);
}

print "Done! That took you $steps steps.\n";

==

Does perl6's Array class allow for more compact syntax, without 
FreezeThaw.pm?




pcre tests

2006-09-17 Thread David Romano
Hi everyone,

When building parrot on my iBook, two tests that depend on PCRE failed
because I don't have PCRE installed and the code that determines if
PCRE is installed is faulty. Parrot::Test::run_command returns [SIGNAL
$exit_code] if the exit code of the commands are not divisible by 256,
or if one of commands that needs to be run is not found.  Attached is a
patch for both t/library/pcre.t and t/examples/library.t, the only
places where Parrot::Test::run_command is used in the test suite. With
the patch, the tests are correctly skipped.

- David

-- 
"Where is human nature so weak as in the bookstore?"
-- Henry Ward Beecher

=== t/examples/library.t
==
--- t/examples/library.t(revision 32535)
+++ t/examples/library.t(local)
@@ -56,7 +56,10 @@
 
 # Testing pcre.pir with a simple pattern, if we have PCRE
 my $cmd = ($^O =~ /MSWin32/) ? "pcregrep --version" : "pcre-config --version";
-my $has_pcre = Parrot::Test::run_command($cmd, STDERR => File::Spec->devnull() 
) == 0;
+
+# if the $cmd returns an exit code not divisible by 255, "[SIGNAL exit_code]" 
+# is returned. Using eq instead of ==
+my $has_pcre = 0 eq (Parrot::Test::run_command( $cmd, STDERR => '/dev/null' ));
 SKIP:
 {
 skip( 'no pcre-config', 1 ) unless $has_pcre;
=== t/library/pcre.t
==
--- t/library/pcre.t(revision 32535)
+++ t/library/pcre.t(local)
@@ -27,10 +27,11 @@
 
 # if we keep pcre, we need a config test
 my $cmd = ($^O =~ /MSWin32/) ? "pcregrep --version" : "pcre-config --version";
-my $has_pcre = 0 == Parrot::Test::run_command(
-$cmd, STDERR => File::Spec->devnull,
-);
 
+# if the $cmd returns an exit code not divisible by 255, "[SIGNAL exit_code]" 
+# is returned. Using eq instead of ==
+my $has_pcre = 0 eq Parrot::Test::run_command( $cmd, STDERR => '/dev/null');
+
 SKIP: {
 skip("no pcre-config", Test::Builder->new()->expected_tests())
 unless $has_pcre;


Re: gmp_version undeclared

2006-09-17 Thread Alberto Simões

Hi, fixed

svnbotl r14636 | leo++ | trunk:
svnbotl : fix BigInt.version if gmp isnt installed

David Romano wrote:

Hi everyone,

I just tried to build parrot (something I hadn't done in about a month
and a half) and it failed to build due to gmp_version being undeclared
in src/pmc/bigint.pmc (not suprising since I don't have GMP installed).
Attached is a patch that fixes the problem for me. Using the
preprocessor was the only way I knew how to fix it.

- David





Index: src/pmc/bigint.pmc
===
--- src/pmc/bigint.pmc  (revision 14630)
+++ src/pmc/bigint.pmc  (working copy)
@@ -492,14 +492,18 @@
 
 =item C
 
-Return GMP version string "x.y.z".

+Return GMP version string "x.y.z", or "0.0.0" if GMP is unavailable.
 
 =cut
 
 */
 
 METHOD STRING* version() {

+#ifdef PARROT_HAS_GMP
 return string_from_cstring(INTERP, gmp_version, 0);
+#else
+return string_from_cstring(INTERP, "0.0.0", 0);
+#endif
 }
 
 /*


--
Alberto Simões - Departamento de Informática - Universidade do Minho
 Campus de Gualtar - 4710-057 Braga - Portugal

"Beware of bugs in the above code;
 I have only proved it correct, not tried it."
   --- Donald Knuth


gmp_version undeclared

2006-09-17 Thread David Romano
Hi everyone,

I just tried to build parrot (something I hadn't done in about a month
and a half) and it failed to build due to gmp_version being undeclared
in src/pmc/bigint.pmc (not suprising since I don't have GMP installed).
Attached is a patch that fixes the problem for me. Using the
preprocessor was the only way I knew how to fix it.

- David

-- 
"Men have become the tools of their tools."
-- Henry David Thoreau

Index: src/pmc/bigint.pmc
===
--- src/pmc/bigint.pmc  (revision 14630)
+++ src/pmc/bigint.pmc  (working copy)
@@ -492,14 +492,18 @@
 
 =item C
 
-Return GMP version string "x.y.z".
+Return GMP version string "x.y.z", or "0.0.0" if GMP is unavailable.
 
 =cut
 
 */
 
 METHOD STRING* version() {
+#ifdef PARROT_HAS_GMP
 return string_from_cstring(INTERP, gmp_version, 0);
+#else
+return string_from_cstring(INTERP, "0.0.0", 0);
+#endif
 }
 
 /*


Re: Check smoke results while reading Synopses

2006-09-17 Thread Agent Zhang

(Here's the revised version.)

Our new smoke server now has some extra links named SYN in the right
margin of the page, where one SYN link corresponds to one smoke
report:

http://m19s28.vlinux.de/cgi-bin/pugs-smokeserv.pl

Click on one of these links will lead you to a list of Synopses.
Entering one synopsis, say, ``02 Syntax'', you will find out our
magic.

As what you might have seen, these synopses contain test
passing/failing marks in the code snippets. (This feature was
originally suggested by Christopher++ and Gaal++.) For example:
\xAD\xF5is($foo, "blah", "lone block actually executes it's content");

my $foo2;
{$foo2 = "blah"};
\xAD\xF5is($foo2, "blah", "lone block w/out a semicolon actually 
executes
it's content");

my $foo3;
({$foo3 = "blah"});
×   ok(!defined($foo3), "block enclosed by parentheses should not
auto-execute (1)", :todo);

Note that TODO tests are marked as passing only if they're actually
passing (i.e., unexpected passing from the perspective of
implementers) and they're marked as failing only if they're actually
failing (i.e. expected failing). I don't introduce special marks for
these tests because added complexity will lead to unnecessary
confusion.

Skipped tests have no marks at all. The meaning is straightforward
here. Just don't mistake blank tests for smartlinks.pl's bugs or
something like that. ;)

There's also brief stats info in the link name so that you can see how
many sub-tests are failing and how many are not without actually
expanding the code snippet. (Thanks Juerd++ for suggesting this one.)
For instance:
  - Show the snippet from t/var/var.t (line 13 ~ line 132  ―  30 \xAD\xF5, 0 ×) 
-

On top of the web page, there's a header like this:

 This page was generated at 2006-09-17 05:58:59 GMT.
 (syn r12136, pugs r13398)

where the revision number for pugs was extracted from the
corresponding tester's smoke report. Christopher has ensured the
version of the Pugs test suite used by the smoke server exactly
matches the smoker's local Pugs. The timestamp was proposed by Juerd++
while the revision numbers for both syn and pugs were proposed by
[particle]++.

All the Synopses on the smoke server are updated periodically by cron,
even for old smoke reports that had been processed. We're trying to
offer you the latest Perl 6 Spec everywhere. :)

For more details on the original motivation and Christopher's design
decisions, please read the p6c thread below:

synopses on smoke server

Thanks to Gaal and Larry's tests.yml while I was implementing smoke
result rendering feature in smartlinks.pl many weeks ago. At last but
not least, I really appreciate Christopher's work on the smoke
server/client mechanism to make this feature truly useful. (We don't
need auto-smoking on feather any more, whee!) And I also thank
iblech++ (yes, iblech's alive!) for helping him through the whole
process.

The Synopses on feather will still go without smoke results, since
smoke results are always specific to a certain Perl 6 implementation
or a Pugs backend. We hope you will still like it. :)

Enjoy!

Agent

P.S. This mail has also been posted to the Pugs blog site:

  http://pugs.blogs.com/pugs/2006/09/check_smoke_res.html

which contains some useful links.


Re: Web development I: Web::Toolkit

2006-09-17 Thread Aankhen

On 9/17/06, Amir E. Aharoni <[EMAIL PROTECTED]> wrote:

WordPress is an example of a webserver software tool that does try to
produce standard XHTML. It does it by default and very few bloggers
who use it care about it or, for that matter, notice it.
FuturisticPerl6WebPackage.pm should be like that too. I see no reason
that autogenerated code won't conform to standard XHTML. Every
deviation from standards and XML well-formedness should produce a
warning.


The point is not to have autogenerated code conform to the XHTML
standard.  The point is to not use XHTML simply because it's shiny.

XHTML 1.0 and 1.1 offer no practical benefits over HTML, but tangible
disadvantages.  Using XHTML unnecessarily complicates processing and
adds lots of gotchas.  If someone still wishes to use it, Web.pm (or
Web::Toolkit or Moo.pm or whatever it's called eventually) should be
perfectly capable of producing well-formed XHTML... but please, not
XHTML by default.


Wishful thinking: FuturisticPerl6WebPackage.pm could have
functionality that will output XHTML that adheres to both the
w3c-standard and the defacto-standard (warning about tags that only
works in certain browsers etc.) It might make it easier for developers
to test their sites on several browsers and platforms.


The majority of problems arising in authoring documents for the Web
are due to poor implementations of CSS, not poor implementations of
HTML.  If the XHTML produced by the module adheres to the W3C
standard, there won't be any elements that only work in certain
browsers (with the exception of ... no others I can think of
offhand).

Aankhen
--
"I meant *our* species."
"You said *your* species."
"Evidently I am insane.  May I go now?"


Re: Check smoke results while reading Synopses

2006-09-17 Thread Agent Zhang

On 9/18/06, Will Coleda <[EMAIL PROTECTED]> wrote:


On Sep 17, 2006, at 2:25 PM, Agent Zhang wrote:

> Our new smoke server now has some extra links named SYN in the left
> margin of the page, where one SYN link corresponds to one smoke
> report:

After much confusion, I found them on the *right* hand side, and only
for certain smokes.



Sorry for the confusion. It should be "right margin". 2:30 AM here and
I apparently need more coffee. Thank you for the catch. :)

Regards,

Agent


Re: Check smoke results while reading Synopses

2006-09-17 Thread Will Coleda


On Sep 17, 2006, at 2:25 PM, Agent Zhang wrote:


Our new smoke server now has some extra links named SYN in the left
margin of the page, where one SYN link corresponds to one smoke
report:


After much confusion, I found them on the *right* hand side, and only  
for certain smokes.


Regards.

--
Will "Coke" Coleda
[EMAIL PROTECTED]




Check smoke results while reading Synopses

2006-09-17 Thread Agent Zhang

Our new smoke server now has some extra links named SYN in the left
margin of the page, where one SYN link corresponds to one smoke
report:

http://m19s28.vlinux.de/cgi-bin/pugs-smokeserv.pl

Click on one of these links will lead you to a list of Synopses.
Entering one synopsis, say, ``02 Syntax'', you will find out our
magic.

As what you might have seen, these synopses contain test
passing/failing marks in the code snippets. (This feature was
originally suggested by Christopher++ and Gaal++.) For example:

√   is($foo, "blah", "lone block actually executes it's content");

my $foo2;
{$foo2 = "blah"};
√   is($foo2, "blah", "lone block w/out a semicolon actually executes
it's content");

my $foo3;
({$foo3 = "blah"});
×   ok(!defined($foo3), "block enclosed by parentheses should not
auto-execute (1)", :todo);

Note that TODO tests are marked as passing only if they're actually
passing (i.e., unexpected passing from the perspective of
implementers) and they're marked as failing only if they're actually
failing (i.e. expected failing). I don't introduce special marks for
these tests because added complexity will lead to unnecessary
confusion.

Skipped tests have no marks at all. The meaning is straightforward
here. Just don't mistake blank tests for smartlinks.pl's bugs or
something like that. ;)

There's also brief stats info in the link name so that you can see how
many sub-tests are failing and how many are not without actually
expanding the code snippet. (Thanks Juerd++ for suggesting this one.)
For instance:
  - Show the snippet from t/var/var.t (line 13 ~ line 132  —  30 √, 0 ×) -

On top of the web page, there's a header like this:

 This page was generated at 2006-09-17 05:58:59 GMT.
 (syn r12136, pugs r13398)

where the revision number for pugs was extracted from the
corresponding tester's smoke report. Christopher has ensured the
version of the Pugs test suite used by the smoke server exactly
matches the smoker's local Pugs. The timestamp was proposed by Juerd++
while the revision numbers for both syn and pugs were proposed by
[particle]++.

All the Synopses on the smoke server are updated periodically by cron,
even for old smoke reports that had been processed. We're trying to
offer you the latest Perl 6 Spec everywhere. :)

For more details on the original motivation and Christopher's design
decisions, please read the p6c thread below:

synopses on smoke server

Thanks to Gaal and Larry's tests.yml while I was implementing smoke
result rendering feature in smartlinks.pl many weeks ago. At last but
not least, I really appreciate Christopher's work on the smoke
server/client mechanism to make this feature truly useful. (We don't
need auto-smoking on feather any more, whee!) And I also thank
iblech++ (yes, iblech's alive!) for helping him through the whole
process.

The Synopses on feather will still go without smoke results, since
smoke results are always specific to a certain Perl 6 implementation
or a Pugs backend. We hope you will still like it. :)

Enjoy!

Agent

P.S. This mail has also been posted to the Pugs blog site:

   http://pugs.blogs.com/pugs/2006/09/check_smoke_res.html

which contains some useful links.


Re: Trying to make a new operator

2006-09-17 Thread Yuval Kogman
On Sun, Sep 17, 2006 at 16:35:39 +0100, Daniel Hulme wrote:
> > What am I doing wrong?
> Sounds like you need to define (or at least declare) the new operator
> before you use it. Perl 6, like Perl 5 compiles with a single pass, so
> when you are using your random operator, it hasn't yet read the
> declaration further down the file.

s/use/parse/;

-- 
  Yuval Kogman <[EMAIL PROTECTED]>
http://nothingmuch.woobling.org  0xEBD27418



pgpecCgUDpDGS.pgp
Description: PGP signature


more on perl5 modules

2006-09-17 Thread Richard Hainsworth

The .can workaround doesnt seem to work for more complex modules.

Here is a working perl5 program that puts up a message with two buttons.

use strict;
use Gtk2 -init;
use Gtk2::Ex::Dialogs(destroy_with_parent=>-1, modal=>-1, no_separator 
=> 0);

my $window = Gtk2::Window->new('toplevel');
Gtk2::Ex::Dialogs->set_parent_window( $window );
my $r = Gtk2::Ex::Dialogs::Question->ask( "Is Perl only hackers glue?");
if ($r) {print "yes\n";} else {print "no\n";};

Here is an attempt to do the same in perl6

use v6;
use perl5:Gtk2 -init;
say "called Gtk3 init";
my $window = initialise();
say "window initialised";
use perl5:Gtk2::Ex::Dialogs(destroy_with_parent=>-1, modal=>-1, 
no_separator => 0);

our &gsetparent := Gtk2::Ex::Dialogs.can('set_parent_window');
say "Now trying to use the window";
gsetparent( $window );
our &ask := Gtk2::Ex::Dialogs::Question.can('ask');
my $r = ask( "Is Perl only hackers glue?");
if ($r) {say "yes";} else {say "no";};

sub initialise () {
# I took this eval(uation) of perl5 by pugs from one of the examples in 
the pugs distribution

   eval (q!
   my $win = Gtk2::Window->new('toplevel');
   $win;
   !,:lang);
};


Here is the output
$ pugs ./gtk2_test.p6
called Gtk3 init
window initialised
Now trying to use the window
Undefined subroutine &main:: called.

I tried a variety of coding techniques. None seems to work.
eg.,
our &gwin := Gtk2::Window.can('new');
our &gwin := Gtk2.can('Window->new');
our &gwin := Gtk2.can('Window.new');

The problem seems to be that Gtk2::Window does not exist as a separate 
module, viz., there is no Window.pm in the Gtk2 directory space.


Any ideas?



Re: Trying to make a new operator

2006-09-17 Thread Daniel Hulme
> What am I doing wrong?
Sounds like you need to define (or at least declare) the new operator
before you use it. Perl 6, like Perl 5 compiles with a single pass, so
when you are using your random operator, it hasn't yet read the
declaration further down the file.

It does its best to DTRT with most functions, but when you're defining
arbitrarily random operators, it can only be so clever.

-- 
Sufficiently advanced humour is indistinguishable from tedium.
corollary:
Humour distinguishable from tedium is insufficiently advanced.
http://surreal.istic.org/   Hack code until it works, then stop.


pgptQIbTaHijD.pgp
Description: PGP signature


Trying to make a new operator

2006-09-17 Thread Richard Hainsworth

I tried to make a new "growth" operator.
The code was

(32 + 48).say;

sub infix:<+> ($left,$right) {
   return 100 * ($right/$left -1);
};

$pugs ./p6test.p6

returns with
50

But if I change the + character to (say) a cyrillic letter Д, I get the 
following error:

$ pugs ./p6test.p6
***
   unexpected "\1041"
   expecting operator or ")"
   at ./p6test.p6 line 1, column 5


I also tried other latin characters, but I get errors. It seems I can 
change an existing operator, but not introduce another.


What am I doing wrong?



Index of terms

2006-09-17 Thread Richard Hainsworth
It would be useful to have a consolidated global index into the 
synopses, etc.


Also, I noticed in a thread someone asked a question that arose because 
some topics are covered in more than one synopsis. This problem might 
eased if a single index had links for all documents in a single place.





Re: HOWTO give options to parrot in tests

2006-09-17 Thread Leopold Toetsch
Am Sonntag, 17. September 2006 15:16 schrieb Karl Forner:
> > I'd subclass Parrot::Test and create a function shootout_output_is(),
> > which
> > takes an extra commandline argument.
>
> Hmmm but if I subclass Parrot::Test, I won't be able to reuse any code.

There are already Test classes: see lib/Parrot/Test/*.pm. If there's anything 
wrong with code reusablility, this should be fixed ;)

leo


Re: cur_namespace under imcc.y

2006-09-17 Thread Alberto Simões

Apparently they are the same. Merged as #14635

Alberto

Alberto Simões wrote:

Hi

When searching for globals on PIR parser (most of these globals are in 
the top of imcc.y file) I found:


imcc.y:
  SymReg *cur_namespace; /* ugly hack for mk_address */

imc.h:
  typedef struct _imc_info_t {
  ...
  SymReg  *  cur_namespace;
  ...
  } imc_info_t

Now my question is: anybody knows if they have the same meaning?

Can I merge their usage on the imc_info one?

Cheers.
Alberto



--
Alberto Simões - Departamento de Informática - Universidade do Minho
 Campus de Gualtar - 4710-057 Braga - Portugal

"Beware of bugs in the above code;
 I have only proved it correct, not tried it."
   --- Donald Knuth


Re: Web development I: Web::Toolkit

2006-09-17 Thread Amir E. Aharoni

17/09/06, Juerd <[EMAIL PROTECTED]> skribis:

This is a very strict language, though, as it is based on XML.
A document is either valid and unambiguous, or completely invalid.


Just like any programming language should be. And the XHTML rules are
quite reasonable. In practice *all* browsers effectively encourage
developers not to follow the strict standard, by allowing invalid
HTML. I usually browse the web with Firefox and HTML-Tidy extension,
and see very few sites that conform to any w3c standard.


Because of this, XHTML needs to be a conscious choice, and never the
default.


WordPress is an example of a webserver software tool that does try to
produce standard XHTML. It does it by default and very few bloggers
who use it care about it or, for that matter, notice it.
FuturisticPerl6WebPackage.pm should be like that too. I see no reason
that autogenerated code won't conform to standard XHTML. Every
deviation from standards and XML well-formedness should produce a
warning.

Wishful thinking: FuturisticPerl6WebPackage.pm could have
functionality that will output XHTML that adheres to both the
w3c-standard and the defacto-standard (warning about tags that only
works in certain browsers etc.) It might make it easier for developers
to test their sites on several browsers and platforms.


Re: HOWTO give options to parrot in tests

2006-09-17 Thread Karl Forner

On 9/15/06, Leopold Toetsch <[EMAIL PROTECTED]> wrote:


Am Freitag, 15. September 2006 01:42 schrieb Karl Forner:
> But by looking in other tests and in the Parrot::Test, it seems that the
> canonical way
> of running a PIR script is through the example_output_is() function.
> BUT this function does not take any arguments for Parrot.

I'd subclass Parrot::Test and create a function shootout_output_is(),
which
takes an extra commandline argument.



Hmmm but if I subclass Parrot::Test, I won't be able to reuse any code. So
if by instance the multiplatform way of getting the path
to the parrot interpreter changes, I will have to synchronyze the code in
the subclass too. Isn't it evil ?


By the way, I have implemented the test using the TEST_PROG_ARGS environment
variable.
It is not very elegant but at least it seems to work for now.


Web development I: Web::Toolkit

2006-09-17 Thread Juerd
Juerd's thoughts about Perl 6 web development

Part one: Motivation and general thoughts

If you know me, you know that I never really liked Perl 5's CGI.pm. In
essence, I like that it has enabled a lot of people to build dynamic web
pages in a reasonably simple way. However, it was avery large monolithic
piece of code that grew much too large. CGI.pm did things that reach far
beyond the Common Gateway Specification. It had a lot of functionality
that is often used with CGI programming, but isn't related to CGI
specifically at all.

I will, apart from this paragraph, refrain from comments about the
coding style of CGI.pm.

Perl 6 will also be used for web development. I think it's extremely
important to have a very good de facto standard web development toolkit,
that replaces the role that CGI.pm has played so far. We need to
identify important functions of web development, and provide an easy way
to them. Doing this, we should be careful not to provide a complex
framework that beginners will find hard to understand, or that forces
any particular structure to one's code.

When Perl was still the most popular thing to use for dynamic web pages,
little more than sending some data was done. Interactivity was often
limited to a simple queries and responses, without much need for
maintaining state in between. Nowadays, "sessions" are a very important
aspect of web programming. Perl 5 provides a few ways of setting these
up, but it's not part of the most popular web development toolkit,
CGI.pm.

CGI.pm does provide HTML generation functions. Why anyone would prefer
to write exactly the same thing in an only slightly less awkward syntax,
is entirely beyond me. One particular feature, sticky values in form
elements, where the value from the request is used as the default value
for the new form output, is very useful, though. A trend that I've
noticed is that people begin by printing raw HTML, and add sticky values
via HTML generation functions later. Some weird kind of sense for purity
then often drives them to move entirely to HTML generation. Some smarter
programmers use templating modules, often still relying on CGI.pm's form
functions for pre-filling form fields.

Sticky values are useful combined with form validation. If the given
input data is invalid, you present the same form again, and prompt the
user to fix their mistakes. With CGI.pm, the easy way to do this is to
output an error message first, and then use the normal HTML generation
functions to generate the HTML for form elements. However, users are now
used to seeing the erroneous form field highlighted, with a more
specific error message next to it. We should have an easy way to do that
too.

In the past years, Perl's leading position for web programming was taken
over by PHP. This has to do with a lot of things. While PHP is
technically inferior in numerous ways, it has a few strengths that make
it very tempting for beginning programmers to pick this language over
many others. Acknowledging that many of us dislike PHP for its
programming language, we should try to accept that this product offers
some things that Perl does not, most of which boil down to being usable
out of the box. The programmer doesn't have to worry about all the
details: many are delegated to the system administrator, which tends to
be a good thing for bulk hosted web development. This opens up web
programming to a much larger audience.

Whether making it easy to write web programs is a good idea (in the
light of security, spam, and overall code quality), is a different
discussion. I personally would like things to be easy and simple,
because I'm lazy. But I want this in a Perlish way, not a PHP-ish way.
The Perlish way is, in my opinion and experience, more elegant and time
saving. I stress that elegance and "line noise" are not mutually
exclusive.

Another recent development in web programming world is character
encoding awareness. The times of letting the browser figure out what's
going on are finally over. Modern web programming mostly uses UTF-8, and
is explicit about that. We should make using UTF-8 in HTML output
extremely easy, and highlight it in synopses and tutorials. Perl 5 had
great Unicode support, and it is expected that it will be even better in
Perl 6. We should use that to our users' advantage.

Yet another recent development is XHTML. This is slowly becoming more
popular. This is a very strict language, though, as it is based on XML.
A document is either valid and unambiguous, or completely invalid.
Because of this, XHTML needs to be a conscious choice, and never the
default. That doesn't mean that choosing XHTML should be hard, and that
our web toolkit only outputs HTML. I think we're obliged to implement
both HTML and XHTML, whenever we generate output. This isn't necessarily
related to HTML generation functions, but may also be important for HTML
entities and carping. By consistently applying both HTML and XHTML, we
set a good example for people who wish to

Re: How to pass a ref from a language with no refs (was: Re: use perl5:CGI as a solution)

2006-09-17 Thread Juerd
Mark Stosberg skribis 2006-09-17  8:10 (-0500):
> > Please note that eventually, perl5:CGI is supposed to work as expected.
> For that to happen, there will first have be some documentation telling
> me what expectations to have.

Good point, but I think your expectations are natural and logical.

> When Perl 5 has references and Perl 6 doesn't, I don't know what to
> expect to when I need to pass a hash reference to a Perl 5 routine.

That's mostly terminology. I expect that the syntax will still be the
same. That is:

perl5sub( { ... } );   # Anonymous hash
perl5sub( \%hash );# Capture of a real hash

> Such details make no appearance currently in the Perl 6 spec, but I'm
> trying to gather them on the wiki if you have anything to add:
> http://rakudo.org/perl6/index.cgi?using_perl_5_embedding

Great work!

Unfortunately, it still takes up to a minute for rakudo.org pages to
load on my home machine.
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <[EMAIL PROTECTED]>  
  convolution: ict solutions and consultancy <[EMAIL PROTECTED]>


How to pass a ref from a language with no refs (was: Re: use perl5:CGI as a solution)

2006-09-17 Thread Mark Stosberg
Juerd wrote:
> 
> Please note that eventually, perl5:CGI is supposed to work as expected.

For that to happen, there will first have be some documentation telling
me what expectations to have.

When Perl 5 has references and Perl 6 doesn't, I don't know what to
expect to when I need to pass a hash reference to a Perl 5 routine.

Such details make no appearance currently in the Perl 6 spec, but I'm
trying to gather them on the wiki if you have anything to add:

http://rakudo.org/perl6/index.cgi?using_perl_5_embedding

   Mark


Re: CGI Session management (was Re: the CGI.pm in Perl 6)

2006-09-17 Thread Juerd
Mark Stosberg skribis 2006-09-16 22:04 (-0500):
> As far as I'm aware, no work on CGI::Session for Perl 6 has started yet.

I'm happy about that, because this module must not have "CGI" in its
name. 
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <[EMAIL PROTECTED]>  
  convolution: ict solutions and consultancy <[EMAIL PROTECTED]>


Re: use perl5:CGI as a solution (was: Re: the CGI.pm in Perl 6)

2006-09-17 Thread Juerd
Mark Stosberg skribis 2006-09-16 21:30 (-0500):
> Aankhen wrote:
> > The major feeling was that there should be no CGI.pm (if someone was
> > hellbent on using it, they could use the Perl 5 module).  
> In theory, "use perl5:CGI" could be a fine solution. In practice, it
> hasn't worked out well for me. Even something that seems simple like
> passing a hashref to Perl 5 is not documented now. In summary, I found
> it easier to update CGI.pm p6 to meet my needs than to 'use perl5:CGI'
> to meet my needs. I think the reality it is yet to been seen now well
> calls to Perl 5 modules can work for the general case.

Please note that eventually, perl5:CGI is supposed to work as expected.
-- 
korajn salutojn,

  juerd waalboer:  perl hacker  <[EMAIL PROTECTED]>  
  convolution: ict solutions and consultancy <[EMAIL PROTECTED]>


Who uses CGI.pm HTML generation? (was: Re: the CGI.pm in Perl 6)

2006-09-17 Thread Mark Stosberg
David Cantrell wrote:
> 
> I wonder how many people really use the HTML-generating bits of CGI.pm?
> I know I never have, nor have they been used that I can remember
> anywhere that I've worked, or in any of the non-work projects I've
> collaborated in.  It's always been 'print ""' or more recently
> using a templating language like TT.

I find a few of the form generation methods really handy, especially
popup_menu(). Form elements aren't managed much by designers anyway.
The rest of the HTML stuff I actively ignore.

   Mark


use perl5:CGI as a solution (was: Re: the CGI.pm in Perl 6)

2006-09-17 Thread Mark Stosberg
Aankhen wrote:
>
> The major feeling was that there should be no CGI.pm (if someone was
> hellbent on using it, they could use the Perl 5 module).  

In theory, "use perl5:CGI" could be a fine solution. In practice, it
hasn't worked out well for me. Even something that seems simple like
passing a hashref to Perl 5 is not documented now. In summary, I found
it easier to update CGI.pm p6 to meet my needs than to 'use perl5:CGI'
to meet my needs. I think the reality it is yet to been seen now well
calls to Perl 5 modules can work for the general case.

Mark


best practice for web form stickiness (was: Re: the CGI.pm in Perl 6)

2006-09-17 Thread Mark Stosberg
Juerd wrote:
>
> Personally, I am *against* HTML generating for elements that are not
> form fields. And for form fields, I think the solution should be in the
> templating thing, not elsewhere. Stickiness makes sense on invalid data
> only anyway, and we need to put the error message and a pointer
> somewhere, and those are also templating things. Even the simple
> "contact page" is much better off with a nice templating tool, than with
> HTML generating methods.

I think HTML::FillInForm is a much better way to handle form stickiness.
It allows you to keep the form generation in HTML /and/ still support
stickiness.

So, it's fine with me if the sticky feature of CGI.pm doesn't re-appear.

   Mark


Re: CGI Session management (was Re: the CGI.pm in Perl 6)

2006-09-17 Thread Mark Stosberg
> 
> I agree  completely.  In that vein, I think that one thing a lot of web
> developers would like to have available more easily would be session
> management.  In PHP it's as simple as $_SESSION['key'] = 'value'.  I
> understand that CGI.pm is a fundemantally different concept from PHP and
> that this can't be completely taken care of by the module.  Still, if
> something could be written in, I think it would make many people's lives
> simpler.

In Perl 5, CGI::Session is one solution that feels this gap well.

In frameworks like CGI::Application, sessions can be integrated so they
are apart of the of the same object anyway:

 self.query <-- CGI.pm object
 self.session   <-- CGI::Session object.

As far as I'm aware, no work on CGI::Session for Perl 6 has started yet.
I'm sure there will be some things that would be nice to change about it
as well, as it currently has some features only for backwards
compatibility.

   Mark


Re: Trying to use Perl5 modules (documented on wiki)

2006-09-17 Thread Mark Stosberg
Audrey Tang wrote:
> 
> 在 Sep 11, 2006 2:07 PM 時,Trey Harris 寫到:
> 
>> In a message dated Mon, 11 Sep 2006, Richard Hainsworth writes:
>>> I am trying to find out how to use (in perl6) perl5 modules that
>>> contain subroutines.
>>
>> Imports from Perl 5 modules don't currently work.
> 
> Actually, explicit imports do work (as of a couple weeks ago):
> 
> use perl5:Time::gmtime ;
> say gmtime.wday;
> 
> Implicit imports is not yet supported, though...

Thanks for the status update. I've reflected this on the related wiki page:
http://rakudo.org/perl6/index.cgi?using_perl_5_embedding

I welcome other tips about Perl 5 embedding to also appear there!

  Mark


class attr set defs as their names

2006-09-17 Thread Darren Duncan
Another bit of a questioning brain dump, which topically follows my 
post of August 30th titled "derived class generators and 
introspection", since I'm having trouble sleeping at the moment, with 
it on my mind ...


Any answers would be appreciated.

I would like to know, first of all, if we anonymously declare 2 
specialized classes that happen to be the same, does Perl treat them 
as the same.


Take this situation:

  my Array of Int $foo;
  my Array of Int $bar;
  my Array of Str $baz;
  $foo.WHAT eqv $bar.WHAT; # true or false?
  $foo.WHAT eqv $baz.WHAT; # true or false?

I don't know if eqv will do what I want in this case, or whether I 
need to use something else, but I would like a terse generic test 
that returns true for the first comparison and false for the second.


The test should also work for any such arbitrary 2 specialized class 
definitions, regardless of their dimensionality and regardless of 
what they are composed of, be it Array, Hash, Set, Mapping, Seq, 
Pair, Signature, Capture, etc.


I would also like to know if the collection of a class' attributes is 
the same as a Signature or not, since they look rather similar to me. 
If it is not a Signature, then what is the name of the data type that 
represents just the collection of attributes that a class has? 
Similarly, what is the name of the data type that represents a single 
attribute definition, or of a single element of a Signature?


In a similar fashion, I would like an easy way to use a class' 
collection of attributes like a uniquely identifying fingerprint, and 
use that to generate the name of that class or use it in its place.


Within certain limits that can be otherwise specified, such as for 
those that subclass a certain other class (let's call it Tuple), I 
would like for class definitions to be like singletons, such that no 
2 classes can have the same collection of attributes, and if one 
tries to define a class with the same attributes twice, the second 
attempt just returns the existing class from the first attempt rather 
than making a new one.


Perhaps the problem can be simplified in a fashion by leveraging the 
feature where you can declare a symbolic alias for a class, so that 
the same class definition can be known by multiple names, but they 
are treated as the same.


For one example:

  class Foo is Tuple {
has Str $.name;
has Int $.age;
  }

  class Bar is Tuple {
has Str $.name;
has Int $.age;
  }

  class Baz is Tuple {
has Str $.name;
has Int $.age;
has Bool $.is_alive;
  }

  $a.WHAT =:= $b.WHAT; # true
  $a.WHAT =:= $c.WHAT; # false

  my Foo $a = Foo.new(...); # successful
  my Foo $b = Bar.new(...); # successful
  my Foo $c = Baz.new(...); # compile or runtime exception

In the above example, I want to be able to declare Tuple in such a 
way that it would cause the above behaviour implicitly, eg that Bar 
::= Foo without the user who declares Foo or Bar doing the ::= 
explicitly.


But this needs to work for both explicitly and implicitly defined 
classes.  For example, continuing from the above:


  my Baz $d = Baz.new(...); # successful
  my Foo $e = $d.project( 'name', 'age' ); # successful
  $e === Foo.new( name => $d.name, age => $d.age ); # true

  class Quux is Tuple {
has Bool $is_alive;
  }

  my Quux $f = Quux.new(...); # successful
  my Baz $g = $a.join( $f ); # successful

  class Fuz is Tuple {
has Int $.is_alive;
  }

  class Fizz is Tuple {
has Bool $.is_dead;
  }

  my Quux $h = Fuz.new(...); # fails
  my Quux $i = Fizz.new(...); # fails
  my Baz $j = $a.join( $h ); # fails

Now, maybe I can accomplish what I want in some submethod or other of 
Tuple, which has access to the pseudo meta-class or whatever of the 
class being created around it, but I would appreciate some helpful 
code examples for exactly how to accomplish this.


I would also appreciate examples of how to generate a class or 
classless object period at runtime using the meta-model, since the 
above project() and join() methods above would be doing just that.


(Now, the reason that I didn't use Tuple with 'does' rather than 'is' 
is that I wanted to keep separate 2 classes that do Tuple but are 
implemented differently, such as in-RAM-only vs tied-to-disk-file; 
they would say "is TupleInRAM" or "is TupleOnDisk" respectively, and 
even if a class of one declares the same attributes as the other, 
they would be treated as 2 distinct classes by Perl; while they could 
be used interchangeably in some situations, certain other situations 
would make that unwise.  That said, practically speaking, "does" 
*may* be better than "is" for what I'm suggesting, or it may not, but 
either way I would like to have something like the above behaviour.)


Oh yes, while I didn't include it in the above examples, any class 
that is/does Tuple should be able to be an attribute type of another 
one.  For example:


  class Pouf is Tuple {
has Foo $.foo;
has Quux $.z;
has Str $.st

PCR replaces PGE in Pugs

2006-09-17 Thread Agent Zhang

Tonight, Audrey implemented the bridge between Pugs' Haskell core and
the Perl 5 module Pugs::Compiler::Rule, thus bringing rules support to
our pugs ``for free''. This is really good news to us. :)

For more than one year, Pugs had required parrot to provide full Perl
6 regexes (rules) support since Pugs didn't have its own grammar
engine. In those early days, parrot's PGE (Parrot Grammar Engine) was
the only choice.

However, obtaining and compiling parrot is a daunting task for most
inexperienced users. And furthermore, the Pugs team had been fighting
with the interoperability between these two animals to ensure they
play together. Everyone remembers that the parrot embedding was ever
something like a nightmare.

Hence it was hoped that pugs could get rid of the parrot dependency
completely. With fglock's excellent work started from the beginning of
this year, it is already possible today. Pugs::Compiler::Rule (PCR) is
a pure Perl 5 implementation for Perl 6 regexes. Although there's
still a lot of missing features in PCR (see its TODO file for
details), we're having a simple Perl 6 compiler based on it, which
passes ~1000 tests in the Pugs test suite. So it's good enough. Now
you can try out Perl 6 regexes without parrot:

   pugs> 'abc' ~~ /\w+/
   Match.new(
 ok => Bool::True,
 from => 0,
 to => 3,
 str => "abc",
 sub_pos => (),
 sub_named => {}
   )

Audrey said it reuses the now-on-by-default perl 5 embedding feature
of pugs. It also works for Windows users since I've helped her to
solve the long-overdue p5 embedding problem on ActivePerl 5.8.x. Thus
the long-standing message ``perl5 embedding is not available on
Win32'' while building pugs is finally gone! Yay!

Note that the PCR integration work is in progress, but we believe it's
a good start anyway. :D

P.S. This mail has also been posted on Audrey's blog site:

   http://pugs.blogs.com/pugs/2006/09/pcr_replaces_pg.html

Cheers,

Agent