Re: [perl #69052] Build error on Mac OS X

2010-03-10 Thread Alexander Temerev
Well, almost half a year have passed since this bugreport. :)

Now everything works fine indeed, you can close it.

  Cheers,
  Alexander Temerev



On Tue, Mar 9, 2010 at 3:58 AM, Will Coleda via RT
perl6-bugs-follo...@perl.org wrote:
 On Tue Sep 08 04:32:07 2009, sor...@gmail.com wrote:
 I tried to build today's Git version on Mac OS X Snow Leopard, and
 here is what I got:

 mbp:rakudo atemerev$ perl Configure.pl --gen-parrot
 ...
 src/packout.c
 src/pic_jit.c
 src/pic.c
 src/platform.c
 config/gen/platform/generic/hires_timer.c: In function
 ‘Parrot_hires_get_time’:
 config/gen/platform/generic/hires_timer.c:41: warning: implicit
 declaration of function ‘clock_gettime’
 config/gen/platform/generic/hires_timer.c:41: warning: nested extern
 declaration of ‘clock_gettime’
 config/gen/platform/generic/hires_timer.c:41: error: ‘CLOCK_PROF’
 undeclared (first use in this function)
 config/gen/platform/generic/hires_timer.c:41: error: (Each undeclared
 identifier is reported only once
 config/gen/platform/generic/hires_timer.c:41: error: for each function
 it appears in.)
 make: *** [src/platform.o] Error 1

 Reading configuration information from parrot_config ...
 ===SORRY!===
 Parrot revision r41083 required (currently r0)

 To automatically checkout (svn) and build a copy of parrot r41083,
 try re-running Configure.pl with the '--gen-parrot' option.
 Or, use the '--parrot-config' option to explicitly specify
 the location of parrot_config to be used to build Rakudo Perl.

 ===

 mbp:rakudo atemerev$ perl -V
 Summary of my perl5 (revision 5 version 10 subversion 0)
 configuration:
   Platform:
     osname=darwin, osvers=10.0, archname=darwin-thread-multi-2level
     uname='darwin neige.apple.com 10.0 darwin kernel version 10.0.0d8:
 tue may 5 19:29:59 pdt 2009; root:xnu-1437.2~2release_i386 i386 '
     config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags=
 -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none
 -Dcc=gcc-4.2'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=define, usemultiplicity=define
     useperlio=define, d_sfio=undef, uselargefiles=define,
 usesocks=undef
     use64bitint=define, use64bitall=define, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='gcc-4.2', ccflags ='-arch x86_64 -arch i386 -arch ppc -g -pipe
 -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include',
     optimize='-Os',
     cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing
 -I/usr/local/include'
     ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)',
 gccosandvers=''
     intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
     d_longlong=define, longlongsize=8, d_longdbl=define,
 longdblsize=16
     ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
 lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='gcc-4.2 -mmacosx-version-min=10.6', ldflags ='-arch x86_64
 -arch i386 -arch ppc -L/usr/local/lib'
     libpth=/usr/local/lib /usr/lib
     libs=-ldbm -ldl -lm -lutil -lc
     perllibs=-ldl -lm -lutil -lc
     libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true,
 libperl=libperl.dylib
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags='-arch x86_64 -arch i386 -arch ppc
 -bundle -undefined dynamic_lookup -L/usr/local/lib'


 Characteristics of this binary (from libperl):
   Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                         PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
 USE_64_BIT_ALL
                         USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                         USE_PERLIO USE_REENTRANT_API
   Locally applied patches:
       /Library/Perl/Updates/version comes before system perl directories
       installprivlib and installarchlib points to the Updates directory
   Built under darwin
   Compiled at Jun 24 2009 00:35:27
   @INC:
     /Library/Perl/Updates/5.10.0
     /System/Library/Perl/5.10.0/darwin-thread-multi-2level
     /System/Library/Perl/5.10.0
     /Library/Perl/5.10.0/darwin-thread-multi-2level
     /Library/Perl/5.10.0
     /Network/Library/Perl/5.10.0/darwin-thread-multi-2level
     /Network/Library/Perl/5.10.0
     /Network/Library/Perl
     /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level
     /System/Library/Perl/Extras/5.10.0
     .
 mbp:rakudo atemerev$


   Cheers,
   Alexander Temerev

 I am unable to duplicate this on:

 $ sw_vers
 ProductName:    Mac OS X
 ProductVersion: 10.6.2
 BuildVersion:   10C540

 parrot revision is r44781

 rakudo revision is aa8c65ed6b9d0b23ba6904b2745f998a83b36c6f

 Is this problem still occurring for you?
 --
 Will Coke Coleda



Re: Functional-style pattern matching

2010-03-10 Thread Moritz Lenz
Hi,

Little Walker wrote:
 I've been looking around to see if there's been any discussion of
 introducing functional programming-style pattern matching for method/
 function dispatch.  Could someone point me to any such discussions?

It's done multi dispatch in Perl 6, and you can find an introduction in
a book chapter which we're writing these days:

http://github.com/perl6/book/blob/master/src/multi-dispatch.pod

 I've seen that perl6 is taking on a lot of ideas from the functional
 world (lazy evaluation for instance).  With multi-method dispatch on
 the agenda pattern matching seems inevitable but I haven't been able
 to find information about this or any related discussions.
 
 This is a contrived example of what I'm referring to:
 
 sub traverse([Leaf $a]) {
   # do something
 }
 
 sub traverse([Tree $left, Tree $right]) {
   traverse($left);
   traverse($right);
 }
 
 my $t = Tree(...);
 traverse($t);

You got it almost right. The simples approach is to use normal matching:

multi traverse(Leaf $a) {
   # do something
}

multi traverse(Tree $t) {
   traverse($t.left);
   traverse($t.right);
}

The latter uses a bit of additional code for unpacking the $t parameter;
you can do that in a signature too (which is not yet covered in the book
chapter; you can find some documentation here:
http://perlcabal.org/syn/S06.html#Unpacking_tree_node_parameters)

multi traverse (Tree $t ( $left, $right) ) {
   traverse($left);
   traverse($right);
}

Since you don't actually access $t anywhere, there's no reason to give
it a name, so you can write this actually as


multi traverse (Tree $ ( $left, $right) ) {
   traverse($left);
   traverse($right);
}

Hope that helps,
Moritz
-- 
Moritz Lenz
http://perlgeek.de/ |  http://perl-6.de/ | http://sudokugarden.de/


Re: ^[[A^[[A

2010-03-10 Thread Moritz Lenz
Hi,

Kiffin Gish wrote:
 How can recall previous commands (history) using ./perl6 without getting
 ^[[A^[[A instead?

You need to have readline development files installed when configuring
and building Rakudo, then it just works[tm].

In the configure steps it should say

auto::readline -  Does your platform support
readline.yes.

Then reconfigure and rebuild rakudo, and you should be happy.
-- 
Moritz Lenz
http://perlgeek.de/ |  http://perl-6.de/ | http://sudokugarden.de/


Re: Symbol '$x' not predeclared in anonymous

2010-03-10 Thread John Harrison
Each line is executed independently. Local variables from 1 line of code
will not persist between returns.

Some things do persist though, classes for instance will persist, roles will
persist, grammars will persist, but sub routines will not, neither will
variables. I believe there are plans for some improvements, eventually, but
right now its fairly simplistic.

On Tue, Mar 9, 2010 at 11:42 AM, Kiffin Gish kiffin.g...@planet.nl wrote:

 I want to play around with perl6 and see what it can do.

 $ cd rakudo
 $ ./perl6
   my $x = 8
  say $x
 Symbol '$x' not predeclared in anonymous

 How can I define variables and use them later?

 --
 Kiffin Gish kiffin.g...@planet.nl
 Gouda, The Netherlands





-- 
John ash Harrison


[perl #73462] [BUG] The object coming back from a regex match is not of type Match in Rakudo

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


moritz_ rakudo: say ('a' ~~ /a/).WHAT
p6eval rakudo 16efb6: OUTPUT«Regex::Match()␤»
moritz_ rakudo: say ('a' ~~ /a/) ~~ Match
p6eval rakudo 16efb6: OUTPUT«Could not find non-existent sub Match [...]
* masak submits rakudobug

The spec is pretty clear that it should be Match.


Re: [perl #65784] [BUG] Can't build rakudo on a mac unibody 13''

2010-03-10 Thread Stéphane Payrard
On Tue, Mar 9, 2010 at 8:55 PM, Moritz Lenz via RT
perl6-bugs-follo...@perl.org wrote:
 Does this problem still persist with a current Rakudo?


nope

-- 
cognominal stef


Re: Functional-style pattern matching

2010-03-10 Thread Little Walker
 That's almost exactly the example from:

    http://perlcabal.org/syn/S06.html#Unpacking_tree_node_parameters

1. I feel incredibly embarrassed to have missed this
2. This is awesome!



[perl #73460] [BUG] You can sneak a Block into a variable typed as a Whatever in Rakudo

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


moritz_ rakudo: my $x = *; say $x.WHAT
p6eval rakudo de996e: OUTPUT«Block()␤»
moritz_ now that's... confusing
masak nod.
moritz_ rakudo: say *.WHAT
p6eval rakudo de996e: OUTPUT«Whatever()␤»
masak rakudo: say Block ~~ Whatever
p6eval rakudo de996e: OUTPUT«0␤»
masak rakudo: my Whatever $x = *; say $x.WHAT
p6eval rakudo de996e: OUTPUT«Block()␤»
* masak submits rakudobug


Re: Functional-style pattern matching

2010-03-10 Thread Little Walker
 Which is pretty powerful, really.

Absolutely - I think you're referring to the 'type subset' stuff which
is great.

 This is where Perl 6 is not the same as functional
 languages, since it's got an imperative OO element as well.

True, there can be friction between the functional style and OO, but
look at how Scala manages it with case classes.  When you look at the
implementation, really it boils down to syntactic sugar but then so do
many of the cool new features in Perl 6!

I bring this up because when thinking of what will be possible with
lazy evaluation, junctions, named parameter shorthand, closures, etc.,
etc., somehow pattern matching screams out at me.  It can be concise,
expressive and unambiguous, and very complementary to Perl 6's
existing feature set.  I know a lot of work went into bringing
functional and OO together to make Scala happen, so certainly there
may be impracticalities in just 'adding pattern matching'.

Scala case classes: http://www.scala-lang.org/node/107 or
http://programming-scala.labs.oreilly.com/ch06.html#CaseClasses



Re: Functional-style pattern matching

2010-03-10 Thread Mark J. Reed
Does the unpacking participate in dispatch?  If a Hash comes in as $t
with no 'left' key, will it fail to match?


On Tuesday, March 9, 2010, Little Walker en...@dircon.co.uk wrote:
 Which is pretty powerful, really.

 Absolutely - I think you're referring to the 'type subset' stuff which
 is great.

 This is where Perl 6 is not the same as functional
 languages, since it's got an imperative OO element as well.

 True, there can be friction between the functional style and OO, but
 look at how Scala manages it with case classes.  When you look at the
 implementation, really it boils down to syntactic sugar but then so do
 many of the cool new features in Perl 6!

 I bring this up because when thinking of what will be possible with
 lazy evaluation, junctions, named parameter shorthand, closures, etc.,
 etc., somehow pattern matching screams out at me.  It can be concise,
 expressive and unambiguous, and very complementary to Perl 6's
 existing feature set.  I know a lot of work went into bringing
 functional and OO together to make Scala happen, so certainly there
 may be impracticalities in just 'adding pattern matching'.

 Scala case classes: http://www.scala-lang.org/node/107 or
 http://programming-scala.labs.oreilly.com/ch06.html#CaseClasses



-- 
Mark J. Reed markjr...@gmail.com


Re: Functional-style pattern matching

2010-03-10 Thread Carl Mäsak
Mark ():
 Does the unpacking participate in dispatch?  If a Hash comes in as $t
 with no 'left' key, will it fail to match?

Yes.

$ perl6 -e 'sub foo(%h($left)) { say $left }; foo({ left = OH HAI })'
OH HAI

$ perl6 -e 'sub foo(%h($left)) {}; foo({ no = left key })'
Not enough positional parameters passed; got 0 but expected 1
[...]

The error message is perhaps slightly LTA, but at least Rakudo
(correctly) fails to match.

// Carl


Re: Functional-style pattern matching

2010-03-10 Thread Mark J. Reed
Oh, wow.  I was just asking about the spec; didn't know this stuff
already worked.  Rakudos to the team! :)

On Wed, Mar 10, 2010 at 9:18 AM, Carl Mäsak cma...@gmail.com wrote:
 Mark ():
 Does the unpacking participate in dispatch?  If a Hash comes in as $t
 with no 'left' key, will it fail to match?

 Yes.

 $ perl6 -e 'sub foo(%h($left)) { say $left }; foo({ left = OH HAI })'
 OH HAI

 $ perl6 -e 'sub foo(%h($left)) {}; foo({ no = left key })'
 Not enough positional parameters passed; got 0 but expected 1
 [...]

 The error message is perhaps slightly LTA, but at least Rakudo
 (correctly) fails to match.

 // Carl




-- 
Mark J. Reed markjr...@gmail.com