Temporal / delta spec

2013-02-19 Thread Carl Franks
Greetings,

S32/Temporal says a DateTime object can be maniplated like so:
$dt.delta(44, minutes);

Rakudo's core/Temporal.pm contains this:

my enum TimeUnit (
:second(1), :seconds(2),
:minute(3), :minutes(4),
[snip]
);

which is used in the signature of both DateTime and Date's delta methods:
method delta($amount, TimeUnit $unit) {
which I think means delta() can't be called outside of the scope of
the Temporal.pm file.

If I try running the synopsis example, I get the following error:
Undeclared routine: minutes used at line 1

The test files
S32-temporal/Date.t and
S32-temporal/DateTime.t
both die on the delta tests.

Should the TimeUnit enumeration be changed to "is export" ?

Rather than export those 14 keys into the global namespace, would it
make more sense for the spec to be something more like this:
$dt.delta( :minute(44) );
using the same argument conventions as DateTime.new() ?

Regards,
Carl


Re: Temporal / delta spec

2013-02-19 Thread Moritz Lenz

Hi Carl,

On 02/19/2013 02:03 PM, Carl Franks wrote:

S32/Temporal says a DateTime object can be maniplated like so:
 $dt.delta(44, minutes);

Rakudo's core/Temporal.pm contains this:

 my enum TimeUnit (
 :second(1), :seconds(2),
 :minute(3), :minutes(4),
 [snip]
 );

which is used in the signature of both DateTime and Date's delta methods:
 method delta($amount, TimeUnit $unit) {
which I think means delta() can't be called outside of the scope of
the Temporal.pm file.


TimeUnit is accessible outside of this file, because it is part of the 
setting, and the setting forms the outer lexical scope for all 
user-space programs.



If I try running the synopsis example, I get the following error:
 Undeclared routine: minutes used at line 1


Works fine here:

mlenz@mlenz-workstation:~/p6/rakudo$ ./perl6 -e 'say 
~DateTime.now.delta(4, hours)'

2013-02-19T18:20:34Z


The test files
S32-temporal/Date.t and
S32-temporal/DateTime.t
both die on the delta tests.


They work fine here. The only explanation that I can find for this 
discrepancy between our systems is that your build of Rakudo might be 
too old.


What version of Rakudo are you using? (try running perl6 --version)


Rather than export those 14 keys into the global namespace, would it
make more sense for the spec to be something more like this:
 $dt.delta( :minute(44) );
using the same argument conventions as DateTime.new() ?


I belive Carl Mäsak is better qualified to answer this question, since 
he changed the specs (there used to be a .truncated-to( :minutes ) or 
so), but here are two interesting points:


1) while every user-facing program does see those constants, they can 
easily redefined in any inner scope, so namespace pollution isn't too 
much of a problem


2) Adding deltas of time onto a given point of time is not commutative. 
For example First adding a month and then a day can be give you a 
different result than first adding a day and then a month. But named 
arguments are unordered by nature, which makes them a poor fit for 
non-commutative operations.


Cheers,
Moritz


Re: Perl 6 / Rakudo unicode code point ranges

2013-02-19 Thread Will Coleda
The code points giving you trouble are 0xFDD0..0xFDEF:

http://stackoverflow.com/questions/5188679/whats-the-purpose-of-the-noncharacters-ufdd0-to-ufdef

You can split this into two ranges to avoid the problematic points (and
could use this to combine the distinct ranges you have above.)

$  perl6 -e 'say ?("\c[0xFDCF]" ~~
/<[\c[0xE000]..\c[0xFDCF]\c[0xFDF0]..\c[0xFFFD]]>/)'
True

Note that if you have invalid UTF-8 input, though, you'll still get the
invalid character error, so you'll need to deal with that before trying to
use the rule.

$  perl6 -e 'say ?("\c[0xFDD0]" ~~
/<[\c[0xE000]..\c[0xFDCF]\c[0xFDF0]..\c[0xFFFD]]>/)'
===SORRY!===
Invalid character for UTF-8 encoding

Hope this helps.



On Mon, Feb 18, 2013 at 11:29 PM, David Warring wrote:

> Hi Guys,
> A quick question.
>
> I'm trying to interpret unicode code-point ranges from the CSS 3 spec -
> http://www.w3.org/TR/css3-syntax/#CHARSETS
>
> The rule in question is
>
> nonascii :== #x80-#xD7FF #xE000-#xFFFD #x1-#x10
>
> Where (I think) these are unicode code-point ranges.
>
> The latest rakudo build is fine with:
>
>
> % perl6 -e perl6 -e '/<[\c[0x80]..\c[0xD7FF]]>/'
>
>
> ...but doesn't like the second (or third) range:
>
>
> % perl6 -e '/<[\c[0xE000]..\c[0xFFFD]]>/'
> ===SORRY!===
> Invalid character for UTF-8 encoding
>
>
> ...the individual code points are ok:
>
>
> % perl6 -e '/<[\c[0xE000]]>/'
> % perl6 -e '/<[\c[0xFFFD]]>/'
>
>
> I'm think I'm getting the above error because not all unicode code-points
> are defined for the range xE000 to xFFFD - see
> http://www.utf8-chartable.de/unicode-utf8-table.pl  .
>
> I'm just having a problem implementing a concise regex/grammar rule for the
> above. Looking for advice.
>
> Cheers,
> David Warring
>



-- 
Will "Coke" Coleda


Parrot 5.1.0 "Zombie Parrot" Released!

2013-02-19 Thread Bruce Gray
Flat on the bunk again, he ran for his life. The Parrot stalked him
through the grey hours of morning, smoothing its fractal feathers,
shuffling itself slowly into clarity as though at the end of a
flashy film-dissolve, until at last his mind's eye had to acknowledge
a shape,
a shape,
a wink
-- From BLIT, a short story by David Langford
http://www.infinityplus.co.uk/stories/blit.htm

On behalf of the Parrot team, I'm proud to announce Parrot 5.1.0, also known
as "Zombie Parrot".  Parrot (http://parrot.org/) is a virtual machine aimed
at running all dynamic languages.

Parrot 5.1.0 is available on Parrot's FTP site
(ftp://ftp.parrot.org/pub/parrot/releases/supported/5.1.0/), or by following the
download instructions at http://parrot.org/download.  For those who would like
to develop on Parrot, or help develop Parrot itself, we recommend using Git to
retrieve the source code to get the latest and best Parrot code.

Parrot 5.1.0 News:
   - Core
   + The .sort() method was added to the FixedFloatArray PMC
   + Improved detection of system memory for machines with >2GB
   + Improved pbc_to_exe support for spacey paths
   + Fixed Parrot_io_readall_s allocating too much string space
   - Build
   + Fixed generated MANIFEST files to omit $destdir
   - Documentation
   - Tests
   + .readall now checks that prior reads are respected.
   - Community
   + Weekly IRC meetings have resumed. #parrotsketch Tuesdays at 1930 UTC

The SHA256 message digests for the downloadable tarballs are:
af26c2fcc806505ec516ebb013bdd37b218633f5fe63faaa6b843ffe55e0135e 
parrot-5.1.0.tar.bz2
2483963c1bec665be772cb40a71fd3d9d2621feca547932475017c81a2f7e49b 
parrot-5.1.0.tar.gz

Many thanks to all our contributors for making this possible, and our sponsors
for supporting this project.  Our next scheduled release is 19 Mar 2013.

Enjoy!

-- 
Bruce Gray (Util of PerlMonks)