[Haskell] ANN: Pugs 6.2.13

Audrey Tang autrijus at gmail.com
Thu Oct 19 02:07:25 EDT 2006

(Cross-posted to haskell@, at the suggestion from Don Stewart)

After nearly four months of development and 3400+ commits, I'm very glad
to announce that Pugs 6.2.13 is now available:

    SIZE: 6839270
    SHA1: b06b8434c64e9bb5e3ab482282fbae0a6ba69218

Motivated by increasing use of Pugs in production, this is an extra release
in the 6.2.x series, offering another 200%+ improvement in performance,
comprehensive support for interoperability with Perl 5 modules, a built-in
grammar engine via native perl5 embedding, and much better support for
roles, classes and objects.

The web-based presence of Pugs and Perl 6 has improved as well:

    * http://run.pugscode.org/ puts the Pugs shell in your browser.
    * http://spec.pugscode.org/ annotates  the Synopses with
"smart-linked" tests.
    * http://smoke.pugscode.org/ annotates that further with
fail/pass/todo records.
    * http://rakudo.org/perl6/ is a Wiki dedicated to collect Perl 6
related information.
    * http://www.programmersheaven.com/2/Perl6-FAQ offers a
comprehensive FAQ on Perl 6.

Thanks again to all lambdacamels on #perl6 for building this new ship together;
it is truly an exhilarating voyage. :-)

Have -Ofun!

(The change log below is also available in HTML format:

= Changes for 6.2.13 (r14401) - October 17, 2006

== Build System

* Perl 5 embedding is now enabled by default
** For Windows users, Perl 5.8.x is required
** Set the `PUGS_EMBED` environment variable to `noperl5` to disable this

* Prompting for Parrot embedding is now disabled by default
** Set the `PUGS_EMBED` environment variable to `parrot` to enable this

* Support for compiling using GHC 6.6
** GHC 6.4.1+ is still supported, but 6.6 will be required in the next release

== Feature Changes

=== Interactive Shell and Command-Line Flags

* New `pugs -d` flag to display a trace for debugging
* The `:r` command now resets the environment once, not twice
* The return value of blocks, such as `gather {...}`, is displayed correctly
* `$_` is no longer clobbered with the result of each expression's evaluation

=== Perl 5 Interoperability

* Arrays and Hashes now round-trip from Pugs to Perl 5 land and back
* Importing functions from Perl 5: `use perl5:CGI <header param>`
* Passing unboxed values across runtimes no longer leaks memory
* When embedding Perl 5.8+, Unicode flag is now on for Pugs-to-Perl5 strings
* `eval($str, :lang<perl5>)` now accepts non-ASCII characters in `$str`

=== Lexical Syntax

* Capture literals: `\($bar: 1, 2, 3, named => 4)`
* Here-docs now work as specced; also warns against inconsistent indentation
* Interpolation of chained calls: `"$foo.meth.meth.meth.meth()"`
* List comprehension: `for 0 < list(@x) < 10 {...}`
* Named character escapes: `"\c[LATIN CAPITAL LETTER Y]"`
* New grammatical category `term:`, separated from the `prefix:` category
* New magical variables: `$?COMPILER` and `$?VERSION`
* Parse for `LABEL: STMT`, although it's currently treated the same as `STMT`
* Pod directives: `=begin`/`=end` and `=for` now terminate without `=cut`
* Pod variables: `$=FOO` and `@=FOO` give you access to the Pod section FOO
* Quote adverbs no longer take non-parens brackets: `rx:P5{...}` is valid again
* Shell-like quoting rules implemented for `<< $x "qq" 'q' >>`
* Signature literals: `:($foo is copy = 42, $, @)`
* Support for UTF-8, UTF-16 and UTF-32 encoded source files
* Support for backquotes and `qx/.../` for capturing external command output
* User-defined infix associativity: `sub infix:<foo> is assoc('right') {...}`
* `"\123"` and `"\03"` are now errors; write `"\d123"` and `"\o03"` instead
* `$::x` now means exactly the same a `$x`, instead of `$*x`
* `%h<>` now means `%h{}` -- the entire hash, not the empty string as key
* `($::('x'))` with two adjacent closing parens now parses correctly
* `0_123_456` now parses as `0d123456`, not an error
* `1<2>` is now a fatal error: Odd number of elements in Hash
* `q()` and `qw()` with parentheses are parsed as functions, not quotes

=== Declarators and Operators

* Argument interpolation via prefix `|` and `|<<`
* Binding to qualified uninitialised symbols: `&fully::qualify := sub {...}`
* Contextual variables are now declared with `my $x is context`, not `env $x`
* Hyperised reduce operators: `[>>+<<]` and `[\>>+<<]`
* Implicit invocation assignment: `.= uc` is parsed as `$_ = $_.uc`
* Mid-block redeclaration no longer allowed: `my $x; { $x = 1; my $x = 2 }`
* Negated comparison operators: `!eqv`, `!=:=` etc; `!~~` replaces `!~`
* New infix comparison operators: `===` and `eqv`
* New infix non-short-circuiting boolean AND operator: `?&`
* Nullary reduction of builtin operators gives identity values: `[*]() === 1`
* Postfix operators can be called with a dot: `.++`, `$x.++`, `$x.\ ++`
* Prefix `=` now iterates on arrays as well: `=@array`
* Short-circuiting chained comparison: `1 > 2 > die('foo')` no longer fails
* Smart matching against code objects: `$obj ~~ { 1 > $_ > 5 }`
* Smart matching against implicit invocation: `$obj ~~ .meth`, `$obj ~~ .[0]`
* Typed constraints on autovivification: `my Hash $x; $x[0] = 1` now fails
* Typed declarations: `my Dog $fido`, `my T ($x, $y)`
* `*` is now always a term, never a prefix operator

=== Blocks and Statements

* Implicit invocation in `when`: `when .true {...}`, `when .<key> {...}`
* Listops in conditions no longer consume the block: `for say {...}`
* Loop topics are not forced into rw: `for 1..3 { $_++ }` now fails correctly
* New `&break` and `&continue` primitives for use within `when` blocks
* New `&leave` primitive for exiting from the innermost block
* New postfix `given` statement modifier: `.say given foo()`
* Support for `FIRST`, `NEXT`, `LAST` loop control blocks
* Support for `START`, `PRE`, `POST`, `KEEP`, `UNDO`, `ENTER`, `LEAVE` blocks
* Support for repeat blocks: `repeat {...} while 1`, `repeat while 1 {...}`
* Support for the `&each` list interleaver: `for each(@a; @b) -> $x, $y {...}`
* The `for` loop no longer double-flattens lists: `for %h.pairs -> $p {...}`
* Topicalisers for `if`, `else`, `while`, `given` blocks: `if EXPR -> $x {...}`
* Topicalisers for postfix `for` loop: `-> $x {...} for 1,2,3`
* `&last` and `&redo` now work in `repeat {...}` and `loop {...}` blocks
* `&take` no longer flattens array literals: `take [1,2,3];`
* `&take` now works in functions called from within a `gather {...}` block
* `BEGIN(...)`, `END(...)`, etc., are now parsed as calls, not syntax errors
* `END {...}` in `.pm` files are no longer ignored when executed directly
* `INIT {...}` now works correctly inside `eval "..."`
* `do {...}` is now a loop block that takes standard loop controls
* `do {...}` with statement modifiers is explicitly disallowed

=== Regexes and Grammars

* Anonymous tokens and rules anchor on both ends: `123 ~~ token{2}` is false
* New `s[...] = EXPR` and `s[...] = .meth` syntax; `s[...][...]` is deprecated
* New `tr///` syntax for transliteration; `y///` will not be supported
* Pugs::Compiler::Rule (PCR) replaces Parrot/PGE as the default engine
* Support for `:c/:continue`, `<prior>`, and much more: see PCR's ChangeLog
* `$()`, `@()` and `%()` parse correctly as `$$/`, `@$/` and `%$/`
* `/.../` matches `$_` under Int, Num and void context in addition to Bool
* `m:g/(1)|(2)/` now returns only successfully matched subcaptures

=== Modules and Routines

* Allow space-separated adverbial named arguments: `f( :x<foo> :$y :!z )`
* Multi-dispatching now handles named, slurpy and optional arguments
* Multi-dispatching now handles parenthesized expressions as arguments
* Named arguments with no matching parameters is now an error
* New `&c.call($capture)` method to call without a caller frame
  (similar to Perl 5's `goto &sub`, but it returns)
* New `&c.signature` method to get a Signature object from a Code object
* Parse for the `proto` routine modifier: `proto method foo ($x) {...}`
* Precompiled `.pm.yml` files with mismatching AST version will no longer load
* Support for user-defined unary and optional-unary prefix macros
* The main package is now ::Main, not ::main
* `&?CALLER_CONTINUATION` is now fully reentrant
* `&yield` in coroutines works correctly within loop blocks
* `sub ($x = 0 is copy)` no longer allowed; say `sub ($x is copy = 0)` instead
* `sub f ($x is lazy) {...}` no longer evaluates $x more than once
* `sub f (@x?) {...}; f()` now sets `@x` to `[]`, not `[undef]`

=== Classes and Objects

* Attribute-like method call syntax: `@.method(1)`, `$.method: 2, 3, 4`
* Class attributes: `class C { my $.x is rw }`
* Class name literals are now term macros, not prefix functions
* Compile-time self-mixin no longer allowed: `role A does A`
* Default initialiser expression for attributes: `class C { has $.x = 123 }`
* Dot attributes are now method calls: `@.x` is the same as `@(self.x)`
* Dynamic method calls: `$obj.$meth`
* Hyperised method calls: `$obj.>>meth`
* Quantified method calls: `$obj.*meth`, `$obj.+meth` and `$obj.?meth`
* Reopening classes: `class C is also {...}`
* Role mixins: `role R {...} class C does R {...}`
* `$?SELF` is gone; write `self` instead
* `BUILDALL`/`DESTROYALL` trigger once per class even with diamond inheritance
* `does R` and `is C` statements in class body now evaluate in compile time

=== Built-in Primitives

* New `&HOW`, `&WHAT` and `&WHICH` functions replace `&meta`, `&ref` and `&id`
* New `&VAR` macro to force lvalue evaluation of an expression
* New `&comb` function, a dual to `&split` but matches the wanted parts
* New `&crypt` function to create one-way digest strings
* New `&fork` function to create a new process
* New `&printf` function for formatted printing
* New `&quotemeta` function for escaping strings
* Support for `%b` in formatted printing
* The `&system` function no longer dies when the command does not exist
* The `.as` method is renamed to `.fmt` for formatted printing
* The `.perl` method now returns Unicode strings

== Bundled Modules

=== New modules

* [ext/Automata-Cellular/] - Build and render cellular automata in a terminal
* [ext/Math-Basic/] - Basic mathematical functions and constants
* [ext/Math-Random-Kiss/] - Pseudo-random number generator
* [ext/re/] - Pragma to choose among grammar engine backends

=== [ext/CGI/]

* A new `as_yaml` method to dump CGI parameters as YAML
* Allow initializing the CGI object with a hash of parameters
* New `Dump` function adapted from Perl 5's CGI.pm
* New basic tests for `escapeHTML` and `unescapeHTML`, which were broken
* New tests for `PATH_INFO`
* Only send the Content-Type: header if we actually have a content-type
* Only send the Status: header if it's a redirect, or if it's explicitly added
* Refactored into an OO-only module.  N.B.: this breaks backwards compatibility!
* Some work on charset handling, though a `charset` method is still missing
* The `content_type` method is renamed to `type` for compatibility
* The `cookies` attribute is renamed to `cookie` for compatibility

=== [ext/HTTP-Server-Simple/]

* The old non-standard `./method` syntax has been replaced with `self.method`

=== [ext/Rosetta/]

* Significant updates to the `lib/Rosetta/SeeAlso.pod` documentation

=== [ext/Set-Relation/]

* Renamed from [ext/Relation/]
* Beginning of separate `Set::Tuple` and `Set::Relation` classes

=== [ext/Test/]

* Converted `Test.pm` documentation from Kwid to Pod syntax
* The `eval_ok` and `eval_is` functions are gone; use `is eval` instead,
  which runs its string in the current lexical scope rather than in
  Test's (which is usually what you want)

== Test Suite

=== [util/prove6]

* Can now run only a portion of the test suite, or even a single file
* Original shell script rewritten in Perl 5 for improved portability
* Support for multiple Pugs backends and multiple Perl 6 implementations

=== [util/smartlinks.pl]

* A new visualiser of smartlinks used in the test suite
* Generates much nicer cross-referenced HTML pages
* See annotated specs in action on [http://spec.pugscode.org/]
* Smartlinks replace the old [util/catalog_tests.pl]

=== [util/smokeserv/]

* See the `SYN` links on [http://smoke.pugscode.org/] for this in action
* Smoke client now uploads raw `.yml` results as well as `.html`
* The smokeserver now annotates the spec with test results using smartlinks

=== [t/]

* All tests now begin with `use v6-alpha;` instead of `use v6;`
* Many, many more smartlinks have been added into the spec
* Programs and modules in [examples/] are tested for syntactic correctness
* Tests in [t_disabled/] are merged back into the main test suite
* [t/02-test-pm/] created to ensure that `Test.pm` works as advertised
* [t/blocks/] renamed from [t/subroutines/]
* [t/closure_traits/] created to test closure traits (`FIRST`, `LAST`, etc.)
* `#!/usr/bin/pugs` is gone from all test files
* `eval_ok` and `eval_is` are now `ok eval` and `is eval`, so that eval'd
  strings will be run in the current lexical scope

== Examples and Utilities

=== [examples/]

* All Perl 5 programs have been renamed from `*.p5` to `*-p5.pl`
* All Perl 6 programs have been renamed from `*.p6` to `*.pl`
* All references to them, except in talks, have been likewise updated

=== [examples/games/dispatch_quiz.pl]

* A game to test your knowledge about Perl 6's multi-dispatch system

=== [misc/runpugs/]

* A web teminal for running an interactive Pugs shell on the web
* WebTerminal: a library for building web terminals for interactive shells
* See [http://run.pugscode.org/] for a live demo

== Documentation

=== [docs/Perl6/Perl5/Differences.pod]

* Significantly updated and linked from [http://spec.pugscode.org/]

=== [docs/Perl6/Spec/]

* A new S16 draft for IO/IPC/signals as [docs/Perl6/Spec/IO.pod]
* A new S26 draft for documentation as [docs/Perl6/Spec/Documentation.pod]
* Revamped S29 draft in [docs/Perl6/Spec/Functions.pod]

=== [docs/Pugs/Doc/]

* New directory for Pugs-specific documentation
* [docs/Pugs/Doc/Hack/Style.pod] - Haskell style guide for Pugs hackers

=== [docs/talks/extraction.xul]

* Slides from Nathan Gray's /Practical Extraction with Perl 6/ talk

== Perl 6 on Perl 5

=== [perl5/Pugs-Compiler-Perl6/]

* The `v6.pm` implementation of Perl 6 now handles `./pugs -CPerl5` commands
* See its own ChangeLog for more information

=== [v6/]

* A new subproject to write a Perl 6 compiler in Perl 6
* Bootstrapped from the `v6.pm` compiler on the perl5 runtime
* See its own ChangeLog for more information

== Experimental projects

=== [misc/pX/Common/P5_to_P6_Translation/]

* Converts Perl 5.9.4+'s YAML syntax tree into Perl 6
* Handles regexes, arrays, hashes and many builtin functions
* See its own documentation for more information

=== [misc/pX/Common/convert_regexp_to_six.pl]

* Converts Perl 5 regex into Perl 6
* See its own documentation for more information

=== [misc/pX/Common/redsix/]

* An Perl 6 implementation on Ruby 1.9+
* See its own documentation for more information

More information about the Haskell mailing list