Re: Suggested magic for a .. b

2010-07-29 Thread Jon Lang
On Wed, Jul 28, 2010 at 10:35 PM, Brandon S Allbery KF8NH
allb...@ece.cmu.edu wrote:
  On 7/28/10 8:07 PM, Michael Zedeler wrote:
 On 2010-07-29 01:39, Jon Lang wrote:
 Aaron Sherman wrote:
 In smart-match context, a..b includes aardvark.
 No one has yet explained to me why that makes sense. The continued
 use of
 ASCII examples, of course, doesn't help. Does a .. b include
 æther?
 This is where Germans and Swedes, for example, don't agree, but
 they're all
 using the same Latin code blocks.
 This is definitely something for the Unicode crowd to look into.  But
 whatever solution you come up with, please make it compatible with the
 notion that aardvark..apple can be used to match any word in the
 dictionary that comes between those two words.
 The key issue here is whethere there is a well defined and meaningful
 ordering of the characters in question. We keep discussing the nice
 examples, but how about apple .. ส้ม?

 I thought that was already disallowed by spec.

As a range, it ought to work; it's only when you try to generate a
list from it that you run into trouble, as the spec currently assumes
that z.succ eqv aa.

Anyway: whatever default algorithm we go with for resolving cmp, I
strongly recommend that we define the default .succ so that $x lt
$x.succ is always true.

-- 
Jonathan Dataweaver Lang


Re: Suggested magic for a .. b

2010-07-29 Thread Leon Timmermans
On Thu, Jul 29, 2010 at 3:24 AM, Darren Duncan dar...@darrenduncan.net wrote:
 Some possible examples of customization:

  $foo ~~ $a..$b :QuuxNationality  # just affects this one test

I like that

  $bar = 'hello' :QuuxNationality  # applies anywhere the Str value is used


What if you compare a QuuxNationality Str with a FooNationality Str?
That should blow up. Also it can lead to action at a distance. I don't
think that's the way to go.

Leon


Rakudo Star - a useful, usable, early adopter distribution of Perl 6

2010-07-29 Thread Patrick R. Michaud
On behalf of the Rakudo and Perl 6 development teams, I'm happy to
announce the July 2010 release of Rakudo Star, a useful and usable
distribution of Perl 6.  The tarball for the July 2010 release is
available from http://github.com/rakudo/star/downloads.

Rakudo Star is aimed at early adopters of Perl 6.  We know that
it still has some bugs, it is far slower than it ought to be, and
there are some advanced pieces of the Perl 6 language specification
that aren't implemented yet.  But Rakudo Perl 6 in its current form
is also proving to be viable (and fun) for developing applications
and exploring a great new language.  These Star releases are
intended to make Perl 6 more widely available to programmers, grow
the Perl 6 codebase, and gain additional end-user feedback about the
Perl 6 language and Rakudo's implementation of it.

In the Perl 6 world, we make a distinction between the language 
(Perl 6) and specific implementations of the language such as
Rakudo Perl.  Rakudo Star is a distribution that includes
release #31 of the Rakudo Perl 6 compiler [1], version 2.6.0 of
the Parrot Virtual Machine [2], and various modules, documentation,
and other resources collected from the Perl 6 community.  We
plan to make Rakudo Star releases on a monthly schedule, with
occasional special releases in response to important bugfixes or
changes.

Some of the many cool Perl 6 features that are available in this
release of Rakudo Star:
  * Perl 6 grammars and regexes
  * formal parameter lists and signatures
  * metaoperators
  * gradual typing
  * a powerful object model, including roles and classes
  * lazy list evaluation
  * multiple dispatch
  * smart matching
  * junctions and autothreading
  * operator overloading (limited forms for now)
  * introspection
  * currying
  * a rich library of builtin operators, functions, and types
  * an interactive read-evaluation-print loop
  * Unicode at the codepoint level
  * resumable exceptions

There are some key features of Perl 6 that Rakudo Star does not
yet handle appropriately, although they will appear in upcoming
releases.  Thus, we do not consider Rakudo Star to be a
Perl 6.0.0 or 1.0 release.  Some of the not-quite-there
features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex [...] character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

In many places we've tried to make Rakudo smart enough to inform the
programmer that a given feature isn't implemented, but there are
many that we've missed.  Bug reports about missing and broken
features are welcomed.

See http://perl6.org/ for links to much more information about 
Perl 6, including documentation, example code, tutorials, reference
materials, specification documents, and other supporting resources.

Rakudo Star also bundles a number of modules; a partial list of
the modules provided by this release include:
  * Blizkost
  - enables some Perl 5 modules to be used from within Rakudo Perl 6
  * MiniDBI
  - a simple database interface for Rakudo Perl 6
  * Zavolaj
  - call C library functions from Rakudo Perl 6
  * SVG and SVG::Plot
  - create scalable vector graphics
  * HTTP::Daemon
  - a simple HTTP server
  * XML::Writer
  - generate XML
  * YAML
  - dump Perl 6 objects as YAML
  * Term::ANSIColor
  - color screen output using ANSI escape sequences
  * Test::Mock
  - create mock objects and check what methods were called
  * Math::Model
  - describe and run mathematical models
  * Config::INI
  - parse and write configuration files
  * File::Find
  - find files in a given directory
  * LWP::Simple
  - fetch resources from the web

These are not considered core Perl 6 modules, and as module
development for Perl 6 continues to mature, future releases
of Rakudo Star will likely come bundled with a different set
of modules. Deprecation policies for bundled modules will be
created over time, and other Perl 6 distributions may choose
different sets of modules or policies.  More information about
Perl 6 modules can be found at http://modules.perl6.org/.

Rakudo Star also contains a draft of a Perl 6 book -- see 
docs/UsingPerl6-draft.pdf in the release tarball.

The development team thanks all of the contributors and sponsors
for making Rakudo Star possible.  If you would like to contribute,
see http://rakudo.org/how-to-help, ask on the perl6-compi...@perl.org
mailing list, or join us on IRC #perl6 on freenode.

Rakudo Star releases are created on a monthly cycle or as needed
in response to important bug fixes or improvements.  The next planned 
release of Rakudo Star will be on August 24, 2010.

[1] 

Re: Rakudo Star - a useful, usable, early adopter distribution of Perl 6

2010-07-29 Thread Xiao Yafeng
Congratulations!

On Thu, Jul 29, 2010 at 8:23 PM, Patrick R. Michaud pmich...@pobox.com wrote:
 On behalf of the Rakudo and Perl 6 development teams, I'm happy to
 announce the July 2010 release of Rakudo Star, a useful and usable
 distribution of Perl 6.  The tarball for the July 2010 release is
 available from http://github.com/rakudo/star/downloads.

 Rakudo Star is aimed at early adopters of Perl 6.  We know that
 it still has some bugs, it is far slower than it ought to be, and
 there are some advanced pieces of the Perl 6 language specification
 that aren't implemented yet.  But Rakudo Perl 6 in its current form
 is also proving to be viable (and fun) for developing applications
 and exploring a great new language.  These Star releases are
 intended to make Perl 6 more widely available to programmers, grow
 the Perl 6 codebase, and gain additional end-user feedback about the
 Perl 6 language and Rakudo's implementation of it.

 In the Perl 6 world, we make a distinction between the language
 (Perl 6) and specific implementations of the language such as
 Rakudo Perl.  Rakudo Star is a distribution that includes
 release #31 of the Rakudo Perl 6 compiler [1], version 2.6.0 of
 the Parrot Virtual Machine [2], and various modules, documentation,
 and other resources collected from the Perl 6 community.  We
 plan to make Rakudo Star releases on a monthly schedule, with
 occasional special releases in response to important bugfixes or
 changes.

 Some of the many cool Perl 6 features that are available in this
 release of Rakudo Star:
  * Perl 6 grammars and regexes
  * formal parameter lists and signatures
  * metaoperators
  * gradual typing
  * a powerful object model, including roles and classes
  * lazy list evaluation
  * multiple dispatch
  * smart matching
  * junctions and autothreading
  * operator overloading (limited forms for now)
  * introspection
  * currying
  * a rich library of builtin operators, functions, and types
  * an interactive read-evaluation-print loop
  * Unicode at the codepoint level
  * resumable exceptions

 There are some key features of Perl 6 that Rakudo Star does not
 yet handle appropriately, although they will appear in upcoming
 releases.  Thus, we do not consider Rakudo Star to be a
 Perl 6.0.0 or 1.0 release.  Some of the not-quite-there
 features include:
  * nested package definitions
  * binary objects, native types, pack and unpack
  * typed arrays
  * macros
  * state variables
  * threads and concurrency
  * Unicode strings at levels other than codepoints
  * pre and post constraints, and some other phasers
  * interactive readline that understands Unicode
  * backslash escapes in regex [...] character classes
  * non-blocking I/O
  * most of Synopsis 9
  * perl6doc or pod manipulation tools

 In many places we've tried to make Rakudo smart enough to inform the
 programmer that a given feature isn't implemented, but there are
 many that we've missed.  Bug reports about missing and broken
 features are welcomed.

 See http://perl6.org/ for links to much more information about
 Perl 6, including documentation, example code, tutorials, reference
 materials, specification documents, and other supporting resources.

 Rakudo Star also bundles a number of modules; a partial list of
 the modules provided by this release include:
  * Blizkost
      - enables some Perl 5 modules to be used from within Rakudo Perl 6
  * MiniDBI
      - a simple database interface for Rakudo Perl 6
  * Zavolaj
      - call C library functions from Rakudo Perl 6
  * SVG and SVG::Plot
      - create scalable vector graphics
  * HTTP::Daemon
      - a simple HTTP server
  * XML::Writer
      - generate XML
  * YAML
      - dump Perl 6 objects as YAML
  * Term::ANSIColor
      - color screen output using ANSI escape sequences
  * Test::Mock
      - create mock objects and check what methods were called
  * Math::Model
      - describe and run mathematical models
  * Config::INI
      - parse and write configuration files
  * File::Find
      - find files in a given directory
  * LWP::Simple
      - fetch resources from the web

 These are not considered core Perl 6 modules, and as module
 development for Perl 6 continues to mature, future releases
 of Rakudo Star will likely come bundled with a different set
 of modules. Deprecation policies for bundled modules will be
 created over time, and other Perl 6 distributions may choose
 different sets of modules or policies.  More information about
 Perl 6 modules can be found at http://modules.perl6.org/.

 Rakudo Star also contains a draft of a Perl 6 book -- see
 docs/UsingPerl6-draft.pdf in the release tarball.

 The development team thanks all of the contributors and sponsors
 for making Rakudo Star possible.  If you would like to contribute,
 see http://rakudo.org/how-to-help, ask on the perl6-compi...@perl.org
 mailing list, or join us on IRC #perl6 on freenode.

 Rakudo Star releases are created on a monthly cycle or as needed
 in 

Re: Suggested magic for a .. b

2010-07-29 Thread yary
On Thu, Jul 29, 2010 at 5:15 AM, Leon Timmermans faw...@gmail.com wrote:
 On Thu, Jul 29, 2010 at 3:24 AM, Darren Duncan dar...@darrenduncan.net 
 wrote:
 Some possible examples of customization:

  $foo ~~ $a..$b :QuuxNationality  # just affects this one test

 I like that

  $bar = 'hello' :QuuxNationality  # applies anywhere the Str value is used


 What if you compare a QuuxNationality Str with a FooNationality Str?
 That should blow up. Also it can lead to action at a distance. I don't
 think that's the way to go.

I think it's an elegant use of encapsulation- keeping a string's
locale with the string. If the you want to compare two strings with
different collations, either-
 $foo ~~ $a..$b :QuuxNationality  # override the locales for this test
or
  $foo ~~ $a..$b # Perl warns about conflict, and falls back to its default

-y


Re: Rakudo Star - a useful, usable, early adopter distribution of Perl 6

2010-07-29 Thread Gabor Szabo
Congratulations and thank you!



I have started to collect the links to the press coverage of the release:

http://www.perlfoundation.org/perl6/index.cgi?rakudo_star_press

Please help me collect all the important links!

Gabor


Re: Suggested magic for a .. b

2010-07-29 Thread Aaron Sherman
On Wed, Jul 28, 2010 at 9:24 PM, Darren Duncan dar...@darrenduncan.netwrote:

 Jon Lang wrote:

 I don't know enough about Unicode to suggest how to solve this.


Thankfully, I know little enough to take up the challenge ;-)


  All I can
 say is that my example above should never return a valid Range object
 unless
 there is a way I can specify my own ordering and I use it.


Please see my suggested approach way, way back at the start of all this. Use
Unicode scripts, properties and codepoint sequences to produce a list of
codepoints. Want something more meaningful than codepoints? Great, use an
object that knows what you're asking for:

   EnglishDictword(apple) .. EnglishDictWord(orange)

It's a very Perl way to approach a problem: provide the solution that meets
the least common denominator need (return a range object that represents
ranges based on the information we have) and then allow that same feature to
be used in cases where the user has provided sufficient context to do
something smarter.

I don't think it makes sense to extend the length of strings under
consideration by default. Obviously the above example would include
blackberry because you've asked it to consider English dictionary words,
but aa .. zz shouldn't contain blackberry because you don't have
enough data to understand what's being asked for, and thus should fall back
to treating strings as lists of codepoints (speaking of which do we define a
behavior for (1,2,3) .. (4,5,6)? Right now, we consider (1,2,7) to be in
that range, and I don't think that's a terribly useful result).




 That actually says something: it says that we may want to reconsider
 the notion that all string values can be sorted.  You're suggesting
 the possibility that a cmp ส้ is, by default, undefined.



By default, I think it should by +1 because of the codepoint comparison. If
you then tell Perl that you want that comparison done in a Thai context,
then it's probably -1.

The golden rule of Unicode is: never pretend you have more information than
you do.




 I think that a general solution here is to accept that there may be more
 than one valid way to sort some types, strings especially, and so
 operators/routines that do sorting should be customizable in some way so
 users can pick the behaviour they want.


And I think that this brings you back to what I was saying at the top of the
thread which is that the most basic approach treats each codepoint as a
collection of information and sorts on that information first and then the
codepoint number itself. If that's not useful to you, tell Perl what you
really wanted.



 Some possible examples of customization:

  $foo ~~ $a..$b :QuuxNationality  # just affects this one test

  $bar = 'hello' :QuuxNationality  # applies anywhere the Str value is used


That's a bit too easy to read without thinking about the implications. I
bring back my original example from long ago:

TOPIXコンポジット1500構成銘柄 which I shamelessly grabbed from a Tokyo Stock
Exchange page. That one string, used in everyday text, contains Latin
letters, Hiragana [I lied, there's no Hiragana], Katakana, Han or Kanji
idiograms and Latin digits.


Now call .succ on that sucker, I dare you, keeping in mind that there's no
one Japanese script in Unicode. I think the only valid starting point
without any contextual information is to essentially treat it as a sequence
of codepoints (as if it were an array of integers) and do something
marginally sane on that basis. Then you let the user provide you with hints.
Yes, it's Japanese language but that doesn't tell you as much as you'd
hope, since many of the rules come from the languages that Japanese is
borrowing from, here.

One answer is to break it down on script and major category property
boundaries into TOPIX (Latin: the name of an index), コンポジット (Katakana:
phonetically this is konpozito or composite), 1500 (Latin digits), and
構成銘柄 (Kanji ideographs: constituents). Now, treat each one of those as a
separate sequence of codepoints and begin incrementing each sub-sequence in
turn. You could also apply Japanese sorting rules to the successor method,
but then you get into questions of what the Japanese sorting method is for
Latin letters... probably a solved problem, but obscure enough that I'll bet
there are edge cases that are NOT solvable just by knowing that the locale
because they are finer grained (e.g. which Latin-using language does the
word come from? What source language is most appropriate for the context?
etc.)

Maybe you throw an exception when you try to tell Perl that 
TOPIXコンポジット1500構成銘柄 is a Japanese string... but then Perl is rejecting
strings that are considered valid in some contexts within that language.

My only strongly held belief, here, is that you should not try to answer any
of these questions for the default range operator on
unadorned, context-less strings. For that case, you must do something that
makes sense for all Unicode codepoints in nearly all contexts.

-- 
Aaron 

Array membership test?

2010-07-29 Thread Mark J. Reed
Possibly a FAQ, but is there a simple way of asking if an item is
contained in an array?  I know of $x ~~ any(@array) and @array.grep({
$_ ~~ $x}), but those both seem a bit complicated for a conceptually
simple test, so I'm wondering if I'm missing something.  In other
langs there's a keyword [item in array] or specific method
[array.include? item] or function [in_array($item, $array)]...

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


Re: Array membership test?

2010-07-29 Thread Jonathan Worthington

Mark J. Reed wrote:

Possibly a FAQ, but is there a simple way of asking if an item is
contained in an array?  I know of $x ~~ any(@array) and @array.grep({
$_ ~~ $x}), but those both seem a bit complicated for a conceptually
simple test, so I'm wondering if I'm missing something.
Note that grep doesn't have to take a closure, but can also take just 
the value you're looking for...


 my @x = 1,2,3; say ?...@x.grep(2); say ?...@x.grep(4);
1
0

Though more efficient would be:

 my @x = 1,2,3; say ?...@x.first(2); say ?...@x.first(4);
1
0

I still prefer the junction way though. :-)

/jnthn



Re: Array membership test?

2010-07-29 Thread yary
On Thu, Jul 29, 2010 at 4:46 PM, Mark J. Reed markjr...@gmail.com wrote:
 $x ~~ any(@array)

I think this came up recently, and that's the way!

-y


Re: Array membership test?

2010-07-29 Thread Mark J. Reed
On Thu, Jul 29, 2010 at 7:52 PM, Jonathan Worthington
jonat...@jnthn.net wrote:
 Note that grep doesn't have to take a closure, but can also take just the
 value you're looking for...

 my @x = 1,2,3; say ?...@x.grep(2); say ?...@x.grep(4);
 1
 0

Hm.  could have sworn I'd tried that and it didn't work.

 Though more efficient would be:

 my @x = 1,2,3; say ?...@x.first(2); say ?...@x.first(4);
 1
 0

Ah, perfect.  Thanks!

 I still prefer the junction way though. :-)

I love junctions, but it feels like overkill to use them for this. :)

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


Re: Array membership test?

2010-07-29 Thread Patrick R. Michaud
On Fri, Jul 30, 2010 at 01:52:18AM +0200, Jonathan Worthington wrote:
 Mark J. Reed wrote:
 Possibly a FAQ, but is there a simple way of asking if an item is
 contained in an array?  
 
  my @x = 1,2,3; say ?...@x.grep(2); say ?...@x.grep(4);
 1
 0
 
 Though more efficient would be:
 
  my @x = 1,2,3; say ?...@x.first(2); say ?...@x.first(4);
 1
 0

If .grep and List.Bool are implemented the way I think they should
be (and the way they are in Rakudo), then both of the above are 
equally efficient.  :-)

Pm


Re: Rakudo Star - a useful, usable, early adopter distribution of Perl 6

2010-07-29 Thread Kiffin Gish
Good stuff, let's celebrate!

On Thu, 2010-07-29 at 07:23 -0500, Patrick R. Michaud wrote:
 On behalf of the Rakudo and Perl 6 development teams, I'm happy to
 announce the July 2010 release of Rakudo Star, a useful and usable
 distribution of Perl 6.  The tarball for the July 2010 release is
 available from http://github.com/rakudo/star/downloads.
 
 Rakudo Star is aimed at early adopters of Perl 6.  We know that
 it still has some bugs, it is far slower than it ought to be, and
 there are some advanced pieces of the Perl 6 language specification
 that aren't implemented yet.  But Rakudo Perl 6 in its current form
 is also proving to be viable (and fun) for developing applications
 and exploring a great new language.  These Star releases are
 intended to make Perl 6 more widely available to programmers, grow
 the Perl 6 codebase, and gain additional end-user feedback about the
 Perl 6 language and Rakudo's implementation of it.
 
 In the Perl 6 world, we make a distinction between the language 
 (Perl 6) and specific implementations of the language such as
 Rakudo Perl.  Rakudo Star is a distribution that includes
 release #31 of the Rakudo Perl 6 compiler [1], version 2.6.0 of
 the Parrot Virtual Machine [2], and various modules, documentation,
 and other resources collected from the Perl 6 community.  We
 plan to make Rakudo Star releases on a monthly schedule, with
 occasional special releases in response to important bugfixes or
 changes.
 
 Some of the many cool Perl 6 features that are available in this
 release of Rakudo Star:
   * Perl 6 grammars and regexes
   * formal parameter lists and signatures
   * metaoperators
   * gradual typing
   * a powerful object model, including roles and classes
   * lazy list evaluation
   * multiple dispatch
   * smart matching
   * junctions and autothreading
   * operator overloading (limited forms for now)
   * introspection
   * currying
   * a rich library of builtin operators, functions, and types
   * an interactive read-evaluation-print loop
   * Unicode at the codepoint level
   * resumable exceptions
 
 There are some key features of Perl 6 that Rakudo Star does not
 yet handle appropriately, although they will appear in upcoming
 releases.  Thus, we do not consider Rakudo Star to be a
 Perl 6.0.0 or 1.0 release.  Some of the not-quite-there
 features include:
   * nested package definitions
   * binary objects, native types, pack and unpack
   * typed arrays
   * macros
   * state variables
   * threads and concurrency
   * Unicode strings at levels other than codepoints
   * pre and post constraints, and some other phasers
   * interactive readline that understands Unicode
   * backslash escapes in regex [...] character classes
   * non-blocking I/O
   * most of Synopsis 9
   * perl6doc or pod manipulation tools
 
 In many places we've tried to make Rakudo smart enough to inform the
 programmer that a given feature isn't implemented, but there are
 many that we've missed.  Bug reports about missing and broken
 features are welcomed.
 
 See http://perl6.org/ for links to much more information about 
 Perl 6, including documentation, example code, tutorials, reference
 materials, specification documents, and other supporting resources.
 
 Rakudo Star also bundles a number of modules; a partial list of
 the modules provided by this release include:
   * Blizkost
   - enables some Perl 5 modules to be used from within Rakudo Perl 6
   * MiniDBI
   - a simple database interface for Rakudo Perl 6
   * Zavolaj
   - call C library functions from Rakudo Perl 6
   * SVG and SVG::Plot
   - create scalable vector graphics
   * HTTP::Daemon
   - a simple HTTP server
   * XML::Writer
   - generate XML
   * YAML
   - dump Perl 6 objects as YAML
   * Term::ANSIColor
   - color screen output using ANSI escape sequences
   * Test::Mock
   - create mock objects and check what methods were called
   * Math::Model
   - describe and run mathematical models
   * Config::INI
   - parse and write configuration files
   * File::Find
   - find files in a given directory
   * LWP::Simple
   - fetch resources from the web
 
 These are not considered core Perl 6 modules, and as module
 development for Perl 6 continues to mature, future releases
 of Rakudo Star will likely come bundled with a different set
 of modules. Deprecation policies for bundled modules will be
 created over time, and other Perl 6 distributions may choose
 different sets of modules or policies.  More information about
 Perl 6 modules can be found at http://modules.perl6.org/.
 
 Rakudo Star also contains a draft of a Perl 6 book -- see 
 docs/UsingPerl6-draft.pdf in the release tarball.
 
 The development team thanks all of the contributors and sponsors
 for making Rakudo Star possible.  If you would like to contribute,
 see http://rakudo.org/how-to-help, ask on the perl6-compi...@perl.org
 mailing list, or join us on IRC #perl6 on freenode.
 
 Rakudo Star 

Re: Rakudo Star - a useful, usable, early adopter distribution of Perl 6

2010-07-29 Thread Jerome Quelin
On 10/07/29 07:23 -0500, Patrick R. Michaud wrote:
 On behalf of the Rakudo and Perl 6 development teams, I'm happy to
 announce the July 2010 release of Rakudo Star, a useful and usable
 distribution of Perl 6.  The tarball for the July 2010 release is
 available from http://github.com/rakudo/star/downloads.

congratulations, but help me help you guys.

i'm currently shipping parrot and rakudo in mandriva. what should i do
regarding rakudo-star:
  - juste update rakudo to rakudo-star
  - create a new package rakudo-star, alongside rakudo

if the former, will future monthly rakudo releases feature everything
that rakudo* is shipping? (modules, etc.)
if the latter, can rakudo-star use rakudo as its perl6 interpreter, and
only installs addons?

thanks,
jérôme 
-- 
jque...@gmail.com