Categories
Posts in this category
- Current State of Exceptions in Rakudo and Perl 6
- Meet DBIish, a Perl 6 Database Interface
- doc.perl6.org and p6doc
- Exceptions Grant Report for May 2012
- Exceptions Grant Report -- Final update
- Perl 6 Hackathon in Oslo: Be Prepared!
- Localization for Exception Messages
- News in the Rakudo 2012.05 release
- News in the Rakudo 2012.06 release
- Perl 6 Hackathon in Oslo: Report From The First Day
- Perl 6 Hackathon in Oslo: Report From The Second Day
- Quo Vadis Perl?
- Rakudo Hack: Dynamic Export Lists
- SQLite support for DBIish
- Stop The Rewrites!
- Upcoming Perl 6 Hackathon in Oslo, Norway
- A small regex optimization for NQP and Rakudo
- Pattern Matching and Unpacking
- Rakudo's Abstract Syntax Tree
- The REPL trick
- First day at YAPC::Europe 2013 in Kiev
- YAPC Europe 2013 Day 2
- YAPC Europe 2013 Day 3
- A new Perl 6 community server - call for funding
- New Perl 6 community server now live, accepting signups
- A new Perl 6 community server - update
- All Perl 6 modules in a box
- doc.perl6.org: some stats, future directions
- Profiling Perl 6 code on IRC
- Why is it hard to write a compiler for Perl 6?
- Writing docs helps you take the user's perspective
- Perl 6 Advent Calendar 2016 -- Call for Authors
- Perl 6 By Example: Running Rakudo
- Perl 6 By Example: Formatting a Sudoku Puzzle
- Perl 6 By Example: Testing the Say Function
- Perl 6 By Example: Testing the Timestamp Converter
- Perl 6 By Example: Datetime Conversion for the Command Line
- What is Perl 6?
- Perl 6 By Example, Another Perl 6 Book
- Perl 6 By Example: Silent Cron, a Cron Wrapper
- Perl 6 By Example: Testing Silent Cron
- Perl 6 By Example: Stateful Silent Cron
- Perl 6 By Example: Perl 6 Review
- Perl 6 By Example: Parsing INI files
- Perl 6 By Example: Improved INI Parsing with Grammars
- Perl 6 By Example: Generating Good Parse Errors from a Parser
- Perl 6 By Example: A File and Directory Usage Graph
- Perl 6 By Example: Functional Refactorings for Directory Visualization Code
- Perl 6 By Example: A Unicode Search Tool
- What's a Variable, Exactly?
- Perl 6 By Example: Plotting using Matplotlib and Inline::Python
- Perl 6 By Example: Stacked Plots with Matplotlib
- Perl 6 By Example: Idiomatic Use of Inline::Python
- Perl 6 By Example: Now "Perl 6 Fundamentals"
- Perl 6 Books Landscape in June 2017
- Living on the (b)leading edge
- The Loss of Name and Orientation
- Perl 6 Fundamentals Now Available for Purchase
- My Ten Years of Perl 6
- Perl 6 Coding Contest 2019: Seeking Task Makers
- A shiny perl6.org site
- Creating an entry point for newcomers
- An offer for software developers: free IRC logging
- Sprixel, a 6 compiler powered by JavaScript
- Announcing try.rakudo.org, an interactive Perl 6 shell in your browser
- Another perl6.org iteration
- Blackjack and Perl 6
- Why I commit Crud to the Perl 6 Test Suite
- This Week's Contribution to Perl 6 Week 5: Implement Str.trans
- This Week's Contribution to Perl 6
- This Week's Contribution to Perl 6 Week 8: Implement $*ARGFILES for Rakudo
- This Week's Contribution to Perl 6 Week 6: Improve Book markup
- This Week's Contribution to Perl 6 Week 2: Fix up a test
- This Week's Contribution to Perl 6 Week 9: Implement Hash.pick for Rakudo
- This Week's Contribution to Perl 6 Week 11: Improve an error message for Hyper Operators
- This Week's Contribution to Perl 6 - Lottery Intermission
- This Week's Contribution to Perl 6 Week 3: Write supporting code for the MAIN sub
- This Week's Contribution to Perl 6 Week 1: A website for proto
- This Week's Contribution to Perl 6 Week 4: Implement :samecase for .subst
- This Week's Contribution to Perl 6 Week 10: Implement samespace for Rakudo
- This Week's Contribution to Perl 6 Week 7: Implement try.rakudo.org
- What is the "Cool" class in Perl 6?
- Report from the Perl 6 Hackathon in Copenhagen
- Custom operators in Rakudo
- A Perl 6 Date Module
- Defined Behaviour with Undefined Values
- Dissecting the "Starry obfu"
- The case for distributed version control systems
- Perl 6: Failing Softly with Unthrown Exceptions
- Perl 6 Compiler Feature Matrix
- The first Perl 6 module on CPAN
- A Foray into Perl 5 land
- Gabor: Keep going
- First Grant Report: Structured Error Messages
- Second Grant Report: Structured Error Messages
- Third Grant Report: Structured Error Messages
- Fourth Grant Report: Structured Error Messages
- Google Summer of Code Mentor Recap
- How core is core?
- How fast is Rakudo's "nom" branch?
- Building a Huffman Tree With Rakudo
- Immutable Sigils and Context
- Is Perl 6 really Perl?
- Mini-Challenge: Write Your Prisoner's Dilemma Strategy
- List.classify
- Longest Palindrome by Regex
- Perl 6: Lost in Wonderland
- Lots of momentum in the Perl 6 community
- Monetize Perl 6?
- Musings on Rakudo's spectest chart
- My first executable from Perl 6
- My first YAPC - YAPC::EU 2010 in Pisa
- Trying to implement new operators - failed
- Programming Languages Are Not Zero Sum
- Perl 6 notes from February 2011
- Notes from the YAPC::EU 2010 Rakudo hackathon
- Let's build an object
- Perl 6 is optimized for fun
- How to get a parse tree for a Perl 6 Program
- Pascal's Triangle in Perl 6
- Perl 6 in 2009
- Perl 6 in 2010
- Perl 6 in 2011 - A Retrospection
- Perl 6 ticket life cycle
- The Perl Survey and Perl 6
- The Perl 6 Advent Calendar
- Perl 6 Questions on Perlmonks
- Physical modeling with Math::Model and Perl 6
- How to Plot a Segment of a Circle with SVG
- Results from the Prisoner's Dilemma Challenge
- Protected Attributes Make No Sense
- Publicity for Perl 6
- PVC - Perl 6 Vocabulary Coach
- Fixing Rakudo Memory Leaks
- Rakudo architectural overview
- Rakudo Rocks
- Rakudo "star" announced
- My personal "I want a PONIE" wish list for Rakudo Star
- Rakudo's rough edges
- Rats and other pets
- The Real World Strikes Back - or why you shouldn't forbid stuff just because you think it's wrong
- Releasing Rakudo made easy
- Set Phasers to Stun!
- Starry Perl 6 obfu
- Recent Perl 6 Developments August 2008
- The State of Regex Modifiers in Rakudo
- Strings and Buffers
- Subroutines vs. Methods - Differences and Commonalities
- A SVG plotting adventure
- A Syntax Highlighter for Perl 6
- Test Suite Reorganization: How to move tests
- The Happiness of Design Convergence
- Thoughts on masak's Perl 6 Coding Contest
- The Three-Fold Function of the Smart Match Operator
- Perl 6 Tidings from September and October 2008
- Perl 6 Tidings for November 2008
- Perl 6 Tidings from December 2008
- Perl 6 Tidings from January 2009
- Perl 6 Tidings from February 2009
- Perl 6 Tidings from March 2009
- Perl 6 Tidings from April 2009
- Perl 6 Tidings from May 2009
- Perl 6 Tidings from May 2009 (second iteration)
- Perl 6 Tidings from June 2009
- Perl 6 Tidings from August 2009
- Perl 6 Tidings from October 2009
- Timeline for a syntax change in Perl 6
- Visualizing match trees
- Want to write shiny SVG graphics with Perl 6? Port Scruffy!
- We write a Perl 6 book for you
- When we reach 100% we did something wrong
- Where Rakudo Lives Now
- Why Rakudo needs NQP
- Why was the Perl 6 Advent Calendar such a Success?
- What you can write in Perl 6 today
- Why you don't need the Y combinator in Perl 6
- You are good enough!
Sun, 19 Oct 2008
Perl 6 Tidings from September and October 2008
Permanent link
Specification
Perl 6 has got two new operators.
Series, again and again
The series operator
...
(yes, literally three dots) lazily constructs infinite series
of objects. It takes a list on the left and a closure on the right, and calls
the closure to determine the next values. It is best introduced by a few
examples:
my @even = 0, 2, 4 ... { $_ + 2 }; my @fib = 1, 1, 2 ... { $^a + $^b }; my @powers = 1, 2, 4 ... { $_ * 2 };
These examples use a few items on the left for clarity, but it's only necessary to supply as many values as the closure expects.
also
The second new operator is infix:<also>
, which
constructs all
-junctions like &
,
but guarantees order of execution.
Its primary purpose is to allow tests with follow-up tests that might otherwise throw exceptions.
ok('abc' ~~ m/<identifier>/ also $<identifier>.chars == 3);
New regex feature for matching delimited constructs
While trying to generate a syntax tree from his Perl 6 parser STD.pm, Larry noticed one construct that was repeated all over the grammar, and introduced unnecessary submatches. It looks like this:
rule argument_list { '(' <semilist> [ ')' || <panic: "Can't find closing ')'"> ] }
This can now be replaced with this short construct:
rule postcircumfix:sym<( )> { '(' ~ ')' <semilist> }
The ~
meta character is a parser combinator inspired by
Haskell's parsec. It basically sets up a parsing goal (in this
example the closing paren) and then executes the following subrule. If the
goal can't be found, a nice error message is given.
To produce even nicer error messages on parse failures, the new
:dba
(stands for "do business as") adverb can give rules
a human-understandable name (human = not a compiler implementer, but a mere
mortal Perl 6 hacker).
If the example rule above failed to match, it would say Error while
parsing postcircumfix:sym<( )>: can't find closing ')'. Adding a
:dba<argument list>
would replace the unfriendly
postcircumfix blah with... well, you get the picture.
Tests part of the language?
There's also (sic) ongoing
talk about moving the testing
capabilities that are now in Test.pm
into the language
core. A likely scenario is that there will be a :ok
adverb on
comparison operators that has roughly the same semantics the the
ok()
sub, but enables better diagnosis messages in case of
failure.
# Warning: hypothetical syntax ahead 'abc' ~~ m/a(.)b/ :ok<basic regex match works>; 'abc' ~~ String :ok<type check>; 2.rand <= 2 :ok<Int.rand stays in limit>;
To achieve this, all comparison operators would need to get a new multi
that accepts the named (mandatory) argument :ok
. That seems like
a big change, but most (or even all) could be generated automatically, and the
candidate lists for the multis could be pre-computed mostly at compile time,
so no (runtime) performance hit is expected.
Enhance the Match object by token list
Currently the Match object (the thing that's returned from a regex match) gives you no easy access to the sub-matches in the order in which they occured in the string, which means it's quite hard to extract information from it that the writer of the original regex didn't think about making available.
In particular I tried to (ab)use the match tree from STD.pm to write a syntax hilighter, and found it to be a rather daunting task. So I suggested to add such sequential information to the Match object. Larry liked the idea, because he knows what pain the Perl 5 parser causes because it forgets information too quickly (actually it never builds a full parse tree, it generates the optree on the fly. That's efficient, but makes introspection very hard).
However it's not entirely clear if it will be added, and if yes, in which form. Unclear are (a) performance impact, (b) access syntax and (c) symmetry.
(b) and (c) need more explanation: The match object already has list
semantics for accessing positional captures, so you can't make the sequential
chunks available through an array index. The most simple solution is
composition, ie a method< code>$/.splits or $/.tokens
that returns such a list.
But that
breaks a
fundamental symmetry that now exists between match
objects and captures (ie argument lists). Both can have a scalar component
(the object that make
returned/the method invocant), list
components (positional captures/positional arguments) and hash components
(named captures/named arguments). Introducing a way of accessing the
components of a match object in a completely different order breaks that
symmetry. We're not yet entirely clear on what that means for the language.
Implementations
Rakudo
Jerry "particle" Gay implemented the is export
on subroutines,
taking a large leap towards making modules usable in Rakudo. To facilitate
testing of this new feature he also implemented the =:=
infix
operator (tests whether two variables are aliases).
Allison Randal merged a branch which reworked Parrot's multi sub and multi method dispatch system. That broke some complex math in Rakudo, leaving us with "only" about 4380 passing spec tests. Otherwise we might have hit the 4500 mark by now. Still it's good work, and is expected to solve some fundamental problems in the mid or long term.
Elf
Mitchell Charity worked furiously on the new Lisp backend for elf, bringing it (almost?) to bootstrap. That demonstrated the flexibility of elf, and allows to get rid of some quirks that can creep into a compiler if it has only one backend.
It also opens up an opportunity for hackers that want to help with a Perl 6 compiler by writing code in Perl 6. Or Lisp.
STD.pm and viv
STD.pm is the Perl 6 grammar written in Perl 6. It now parses all Perl 6 code that we know of, so it's time to find out if it actually parses it in a useful way, and to check if it loses information while parsing.
Finding that out is one of the goals of viv (Read that as
VI → V and
think of Roman numbers). The other goal is to replace gimme5
,
which currently does the ugly, hacky job of translating STD.pm to Perl 5
code.
It's a script that uses reduce actions at the end of each grammar rulle to build some kind of parse tree or abstract syntax tree, and it's planned to produce either Perl 6 or Perl 5 output. We'll see what the future (and $larry) brings.
Pugs and the test suite
Pugs is still hibernating, and waiting for the release of GHC 6.10.1.
If pugs hibernates, the test suite has a light slumber, and is occasionally disturbed in its peace by a few more tests now and then.
SMOP
Daniel Ruoso and Paweł Murias are both hacking actively on smop. Currently on the agenda is multi dispatch, which is more complicated than it sounds at first. Remember that slurpy argument lists are lazy, which makes things more complicated.
For me it's rather hard to judge how much progress they are making, or how close they are to run basic, real-world code.
Update: Paweł contributed another small explanation:
SMOP now has a new compiler named mildew which uses viv/STD as its parser. Right now it supports only a handful of operations, the most advanced of it is creating an object with a simplified meta model.
It lives in the Pugs repository under v6/mildew/
. Anyone who
wants to hack on it (in Perl 5) is welcome, instructions can be found on
#perl6