Re: Which brackets should @a.perl use?

2009-01-05 Thread Markus Laker
Uri,

On Sun, 04 Jan 2009 22:37:43 -0500, Uri Guttman wrote:

> that fails with nested arrays. we don't want them to flatten.
> 
> my $c = eval '(1, (4, 5), 3)';
> 
> will that work as you envision?

No, but it's not what I'm proposing.  A reference must Perlify as a
reference, just as it does today, so that .perl doesn't destroy
information by flattening where you don't want it to.  Here's what I
propose:


my @a = 1, 2, 3;
@a.perl.say; # (1, 2, 3)

my $ra = @a;
$ra.perl.say;# [1, 2, 3]

my @b = 1, [2, 3], 4;
@b.perl.say; # (1, [2, 3], 4)

my $rb = @b;
$rb.perl.say;# [1, [2, 3], 4]


My objection to the current behaviour is that @a and $ra Perlify to the
same string -- '[1, 2, 3]' -- losing the information that @a is an array
and $ra is a reference to an array.  Therefore, if you serialise and
unserialise an array, you always get an array of a single element,
containing a reference to the real data.  What you get back is not what
you put in.

Markus


Re: reporting bugs

2009-01-05 Thread Dave Whipp

Patrick R. Michaud wrote:

On Sun, Jan 04, 2009 at 05:20:56PM +0300, Richard Hainsworth wrote:
I posted an email to per6-all asking about how one should go about  
reporting bugs. That message has appeared on the list.


So again: how can bugs be reported?


See the "Reporting bugs" section of README file in languages/perl6.

(Honestly, I don't know why we call such files "README", since nobody
ever does.  I think I'll rename the file to "IGNOREME" -- maybe it'll
get some attention then. :-)


Perhaps modify the Makefile:

# targets for building a standalone perl6.
# (We're not quite ready to make this a default target.)
perl6$(EXE): perl6.pbc
$(PBC_TO_EXE) perl6.pbc
@echo "$@ built: for more info, or to file bugs, see the README"


Re: Which brackets should @a.perl use?

2009-01-05 Thread moritz
>> "m" == moritz   writes:
>
>   m> S02 says:
>
>   m> "To get a Perlish representation of any object, use the .perl method.
> Like
>   m> the Data::Dumper module in Perl 5, the .perl method will put quotes
> around
>   m> strings, square brackets around list values,"
>
>   m> So according to this, Rakudo has it right.
>   m> But I think that a .perl()ification as ("blue", "light", "hayard",)
> would
>   m> make much more sense, because simple thing like
>
>   m> @a.push eval(@b.perl)
>
>   m> would then DWIM.
>
> for your def of DWIM. i can see wanting an anon array to be pushed onto
> @a building up a structure.

DWIM in the sense that "eval($stuff.perl)" should behave the same as
$stuff itself.

since @a.push(@b) flattens @b into @a, why should I expect something
different from @a.push(eval(@b.perl))?

> your example is too simple to really cover
> this as you could just push @b or a ref to @b (damn, i need to learn
> more basic p6 syntax! :).

If people want @a.push(\...@b) or @a.push([...@b]), they can just write that -
and if the want to use eval + perl, they can include the brackets or
backslash just as well.

> a more useful example would be serializing data trees. if you dump @b
> with .perl do you want the current dumper output of a anon array or your
> list of values? when serializing a tree, you must get the ref version so
> that is the common and default usage. your version isn't DWIMmy there at
> all.

Maybe we can construct something magic with slice context and captures
instead?

Cheers,
Moritz



Re: [perl #61928] [BUG] (undef === undef)

2009-01-05 Thread Moritz Lenz
Patrick R. Michaud wrote:
> On Fri, Jan 02, 2009 at 01:52:45PM -0800, Todd Hepler wrote:
>> I think this is a bug, but I'm not sure.
>> 
>> (undef === undef) currently evaluates to false.  Seem like it should be 
>> true.
>> 
>> I couldn't find a test for it, so below is a patch to add one.
> 
> Before entering a fix for this, I'm curious if (undef =:= undef)
> should evaluate to true or false? 

It should fail, because undef isn't a container, and =:= only operates
on containers.

Cheers,
Moritz


rfc: The values of a junction

2009-01-05 Thread Dave Whipp
I spent a fair amount of time with Rakudo over the holiday break (see 
http://dave.whipp.name/sw/perl6 for the writeup). I was generally 
impressed with both  the language and its implementation. There were, 
unsurprisingly, a bunch of things missing. Some of these were things 
that are in the spec, but not yet in Rakudo. Others are things that feel 
important, but which could be added later, via modules. But one 
omission, junctional collapse, appears to me to require core language 
support: it is not a feature that can be added as a user module.


The term "collapse" is a metaphor taken from quantum mechanics. It is 
apt, because the concept of the "values" of a junction makes sense only 
in the context of the action of an operator on the junction. It is my 
proposal that we add a new meta-operator to S03 that acts to apply other 
operators (equality and inequality tests) to junctions:


  @domain  |op| $junction --> @values  ## junction-collapsing "grep"
  @domain !|op| $junction --> @values  ## it's negated partner

The operator has the semantics of a "grep", but with the ability to 
handle infinite ranges in finite time. The reason for this should become 
apparent from a motivating example. Consider a blackjack hand: a set of 
cards where the value of aces is either 1 or 11. The total value of a 
hand can be described as a junction:


  my $ace = 1 | 11;
  my $seven = 7;
  my @hand = $ace xx 3, $seven;
  my $junc_value = [+] @hand;  ## any( 10, 20, 30, 40 )

There are a bunch of possible values in the junction. The one we care 
about is the largest that is not greater than 21. Using Perl6 as it 
stands today, the way to extract this value is brute force:


  my $concrete_value = max (0..21).grep: { $^score == $junc_value };

This will work, but doesn't scale. Imagine we wanted all the possible 
values, and know nothing about their domain:


  my @all_values = (-Inf..Inf).grep: { $^score == $junc_value };

This code has an obvious performance problem that would be tricky to 
optimize away! And that problem is the justification of my assertion 
that junctional collapse requires core language support. Using a "grep" 
meta operator:


  my $concrete_value = max 0 .. 21 |==| $junc_value;
  my @all_values = -Inf .. Inf |==| $junc_value;

the infinite range can be handled correctly.

Adding a new meta-operator should not be undertaken lightly. I believe 
that the collapse of junctions is a necessary feature of the language, 
and one that cannot be added as a user-module. Furthermore, alternatives 
such as a "eigenvalues" method on the Junction class fail to address the 
core property of junctions that their value depends on the operator that 
is used to observe them.


Another hurdle that the meta operator must overcome it to demonstrate 
that it is sufficiently general. If the only values of "op" was "==", 
then we wouldn't need a "meta". Also, the operator has application 
beyond collapsing junctions. Some more examples:


  say ^Inf |>| one 4 .. Inf; ## result == 5

  say @lines |~~| /word/;## no junction: a standard "grep"


An additional feature -- not part of my core proposal, but one that I 
think would add value -- would be to allow a typename to be used as the 
LHS domain, in place of an infinite range:


  say ::Str  |eq|  any < foo bar baz >; ## match against all strings
  say ::Str !|ne|  all < foo bar baz >; ## same result
  say ::Str !|eq| none < foo bar baz >; ## same again!

or a finite range:

  subset BJ_score where { $_ == any 0 .. 21 };
  say "score is { max( ::BJ_score |==| $junc_score ) // "bust" }"


I'd like to think that this proposal is an obvious way to meet a 
necessary need. Even if this exact approach is not chosen, I hope to 
have at least convinced you that core language support is needed to 
extract the "values" of a junction; and that a "Junction::eigenvalues" 
method is not the correct way to achieve this.



Dave.

ps. The reason for choosing vertical bars, |op|, as the meta-op syntax 
is partly by analogy to the concept of "absolute value" that 
mathematicians express using vertical bars; and partly a less-cute 
distillation of a "bra-ket" suggestion I make in the writeup that I 
referenced above.


r24769 - docs/Perl6/Spec

2009-01-05 Thread pugs-commits
Author: moritz
Date: 2009-01-05 17:54:50 +0100 (Mon, 05 Jan 2009)
New Revision: 24769

Modified:
   docs/Perl6/Spec/S29-functions.pod
Log:
[S29] document isa, can, does, perl and clone


Modified: docs/Perl6/Spec/S29-functions.pod
===
--- docs/Perl6/Spec/S29-functions.pod   2009-01-05 16:53:12 UTC (rev 24768)
+++ docs/Perl6/Spec/S29-functions.pod   2009-01-05 16:54:50 UTC (rev 24769)
@@ -190,6 +190,22 @@
 
 =head1 Function Packages
 
+=head2 Object
+
+Every object conforms to the type C. The following methods are thusly
+available on every object.
+
+=over
+
+=item perl
+
+ our Str multi method perl (Object $o)
+
+Returns a perlish representation of the object, so that calling C
+on the returned string reproduces the object as good as possible.
+
+=back
+
 =head2 Any
 
 The following are defined in the C role:
@@ -206,6 +222,27 @@
 from C<$by> in that each criterion is applied, in order,
 until a non-zero (equivalent) result is achieved.
 
+=item can
+
+ our Bool multi method can ($self:, Str $method)
+
+If there is a multi method of name C<$method> that can be called on
+C<$self>, then closure is return has C<$self> bound to the position
+of the invocant.
+
+Otherwise an undefined value is returned.
+
+=item clone
+
+ our multi method clone (::T $self --> T)
+ our multi method clone (::T $self, *%attributes --> T)
+
+The first variant retuns  an independent copy of C<$o> that is equivlant
+to C<$o>.
+
+The second variant does the same, but any named arguments override an
+attribute during the cloning process.
+
 =item cmp
 
  our Order multi sub cmp (Ordering @by, $a, $b)
@@ -219,6 +256,19 @@
 (tie) result is achieved.  If the values are not comparable,
 returns a proto C object that is undefined.
 
+=item does
+
+ our Bool multi method does ($self:, $type)
+
+Returns C if and only if C<$self> conforms to type C<$type>.
+
+=item isa
+
+ our Bool multi method isa ($self:, $type)
+
+Returns true if a the invocant an instance of class C<$type>, or 
+of a subset type or a derived class (through inheritance) of C<$type>.
+
 =back
 
 =head2 Num



r24768 - docs/Perl6/Spec

2009-01-05 Thread pugs-commits
Author: particle
Date: 2009-01-05 17:53:12 +0100 (Mon, 05 Jan 2009)
New Revision: 24768

Modified:
   docs/Perl6/Spec/S19-commandline.pod
Log:
[S19] provide rules for negated single-character options; rearrange list items 
for clarity

Modified: docs/Perl6/Spec/S19-commandline.pod
===
--- docs/Perl6/Spec/S19-commandline.pod 2009-01-05 16:39:14 UTC (rev 24767)
+++ docs/Perl6/Spec/S19-commandline.pod 2009-01-05 16:53:12 UTC (rev 24768)
@@ -126,12 +126,14 @@
 
 =item *
 
-Option names follow Perl 6 identifier naming convention, but C<'>
-is not allowed.
+Options may be negated with C, for example C<--/name>, C<:/name>, C<-/n>.
+Each single-letter option in a cluster must be negated separately
+ (e.g. C<-a/n/o> is the same as C<-a -/n -/o>.)
 
 =item *
 
-Options may be negated with C, for example C<--/name>, C<:/name>, C<-/n>.
+Option names follow Perl 6 identifier naming convention, except C<'> is not
+allowed, and single-letter options may be any letter or number.
 
 =item *
 



Re: r24769 - docs/Perl6/Spec

2009-01-05 Thread Brandon S. Allbery KF8NH

On 2009 Jan 5, at 11:54, pugs-comm...@feather.perl6.nl wrote:

+ our Str multi method perl (Object $o)
+
+Returns a perlish representation of the object, so that calling  
C

+on the returned string reproduces the object as good as possible.


My inner English teacher cringes in pain.  It should be "accurately",  
or possibly "completely"; "good" just doesn't fit there.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




Re: rfc: The values of a junction

2009-01-05 Thread Daniel Ruoso
Em Seg, 2009-01-05 às 07:57 -0800, Dave Whipp escreveu:
>my $ace = 1 | 11;
>my $seven = 7;
>my @hand = $ace xx 3, $seven;
>my $junc_value = [+] @hand;  ## any( 10, 20, 30, 40 )
> There are a bunch of possible values in the junction. The one we care 
> about is the largest that is not greater than 21. Using Perl6 as it 
> stands today, the way to extract this value is brute force:
>my $concrete_value = max (0..21).grep: { $^score == $junc_value };

Well, that considering we don't have any introspection into junctions,
but I think it should be quite straight-forward to make junctions behave
as a list of its members...

  my $ace = 1 | 11;
  my $seven = 7;
  my @hand = $ace xx 3, $seven;
  my $junc_value = [+] @hand;
  my $concrete_value = max $junc_value.grep: { $^scope < 21 }; 

daniel



r24774 - docs/Perl6/Spec

2009-01-05 Thread pugs-commits
Author: particle
Date: 2009-01-05 20:29:06 +0100 (Mon, 05 Jan 2009)
New Revision: 24774

Modified:
   docs/Perl6/Spec/S19-commandline.pod
Log:
[S19] note behavior of clustered options with required values

Modified: docs/Perl6/Spec/S19-commandline.pod
===
--- docs/Perl6/Spec/S19-commandline.pod 2009-01-05 19:21:25 UTC (rev 24773)
+++ docs/Perl6/Spec/S19-commandline.pod 2009-01-05 19:29:06 UTC (rev 24774)
@@ -14,8 +14,8 @@
 
   Maintainer: Jerry Gay 
   Date: 12 Dec 2008
-  Last Modified: 3 Jan 2009
-  Version: 9
+  Last Modified: 4 Jan 2009
+  Version: 10
 
 This is a draft document. This document describes the command line interface.
 It has changed extensively from previous versions of Perl in order to increase
@@ -122,7 +122,9 @@
 
 =item *
 
-Single-letter options may be clustered. C<-ab> means C<-a -b>.
+Single-letter options may be clustered. C<-ab> means C<-a -b>. When a
+single-letter option which requires a value is clustered, the option may
+appear only in the final position of the cluster.
 
 =item *
 



Re: [perl #61920] [PATCH] test division in 02-op-math.t

2009-01-05 Thread Moritz Lenz
Kyle Hasselbacher (via RT) wrote:
> # New Ticket Created by  "Kyle Hasselbacher" 
> # Please include the string:  [perl #61920]
> # in the subject line of all future correspondence about this issue. 
> # http://rt.perl.org/rt3/Ticket/Display.html?id=61920 >
> 
> 
> I didn't see division in with the other "basic math ops", so...

Please note that most tests live in the "official Perl 6 test suite",
which lives in t/spec/ in the pugs repository (and is imported into the
rakudo working copy if you do 'make spectest').

New tests should go there, so that they can be shared by other
implementations.
If you want to commit directly to that repository, tell me your desired
nickname and email address, so that I can send you a commit bit for the
pugs repository.

In the mean time I'll try to figure out with your test patches.

Cheers,
Moritz


Re: [perl #61836] Rakudo cannot take the minimum of undef

2009-01-05 Thread Moritz Lenz
Carl MXXsak (via RT) wrote:
> # New Ticket Created by  "Carl Mäsak" 
> # Please include the string:  [perl #61836]
> # in the subject line of all future correspondence about this issue. 
> # http://rt.perl.org/rt3/Ticket/Display.html?id=61836 >
> 
> 
> Rakudo r34628:
> 
> $ perl6 -e 'undef min 2'
> Multiple Dispatch: No suitable candidate found for 'cmp', with signature 
> 'PP->I'
> [...]

Added tests to t/spec/S03-operators/misc.t (but I don't know what the
result should be, I just tested with lives_ok).

Cheers,
Moritz


Re: [perl #61838] Rakudo allows reference to variables before their declaration

2009-01-05 Thread Moritz Lenz
Carl MXXsak (via RT) wrote:
> # New Ticket Created by  "Carl Mäsak" 
> # Please include the string:  [perl #61838]
> # in the subject line of all future correspondence about this issue. 
> # http://rt.perl.org/rt3/Ticket/Display.html?id=61838 >
> 
> 
> Rakudo r34628:
> 
> $ perl6 -e 'my $a = $b'
> Scope not found for PAST::Var '$b'
> [...]
> 
> $ perl6 -e 'my $a = $b; my $b' # Compiles and runs!

This is actually the first test in t/spec/S04-declarations/my.t (or
sufficiently similar).

Cheers,
Moritz


Parrot Bug Summary

2009-01-05 Thread Parrot Bug Summary
Parrot Bug Summary

http://rt.perl.org/rt3/NoAuth/parrot/Overview.html
Generated at Mon Jan 5 14:00:01 2009 GMT
---

  * Numbers
  * New Issues
  * Overview of Open Issues
  * Ticket Status By Version
  * Requestors with most open tickets

---

Numbers

Ticket Counts: 29 new + 513 open = 542
Created this week: 4
Closed this week: 13

---

New Issues

New issues that have not been responded to yet

1 - 2 weeks old
2 - 3 weeks old
3 - 4 weeks old
4 - 5 weeks old
5 - 6 weeks old
60940 Test failure: t/dynpmc/foo.t
60798 [BUG] [META] Lack of 'To:' header may impede deliverability of email
6 - 7 weeks old
60658 Broken links to Glossary and Patch & Bug Report Submission Information
60652 Lexicals and :outer not Thawed Properly from PBC
60650 Lexical Associations Not Thawed with Tailcalls
7 - 8 weeks old
60578 parrot.org: add link for reporting problems to each page
8 - 9 weeks old
60338 [BUG] NCI segfaults with null pcc_params_signature
9 - 10 weeks old
60206 [BUG] [MMD] Segfault in Lua exception handler
10 - 11 weeks old
11 - 12 weeks old
59978 [TODO] Add SVN revision number of reports to Smolder front page
12 - 13 weeks old
59696 [TODO] Unimplemented Unicode Functions
13 - 14 weeks old
14 - 15 weeks old
15 - 16 weeks old
58990 [TODO] Design new spec coverage mechanism
16 - 17 weeks old
58740 [CAGE] t/configure/*.t and t/steps/*.t: Cleanup test setup/teardown code 
17 - 18 weeks old
58672 [TODO] implement method lookup iterators
58488 crashing parrot when calling create_lexinfo
18 - 19 weeks old
19 - 20 weeks old
58324 Build issues on WXP
58188 [TODO] Parrot_find_encoding_converter
58070 [RFC] Disallow .local declarations in long-style call statement
20 - 21 weeks old
58050 Segfault in "make testr" for t/compilers/imcc/syn/hll.t:2
---

Overview of Open Issues

PlatformSeverity   Tag  Lang
aix0abandoned 05005threads   0  Amber   0
All1fatal 1bounce0  BASIC   0
bsdos  0High  0Bug  89  bc  0
cygwin 2low   1compiler  0  befunge 0
cygwin_nt  0medium0configure 1  bf  0
darwin 7none  1core  2  cola0
dec_osf0Normal1dailybuild0  forth   0
dgux   0unknown   0docs  3  jako0
dos0Wishlist  3duplicate 0  Lisp0
dynixptx   0  install   2  lolcode 0
freebsd4   library   0  m4  0
generic0   notabug   0  ook 0
gnu0   notok 0  perl6   1
HPUX   0   ok0  plot0
irix   0   Patch26  punie   0
irix64 0   regex 2  pynie   0
Linux  1   sendToCPAN0  python  0
lynxos 0   Todo233  ruby0
mac0   unknown   0  scheme  0
machten0   utilities 0  tcl 0
macos  0   wontfix   0  urm 0
MacOS X7   Zcode   0
mswin324
netbsd 1
next   0
openbsd1
os20
os390  0
other  0
powerux0
qnx0
riscos 0
sco0
Solaris6
sunos  0
svr4   0
svr5   0
sysv   0
unicos 0
unicosmk   0
unix   0
unknown0
uts0
vms0
VOS0
Win32 11
---

Ticket Status By Version

New or OpenResolved

---

Requestors with most open tickets

Paul Cochrane 155
Will Coleda45
chromatic  32
Patrick R. Michaud 29
Jerry Gay  19
Mark Glines15
Reini Urban13
Allison Randal 13
Bernhard Schmalhofer   11
James Keenan   11

---

  * Total Issues
  * New Issues
  * Overview of Open Issues
  * Ticket Status By Version
  * Requestors with most open tickets

---
This page is CPU intensive to create, it will be updated 

Re: [perl #61840] [TODO] min= and max= operators

2009-01-05 Thread Moritz Lenz
Carl MXXsak (via RT) wrote:
> # New Ticket Created by  "Carl Mäsak" 
> # Please include the string:  [perl #61840]
> # in the subject line of all future correspondence about this issue. 
> # http://rt.perl.org/rt3/Ticket/Display.html?id=61840 >
> 
> 
> Rakudo r34628 doesn't support the assignment metaoperators C and 
> C.
> 
> $ perl6 -e 'my $a = 5; $a min= 2; say $a'
> get_iter() not implemented in class 'Integer'
> [...]

Added tests to t/spec/S03-operators/assign.t (which grows to an alarming
size...)

Cheers,
Moritz


r24779 - docs/Perl6/Spec

2009-01-05 Thread pugs-commits
Author: particle
Date: 2009-01-05 21:29:32 +0100 (Mon, 05 Jan 2009)
New Revision: 24779

Modified:
   docs/Perl6/Spec/S06-routines.pod
Log:
[S06] add another command-line short name example; modify comment to line up 
visually with others

Modified: docs/Perl6/Spec/S06-routines.pod
===
--- docs/Perl6/Spec/S06-routines.pod2009-01-05 20:25:22 UTC (rev 24778)
+++ docs/Perl6/Spec/S06-routines.pod2009-01-05 20:29:32 UTC (rev 24779)
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall 
   Date: 21 Mar 2003
-  Last Modified: 2 Jan 2009
+  Last Modified: 4 Jan 2009
   Number: 6
-  Version: 99
+  Version: 100
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -2741,6 +2741,7 @@
 # Short names
 -n :name
 -n=value   :name
+-nvalue:name # only if not declared Bool
 -n="spacy value"   :name«'spacy value'»
 -n='spacy value'   :name«'spacy value'»
 -n=val1,'val 2',etc:name«val1 'val 2' etc»
@@ -2756,7 +2757,7 @@
 --name 'spacy value'   :name«'spacy value'»
 --name=val1,'val 2',etc:name«val1 'val 2' etc»
 --name val1 'val 2' etc:name«val1 'val 2' etc» # only if declared @
--- # end named argument processing
+--  # end named argument processing
 
 # Negation
 --/name:!name



Re: r24769 - docs/Perl6/Spec

2009-01-05 Thread Tim Bunce
On Mon, Jan 05, 2009 at 05:54:50PM +0100, pugs-comm...@feather.perl6.nl wrote:
> Author: moritz
> Date: 2009-01-05 17:54:50 +0100 (Mon, 05 Jan 2009)
> New Revision: 24769

> +=item can
> +
> + our Bool multi method can ($self:, Str $method)
> +
> +If there is a multi method of name C<$method> that can be called on
> +C<$self>, then closure is return has C<$self> bound to the position
> +of the invocant.
> +
> +Otherwise an undefined value is returned.

"then closure is return has" ?
perhaps: "then the closure that is returned has" ?

If it returns a closure then isn't Bool the signature wrong?

Before someone 'fixes' that, though, couldn't can() just return a Bool,
and move the 'give me a closure' to another method?

Ignoring the performance cost of needlessly creating closures
for simple boolean usage, 'can' doesn't seem like a good name for
a 'give me a closure' method.

> +=item clone
> +
> + our multi method clone (::T $self --> T)
> + our multi method clone (::T $self, *%attributes --> T)
> +
> +The first variant retuns  an independent copy of C<$o> that is equivlant
> +to C<$o>.

typos "variant returns" and "equivalant"

> +The second variant does the same, but any named arguments override an
> +attribute during the cloning process.

perhaps: "any named arguments are applied to $self as attributes,
overriding any attributes with the same names". Makes it clearer that
the attributes aren't applied to nested elements.

> +=item isa
> +
> + our Bool multi method isa ($self:, $type)
> +
> +Returns true if a the invocant an instance of class C<$type>, or 

typos "Returns C if the invocant is an instance ..."

Tim.


[perl #61980] [BUG] French quote hyper operators don't work with -e one liners

2009-01-05 Thread via RT
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #61980]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=61980 >


Rakudo r34428:

$ echo 'say <1 2> »+« <1 1>' > test.t
$ ./perl6 test.t
23
$ ./perl6 -e 'say <1 2> »+« <1 1>'
Statement not terminated properly at line 1, near
"\x{c2}\x{bb}+\x{c2}\x{ab} <1 1"

current instr.: 'parrot;PGE;Util;die' pc 129
(runtime/parrot/library/PGE/Util.pir:83)

If I introduce a syntax error in the file, the french quotes are reported as
\x{ab} and \x{bb} (without \x{c2}), so I guess that an UTF-8 decoding
step is missing.

Cheers,
Moritz


Re: reporting bugs

2009-01-05 Thread Moritz Lenz
Richard Hainsworth wrote:
> s/has appeared/has NOT appeared/
> 
> Richard Hainsworth wrote:
>> I posted an email to per6-all asking about how one should go about 
>> reporting bugs. That message has appeared on the list.
>>

That's because perl6-all is a meta list, which subscribes you to p6l,
p6c and p6u. You still have to send your email to one specific list (for
example perl6-compiler would have been the appropriate one).

Cheers,
Moritz


[perl #61978] [TODO] Rakudo needs a .does method in Object

2009-01-05 Thread via RT
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #61978]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=61978 >


Rakudo r34428:

./perl6 -e '1.does(Int)'
Method 'does' not found for invocant of class 'Int'

Every object should have .does method, which should check the same type
conformance as $object ~~ Type does.
There are many tests for .does spread out all over the test suite, many
tests
for .does and builtin types are in
t/spec/S02-builtin_data_types/sigils-and-types.t

Cheers,
Moritz


[perl #61982] [BUG] is rw/copy traits causes assignment/binding confusion

2009-01-05 Thread via RT
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #61982]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=61982 >


Rakudo r34428

sub example ($x is rw) {
$x = 3;
my @a;
@a.push($x);
$x = 5;
say @a[0];
}
example(3);

Output is 5, should be 3.
The problem is the same for s/is rw/is copy/

A test for the "is copy" version is in
t/spec/integration/99problems-31-to-40.t

Cheers,
Moritz


Re: returning one or several values from a routine

2009-01-05 Thread Moritz Lenz
Daniel Ruoso wrote:
> Hi,
> 
> As smop and mildew now support ControlExceptionReturn (see
> v6/mildew/t/return_function.t), an important question raised:
> 
>  sub plural { return 1,2 }
>  sub singular { return 1 }
>  my @a = plural();
>  my $b = plural();
>  my @c = singular();
>  my $d = singular();
> 
> What should @a, $b, @c and $d contain?

@a = 1, 2;
$b = [1, 2];
@c = 1;
$d = 1;

(According to DWIM semantics and my understanding of the specs)

> Note that the spec says explicitly that a Capture should be returned,
> delaying the context at which the value will be used, this allows
> 
>  sub named { return :x<1> }
>  my $x := |(named);
> 
> So, this also means that assigning
> 
>  my @a = plural();
>  my @c = singular();
> 
> forces list context in the capture, which should return all positional
> parameters, as expected. But
> 
>  my $b = plural();
>  my $d = singular();
> 
> would force item context in the capture, and here is the problem, as a
> capture in item context was supposed to return the invocant.

Maybe we could have a different rule for captures in scalar contexts
that don't have an invocant?

Just my 0.02€,
Moritz


Re: rfc: The values of a junction

2009-01-05 Thread Dave Whipp
That doesn't solve the general problem:

  my $junc = any -4 .. Inf;
  my @domain = -Inf .. 4;

  my @values = @domain |==| $junc;
  say @values.perl
  >>> [ -4 .. 4 ]

How do you code that using "grep"?




From: Daniel Ruoso 
To: Dave Whipp 
Cc: perl6-langu...@perl.org
Sent: Monday, January 5, 2009 11:24:29 AM
Subject: Re: rfc: The values of a junction

Em Seg, 2009-01-05 às 07:57 -0800, Dave Whipp escreveu:
>my $ace = 1 | 11;
>my $seven = 7;
>my @hand = $ace xx 3, $seven;
>my $junc_value = [+] @hand;  ## any( 10, 20, 30, 40 )
> There are a bunch of possible values in the junction. The one we care 
> about is the largest that is not greater than 21. Using Perl6 as it 
> stands today, the way to extract this value is brute force:
>my $concrete_value = max (0..21).grep: { $^score == $junc_value };

Well, that considering we don't have any introspection into junctions,
but I think it should be quite straight-forward to make junctions behave
as a list of its members...

  my $ace = 1 | 11;
  my $seven = 7;
  my @hand = $ace xx 3, $seven;
  my $junc_value = [+] @hand;
  my $concrete_value = max $junc_value.grep: { $^scope < 21 }; 

daniel

[perl #61990] [BUG] setset .WHAT returns incorrect value

2009-01-05 Thread publiustemp-perl6interna...@yahoo.com (via RT)
# New Ticket Created by  publiustemp-perl6interna...@yahoo.com 
# Please include the string:  [perl #61990]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=61990 >


For r35004:

  subset Even of Int where { not $_ % 2 };
  my Even $num = 2;
  say $num;
  say $num.WHAT;


Output:

  2
  Int
 
I'm expecting:

  2
  Even

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog- http://use.perl.org/~Ovid/journal/
Twitter  - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6



Re: [perl #61990] [BUG] setset .WHAT returns incorrect value

2009-01-05 Thread Jonathan Worthington

publiustemp-perl6interna...@yahoo.com (via RT) wrote:

For r35004:

  subset Even of Int where { not $_ % 2 };
  my Even $num = 2;
  say $num;
  say $num.WHAT;


Output:

  2
  Int
 
I'm expecting:


  2
  Even

  
I think the current behaviour is correct (or at least, implemented to 
match my understanding of the Perl 6 type system). You're asking for the 
type of the value stored in $x, which is an Int.


Even is not a "real type", but rather a refinement type. It is set as a 
constraint on what may be held by the container. To get hold of that 
(though I don't think we implement any way right now) you probably would 
write $x.VAR.type or some such (I'm not sure exactly what the name of 
the method on the container that hands this back should be).


Hope this makes sense,

Jonathan


Re: rfc: The values of a junction

2009-01-05 Thread Dave Whipp

Daniel Ruoso wrote:

  my $concrete_value = max $junc_value.grep: { $^score < 21 }; 


In the general case, both the junction and the domain may be infinite:

my @domain = -Inf .. 3;
my $junc = any -4 .. Inf;

my @values = @domain |==| $junc;
say @values.perl
"[-4..3]"


Handling all the variations around this (including compound junctions)
will be quite tricky to implement, even if we did have introspection for
junctions. Certainly not stuff I'd want in typical user-code.




[perl #61988] "$.foo" doesn't accept args

2009-01-05 Thread Dave Whipp
# New Ticket Created by  "Dave Whipp" 
# Please include the string:  [perl #61988]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=61988 >


 rakudo: class A { method foo { say @_ }; method bar {
$.foo(42) } }; A.bar
rakudo 35004: OUTPUT«␤invoke() not implemented in class '

"$.foo(42)" should be synonymous with "self.foo(42)"

also for "$.foo: 42"


Re: returning one or several values from a routine

2009-01-05 Thread Jon Lang
Daniel Ruoso wrote:
>
> Hi,
>
> As smop and mildew now support ControlExceptionReturn (see
> v6/mildew/t/return_function.t), an important question raised:
>
>  sub plural { return 1,2 }
>  sub singular { return 1 }
>  my @a = plural();
>  my $b = plural();
>  my @c = singular();
>  my $d = singular();
>
> What should @a, $b, @c and $d contain?
>
> Note that the spec says explicitly that a Capture should be returned,
> delaying the context at which the value will be used, this allows
>
>  sub named { return :x<1> }
>  my $x := |(named);
>
> So, this also means that assigning
>
>  my @a = plural();
>  my @c = singular();
>
> forces list context in the capture, which should return all positional
> parameters, as expected. But
>
>  my $b = plural();
>  my $d = singular();
>
> would force item context in the capture, and here is the problem, as a
> capture in item context was supposed to return the invocant.

If item context is supposed to return the invocant, then it would seem
to me that returning a single value from a sub would put that value
into the capture object's invocant.  This would mean that the problem
crops up under 'my @c = singular()' instead of 'my $b = plural()'.

The idea in the spec is that the capture object can hold an item, a
distinct list, and a distinct hash all at once.  The problem that
we're encountering here is that there are times when the difference
between an item and a one-item list is fuzzy.  We _could_ kludge it by
saying that when a sub returns an item $x, it gets returned as a
capture object ($invocant := $x: $param1 := $x) or some such; but this
_is_ a kludge, which has the potential for unexpected and unsightly
developments later on.

Another option would be to change the way that applying item context
to a capture object works in general, to allow for the possibility
that a single-item list was actually intended to be a single item: if
there's no invocant, but there is exactly one positional parameter,
return the positional parameter instead:

  $a = |("title": 1)
  $b = |("title":)
  $c = |(1)

  $x = item $a; # $x == "title"
  $x = item $b; # $x == "title"
  $x = item $c; # $x == 1

  $x = list $a; # $x == [1]
  $x = list $b; # $x == []
  $x = list $c; # $x == [1]

With this approach, return values would return values as positional
parameters unless a conscious effort was made to do otherwise.

But let's say that you really wanted to get the invocant of a capture
object.  You can still do so:

  |($x:) = $a; # $x == "title"
  |($x:) = $b; # $x == "title"
  |($x:) = $c; # $x == undef

Likewise, you could specify that you want the first positional
parameter of the capture object by saying:

  |($x) = $a; # $x == 1
  |($x) = $b; # $x == undef
  |($x) = $c; # $x == 1

This isn't as clean as a straight mapping of invocant to item,
positional to list, and named to hash; but I think that it's got
better dwimmery.

--
Jonathan "Dataweaver" Lang