This Fortnight in Perl 6, March 7 - March 21, 2005
by Matt FowlesMarch 24, 2005
Welcome to yet another fortnight's summary. I believe this is the highest volume I have ever seen the three lists at simultaneously. Hopefully they will keep it up, because they're doing good work. To aid the epic endeavor of summarizing all this, I have had to add some new Jazz to my playlist. We will see how it works out. If it doesn't work well, blame Seton.
Perl 6 Language
The
Actual Name of &?SUB
David Storrs wanted to know how he could find the name of
&?SUB. Larry told him that $?SUBNAME would be the
most reliable way to get the short name.
Unlimited Argument Patterns
Luke Palmer has tasted the forbidden fruit of Haskell, and now he wants more of it in Perl 6. In particular he wants even more powerful pattern matching of arguments for MMD. Rod Adams speculated that Larry had decided Perl 6 would not be ML. In the end there was no real consensus, but the feeling seems to be to say "don't hold your breath".
Limited Argument Patterns
Wolverian was a little unsure of what exactly sub foo(0) {...}
meant. Larry explained that it was just sugar for sub foo ( $bar of Int
where { $_ == 0 } $bar ) { ... }.
List Constructors
Wolverian made a list of list constructors, asking what each did. Larry explained: for the most part, they're the same thing as in Perl 5, though a few will produce a warning.
Decorating Primitives
The question of how decorating objects with roles interacted with low-level types arose. Larry came to the conclusion that it was okay, unless you wanted to decorate a single element in a primitive array.
Splat Operator in Assignment
Juerd was unsure how splats and list assignment interacted. The answer is that list assignment is exactly the same as Perl 5 to allow for extending a return list.
|
Related Reading
Perl 6 and Parrot Essentials |
Logic Programming
Rod Adams pointed out that it's possible to implement much of logic programming using the rules engine. Unfortunately, the syntax gets a little hairy and cumbersome. Larry said that this particular goal might be something that 6.0 does not address, deferring it instead. Ovid rumbled about porting a Warren Abstract Machine to Parrot. I would like it.
Locale-Keyed Text
Darren Duncan finished up the first non-core Perl 6 module. Being properly hubristic, he asked for a critique. His questions touched on subjects including subtypes, module loading, and strictness.
bar
$f =?= $f.bar
Rod Adams wondered what would happen if he had both a sub and a method named
bar. What would $f.bar and bar $f do?
Jonathan Scott Duff explained that $f.bar would call the method
while bar $f would call the sub.
MMD Object
Rod Adams wants a single object to represent all of the possible multi methods associated with a particular short name. It seems that Rod drank some of the Lisp Kool-Aid (although in this case, I agree). He explained how this allowed the dispatch scheme to be changed on a multi by multi basis, and also allowed for nice introspection. This led to a discussion of how this would work with lexically installed multi methods, and if this would trip people up. No real consensus appeared.
:foo<o>
!= :foo('o'); :foo<o> == :foo{'o'}
Juerd wondered what the implications of <a> mapping to
('a') were. Larry replied that it did not map in that manner.
Lazy Loading of Object
Yuval Kogman wondered how he could get his objects to load lazily. Larry told him that delegation would probably be the best bet.
Throwing From Higher Up the Call Stack
Thomas Yandell wants a way to throw from further down the call stack. Sadly, Warnock applied.
sprintf
Juerd wants a sprintf-like function
f/FORMAT/EXPR/. Larry seems to think that
EXPR.as(FORMAT) will suffice, especially if it is a list op.
S29, Built-in Functions
Rod Adams has been hard at work creating a list of built-in Perl 6 functions. This led to good discussions about which things had alternate forms and which did not.
Python
to Eliminate reduce()
Aristotle Pagaltzis posted a link explaining that Python 3000 will eliminate
reduce. This led to a brief discussion of various design
philosophies.
SEND + MORE = JUNCTIONS
Sam Vilain fixed up the SEND + MORE example to work correctly with junctions. Unfortunately, the hoops through which he had to jump are pretty horrendous. Larry mumbled that the option of autothreading all conditionals might work, but would send too many lynch mobs after him. I for one like both Twin Peaks and that idea.
for
With a Function Reference
Rod Adams wanted to know how for would behave with various
types of functions or codeblocks. Luke Palmer provided answers.
Adding Interfaces to Arguments
Thomas Sandlaß wondered when arguments to function would be decorated with roles from the function signature if they didn't exist. Larry conjectured about allowing different views on objects versus mixing in various roles. This led people to talk about covariant typing. An array of ints will always return you a number and an array of numbers will always accept an int, but an array of ints will not necessarily accept a number and an array of numbers will not necessarily return an int. Thus, changing your view can be valid when writing and not when reading, or vice versa.
Pugs too Lazy
Andrew Savige noticed that closing a file handle in Pugs did not force
all the thunks associated with the file. While this was a bug in Pugs, it led
to conversation about whether = should be lazy or eager. Larry
thinks that it will be safer to start eager and become lazy then vice
versa.
exists
and delete as Functions
Rod Adams wondered how he would define the signature of exists
and delete as they do not evaluate the subscripted variables in
their arguments. Larry explained that they are now methods on the hash, so
someone will have to do a little macro magic to get it to work the old way.
remove(reset())
Steve Peters pointed out that reset() was now almost useless
and has been "vaguely deprecated" for a while. Larry declared it dead.
Lists in String Context
Juerd put out a plea for lists in string context not to provide spaces between elements automatically. Larry pointed out various ways to join on the empty string, which I think is his way of saying "too bad".
Popping a Multidimensional Array
Rod Adams wondered what it meant to pop a multidimensional array. Larry agreed that it should pop off entire dimensions. Does this mean that popping such an array in a loop will pop dimensions until there is only one left, at which point it will switch to popping elements?
Index Out of Bounds
Markus Laire wondered what index("Hello", "", 999) would
return. Larry explained that it is not as simple as Markus thinks, because strings
use magic indices that do Unicode stuff, but it would probably throw an
exception.

