Re: p6 Q: How do I metaprogram this?

2009-12-09 Thread Patrick R. Michaud
On Wed, Dec 09, 2009 at 12:16:32AM -0500, Austin Hastings wrote:
 But I'm curious if there's some P6 feature I've forgotten about
 (which I've forgotten most of them, excepting the rev number)
 that would let me do this without having to go too far away from
 the metal.
 
 Coming at this from a different angle, C# offers syntactic sugar for
 getter/setter methods. This example of mine might be a candidate for
 a macro, depending on the language. But is this a p6 macro? Or is
 there some in-between that I just don't know about.

In Perl 6, getter and setter methods are generated automatically
for most attributes that are declared with a dot twigil.  Writing

has $.xyz;

in a class declaration (note the dot twigil) automatically 
defines a getter method for the class that is similar to:

multi method xyz() { $!xyz }

And writing 

has $.xyz is rw;

automatically creates a getter/setter method that allows both
read and write access to the invocant's $!xyz attribute.

I've thought briefly about having NQP automatically create
getter methods as well, but for the moment it feels safer to
not do this and require them to be written explicitly.  Writing 
p6-like setter (rw) methods in NQP is a real pain at the moment,
because native Parrot doesn't have a convenient mechanism for
a method to return a reference to an attribute slot.  (In other 
words, there's not a good way in core Parrot to do the equivalent 
of  foo() := $value;  or  $obj.method() := $value; .)

Pm


Re: Perl 6 IDEs

2009-12-09 Thread Bit-Man
2009/12/7 Gabor Szabo szab...@gmail.com:
 2009/12/7 Gabor Szabo szab...@gmail.com:
 2009/12/6 Víctor A. Rodríguez (Bit-Man) vic...@bit-man.com.ar:
 Hi perlsixers,

 we've been working a bit on Perl 6 lately [1] and some work, even the
 basic coding, would be great if we use some IDE.
 I'm a regular Eclipse user and EPIC seems the natural choice for me,
 but it doesn't support Perl 6 (yet). Also tied to install Padre on top
 of Ubuntu but just went to nowhere :-P

 What went wrong?
 How could I help you get you going?


 Well, it seems I finally manged to build a very experimental package for 
 Linux.
 It even worked on one system I tried on which was not the one I built it on. 
 :-)

 If any of you is interested - though it does not contain the perl 6 plugin 
 yet -
 you can download the first experimental version of a Perl 5 package
 containing Padre.
 http://perlide.org/download/binary/perl-5.10.1-xl-0.01.tar.gz

 after downloading

 $ tar xzf perl-5.10.1-xl-0.01.tar.gz

 and

 $ ./perl-5.10.1-xl-0.01/perl/bin/padre.sh

 notice one needs to run the shell file!

It worked like a charm, just download, untar an run.

 please check it out and let me know what distribution and what version
 have you tried and

Ubuntu 9.04
Linux tabletux 2.6.28-16-generic #55-Ubuntu SMP Tue Oct 20 19:48:24
UTC 2009 i686 GNU/Linux

 if it worked or not. Based on this, tomorrow I'll attempt to build a
 version that includes the
 Perl 6 plugin as well. Or go back to the drawing board to find another
 way to build it.

 Gabor





-- 
Víctor A. Rodríguez (http://www.bit-man.com.ar)
El bit Fantasma (Bit-Man) - Programming: love it or leave it.
Perl Mongers Capital Federal (http://cafe.pm.org/)
GNU/Linux User Group - FCEyN - UBA (http://glugcen.dc.uba.ar/)


[perl #71112] [BUG] @_ is writeable in subroutines without explicit signature in Rakudo; shouldn't be

2009-12-09 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #71112]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=71112 


masak rakudo: sub foo { @_[0] = bah }; my $a = !; foo($a); say $a
p6eval rakudo 7ef386: !␤
TimToady i'd've expected it to blow up
* masak submits rakudobug
masak TimToady: so in the default signature, @_ isn't writeable?
TimToady no, it's different from P5 in that
masak ok.
TimToady but most P5 programs aren't modifying their parameters
TimToady and we didn't want to pay the might-be-lvalue penalty anymore
TimToady that was decided in about 2003 or so
masak nod.


[perl #71110] [BUG] Optional parameters before required shouldn't be allowed, but Rakudo doesn't catch them

2009-12-09 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #71110]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=71110 


masak rakudo: sub foo($a = 1, $b) { say $a }; foo(3)
p6eval rakudo 7ef386: Not enough positional parameters passed; got 1
but expected between 1 and 2 [...]
* masak submits rakudobug
masak ng: sub foo($a = 1, $b) { say $a }; foo(3)
p6eval ng 153b18: Not enough positional parameters passed; got 1 but
expected between 1 and 2 [...]

First off, the error message is nonsensical.

Second, the declaration of a signature where optional parameters
preceed required ones should be rejected at compile-time, but the
error message comes from calling the routine at runtime.


Re: Perl 6 IDE: Perl 5 XL 0.02 with Padre and the Perl 6 plugin

2009-12-09 Thread Richard Hainsworth

Gabor,

Thanx this is a good step forward.

With simple files, no problem. I tried a larger file and got the 
following in the terminal window:


./perl-5.10.1-xl-0.02/perl/bin/padre.sh
Thread 1 terminated abnormally: Undefined subroutine Padre::Util::debug 
called at 
/home/richard/webdownloads/perl-5.10.1-xl-0.02/perl/lib/site_perl/5.10.1/Padre/Plugin/Perl6/Perl6StdColorizerTask.pm 
line 216.


Richard
Gabor Szabo wrote:

Hi,

Let me announce version 0.02 of the XL Perl 5 distribution (temporary
name, I hope :-)
for Linux that contains a full version of Perl 5.10.1, Padre 0.51 and
the Perl 6 plugin of Padre.

This is still very experimental of course.

You can download it from here:

http://perlide.org/download/binary/perl-5.10.1-xl-0.02.tar.gz

tar xzf perl-5.10.1-xl-0.02.tar.gz

./perl-5.10.1-xl-0.02/perl/bin/padre.sh

(Note, running the .sh file!)

In order to use the Perl 6 plugin you will have first enable it:
Plugins/Plugin Manager  - Select Perl 6 and click on Enable
Due to a bug you will have to restart Padre for this to take effect.

Then go to

Edit/Preferences/Files and Colors
Select Perl 6 as File type and Std.pm as Highlighter in order to get
syntax highlighting.

Enjoy and let me know about the issues you encounter or if you are
using it successfully.

regards
   Gabor
  


Re: Perl 6 IDE: Perl 5 XL 0.02 with Padre and the Perl 6 plugin

2009-12-09 Thread Richard Hainsworth

Gabor Szabo wrote:

You can download it from here:

http://perlide.org/download/binary/perl-5.10.1-xl-0.02.tar.gz

  

For me using Firefox/Ubuntu, I got an error, but
http://www.perlide.org/download/binary/perl-5.10.1-xl-0.02.tar.gz
worked fine.

Richard


Re: Perl 6 IDEs

2009-12-09 Thread Guy Hulbert
On Tue, 2009-08-12 at 20:45 -0300, Víctor A. Rodríguez (Bit-Man) wrote:
  $ ./perl-5.10.1-xl-0.01/perl/bin/padre.sh
 
  notice one needs to run the shell file!
 
 It worked like a charm, just download, untar an run.

Debian etch is on gcc 2.3 so not for me.  I'll try lenny when I get some
tuits.  However, I'm a hard-core emacs user ...

 
  please check it out and let me know what distribution and what
 version
  have you tried and

-- 
--gh




Re: Perl 6 IDE: Perl 5 XL 0.02 with Padre and the Perl 6 plugin

2009-12-09 Thread Gabor Szabo
On Wed, Dec 9, 2009 at 2:18 PM, Richard Hainsworth rich...@rusrating.ru wrote:
 Gabor,

 Thanx this is a good step forward.

 With simple files, no problem. I tried a larger file and got the following
 in the terminal window:

 ./perl-5.10.1-xl-0.02/perl/bin/padre.sh
 Thread 1 terminated abnormally: Undefined subroutine Padre::Util::debug
 called at
 /home/richard/webdownloads/perl-5.10.1-xl-0.02/perl/lib/site_perl/5.10.1/Padre/Plugin/Perl6/Perl6StdColorizerTask.pm
 line 216.


That's a stupid bug that has already been fixed in the new version of
the Perl6 plugin but it has not been released yet.
We removed the Padre::Util::debug sub from Padre and the plugins were
not yet release with the update.

Sorry for that.
Feel free to remove that line from the Perl6StdColorizerTask.pm file
or any other place you might find.

Gabor


Re: Perl 6 IDE: Perl 5 XL 0.02 with Padre and the Perl 6 plugin

2009-12-09 Thread Richard Hainsworth

Gabor,

Now it works.

Richard

Gabor Szabo wrote:

On Wed, Dec 9, 2009 at 2:18 PM, Richard Hainsworth rich...@rusrating.ru wrote:
  

Gabor,

Thanx this is a good step forward.

With simple files, no problem. I tried a larger file and got the following
in the terminal window:

./perl-5.10.1-xl-0.02/perl/bin/padre.sh
Thread 1 terminated abnormally: Undefined subroutine Padre::Util::debug
called at
/home/richard/webdownloads/perl-5.10.1-xl-0.02/perl/lib/site_perl/5.10.1/Padre/Plugin/Perl6/Perl6StdColorizerTask.pm
line 216.




That's a stupid bug that has already been fixed in the new version of
the Perl6 plugin but it has not been released yet.
We removed the Padre::Util::debug sub from Padre and the plugins were
not yet release with the update.

Sorry for that.
Feel free to remove that line from the Perl6StdColorizerTask.pm file
or any other place you might find.

Gabor
  


configuring padre for perl6

2009-12-09 Thread Richard Hainsworth
On Wed, Dec 9, 2009 at 5:50 PM, Richard Hainsworth 
rich...@rusrating.ru wrote:



Removing line 261 fixed the problem.

How do I define where perl6 looks for modules?

If I have a module in the same directory as the script, invoking perl6 in
the directory works fine. But Padre assumes the home directory is the
current directory.

Richard


I think if you put a Makefile.PL in the root directory - just as any CPAN module
that might work or you might need to configure the PERL6LIB environment variable
as I don't think there is direct support for it in Padre. Not yet.


BTW Could we keep these questions and answers on the mailing list?
Either the Perl 6 list or the Padre-dev list?

Gabor

done.
Richard



Re: Parrot and Perl 6 Summary

2009-12-09 Thread Lithos
Please find:

http://lith-ology.blogspot.com/2009/12/seven-days-between-parrot-and-camel.html

Lithos