This week on Perl 6 (11/17-11/23, 2002)

And some rough beast, its hour come ‘round at last slouches toward…

And then the scansion goes to pot and I can’t make a joke fit. Shame.

Anyhoo, it’s time for another episode of the continuing saga of Perl 6 development. When I say ‘saga’ I don’t mean a long, long poem of alliterative lines, but a bright, breezy and brisk tale of the bods in the lists. Well, one week mayb, when we’ve been quiet…

We start, as usual with the internals list.

C#/Parrot Status

Rhys Weatherley, who has been absent from the internals list lo these many days popped up again to ask about:

  • Object/class support
  • Fixed-size integers and/or conversion opcodes
  • Embedding of binary extension sections

He noted that “Not Done Yet” was an acceptable answer. Which is good, because, as Leopold Tötsch pointed out, none of them were done yet. Leo also reckoned that a start would be to implement fixed size integers and conversion ops, and asked for details of what was wanted. Iacob Alin wondered if the various types would be PMCs (answer: Only those types which don’t easily map to native types.) Florian Weimer wondered about trapping integer arithmetic. Dan says these will be handled using Parrots standard exception handling mechanism (which doesn’t actually exist yet, but signs in the wind suggest we might be getting a Halt and Catch Fire op to raise an exception).

http://groups.google.com/groups

Parrot 0.0.9 status

According to Steve Fink: “The basic status is that lots of people, many of them coincidentally named Leopold Tötsch, have been fixing zillions of things and implementing a number of new features. Nearly everything needed for 0.0.9 has happened, and a lot else besides.”

See his post for details of what’s still to be done.

One of the most important items was that the tinderbox (a fleet of machines that constantly make, test and remake the latest parrot builds) was a beautiful shade of orange and red, which led to discussion of what was going on (since most people’s home boxen seem to be making and testing okay…) Various remedies and patches were tried, but I believe the tinderbox is still mostly the wrong colour.

http://groups.google.com/groups

http://groups.google.com/groups

Unified core.jit

Leopold Tötsch posted an RFC in which he proposed writing a universal core.jit which provides the basic JIT framework and which delegates the generation of native ops to processor specific implementations. Daniel Grunblatt liked the basic idea, but thought there might be a case for creating cisc.jit and risc.jit to avoid piles of #ifdefs. Daniel, Leo and Nicholas Clark then spent a few posts thrashing out issues to do with parameter naming and other more or less arcane things.

http://groups.google.com/groups

Native Function calls

Dan announced that he’d redone the native function call interface and had added a new op, bnc, which stands for `build native call’. His post has the details of how it all works (and how to use it). Well, that’s what he said at first, but apparently it’s not true. What he’s actually done is altered the dlfunc opcode to behave like bnc he described. (It’s a shame you can’t hit s/bnc/dlfunc/ in your mailer and have the world alter every single copy of the mail you just sent. It would have been useful for some of my previous summaries.)

Brent Dax wondered if this was going to be the new XS or if there was more coming. Answer: Sort of.

Leo Tötsch didn’t like nci.c’s string functions, and wondered too about places where you’d need to pass a pointer to the parrot interpreter. Dan doesn’t like the string functions either, noting that the code is “evil, crufty [and] embarrassing”, but that it is at least “well encapsulated, so it can be ripped out, shot, and replaced with something elegant and fast at some point in the future.” As for parrot interpreter pointers, Dan reckons that any code that needs to go so far should install real extension sub PMCs.

Gopal V worried about the type safety (it’s an obsession of his apparently) or rather the complete lack of it, in this interface. Dan, in a quote of the week post said yup, of course it’s totally type unsafe and he liked it that way, before confessing that he was getting that `XML feeling. (You know the one–“It seemed like a good idea until I thought about it”)’ and started backpedalling. Gopal V made a few suggestions, and that’s about where we left it.

http://groups.google.com/groups

http://groups.google.com/groups – the correction

Leopold Tötsch, still the patch monster

Leo’s contributions this week include:

  • Patches to the JIT which give a 370% speedup in mops_p.pasm
  • Patched strings to try and fix a GC issue.
  • More patches to the JIT to tidy things up

    This patch set also added i386 support for JITted floating point, which apparently makes mandel.pasm at least 10 times faster.

And that’s not counting his contributions in other threads. Once again, I wonder where he finds the time.

Other patches this week from other keyboards that Leo’s:

  • Op restarts

    Jason Gloudon’s patch adds a new control flow flag to op.h to mark which ops can cause interpreter restarts. This information can apparently be used to improved performance in JITted code by removing the need for unnecessary checks.

  • Function <=> Data Pointer casts in nci.h

    Josh Wilmes’s patch to try and correct warnings on some compilers (and ‘outright breakage on tcc’). Steve Fink seemed to like it, and produced an updated version and Dan suggested that they don’t worry about it too much right now as he was in the process of redoing nci.c anyway.

  • Befunge now supports PerlArray’s push/pop Jerome Quelin is one of the “let’s implement a bunch of languages on Parrot” crew, and his pet language is Befunge. If you don’t know about Befunge, you’re lucky, but if you don’t want to stay lucky, Google will probably be depressingly informative. Anyhow, Jerome has now rewritten his Befunge interpreter to use PerlArray’s push and pop rather than his older, hand crafted Parrot assembler routines. Dan committed the patch `with the appropriate amount of fear’.

  • The return of Leon Brocard

    As regular listeners will know, I try to mention Leon Brocard at least once a week. This has been tricky of late because Leon had been on holiday. And when he returned he didn’t actually say that much.

    This week, he rectified that and offered a couple of patches, and a minor dilemma. The first simply improves a set of error messages, making it easier to track a couple or three problems down. However, his second patch is a little trickier.

    The thing is, Leon has implemented another programming language for Parrot. He’d posted it to the list some time ago (before my time as a summarizer I think), but it’d got out of sync with the state of the avian, so this time he offered it as a patch with its own subdirectory of languages. “So? What’s the problem?” I hear you ask. The problem is the name of this language, which some people may find offensive. In a postscript to the patch, Leon suggests that a bit of creative misspelling may be in order, so I’ll go that route:

    Last week, Leon Brocard posted a patch implementing a brianfuck interpreter.

    There, that was easy wasn’t it?

Coo, what a remarkably long section with no associated links.

Meanwhile, on perl6-language

The `Unifying invocant and topic naming syntax’ thread rumbled on. Adam Lopresto wondered what was wrong with sub bar(;$foo is given) {...}. Damian wasn’t sure and reiterated his suggestion of sub foo (;$foo = $def_foo) is given($def_foo) {...}, but Larry really didn’t like that (and he’s not alone – Ed.) Larry spun off a few other suggestions, one of which Damian shot down quite handily, and one of which, after couple of modifications, he quite liked. Brent Dax wondered what was wrong with just using $CALLER::_ and having done with it, which led to some muttering that the CALLER should really be a namespace of last resort for people doing bad and/or clever things and that using it just to import the caller’s topic seemed like overkill. And on it went for a total of 47 posts this week. Highlights include: Damian’s discussion of why it makes sense to pass the topic into a function without it appearing on the argument list illustrated with an example from Class::Contract; Andy Wardley’s almost universally disliked suggestion of using $__, $___, … to access callers’ topics up the call chain; Allison Randal’s handy restating of the details of what was being discussed; Andy Wardley also brought up the Law of Demeter and got ignored for his pains.

I have the feeling we haven’t seen the last of this yet, things still aren’t quite resolved.

http://groups.google.com/groups

http://groups.google.com/groups

http://groups.google.com/groups

http://groups.google.com/groups – Allison’s summary

http://groups.google.com/groups – Law of Demeter

The string concatenation operator

The mammoth operator thread continues on it’s merry way with a slightly morphed subject (It’s now called the `string concatenation operator’ thread, but it can’t fool me). I think it might be slowing down though; there were only 31 posts in the thread this week.

Anyhow, Martin D Kealey opened proceedings for the week, talking about parallel processing. (And people wonder why I find this thread hard to summarize – the subject line is almost always inaccurate, and it always seems to be going off on tangents), and the benefits of functional and applicative programming languages when compilers need to notice possible parallelism. Simon Cozens talked about typing of values (not variables), and reckoned that with reasonably strongly typed values there seemed to be no reason why + shouldn’t be used for string concatenation. However, Larry reckons that not using + to concatenate strings was one of the things he got right in Perl 1. He also had some interesting things to say about the Principle of Least Astonishment.

Dan talked about threading (remember, this thread is about the string concatenation operator), which led into a discussion of the various ways of handling threading. Matt Diephouse wondered how to pass a junction to a function. It turns out to be easy; sub foo ($param is junction) {...}. But not that easy. The subthread that ensued ended up talking about what happens when some members in junction cause exceptions to be thrown when others don’t, and I’m still not sure what’s going on.

I don’t suppose someone would like to write an article on junctions along the same lines as Allison’s ‘Topics’ article? Or is it still way too early to do that?

http://groups.google.com/groups

http://groups.google.com/groups

http://groups.google.com/groups

Continuations

The misnamed coroutines thread continued, discussing the use of coroutines as iterators in while and for loops, which then morphed into a discussion of <<. You see, <<...>> is the ASCII synonym for «...», which is, in turn a (the?) new way of saying qw/.../ (and for vectorizing an op). Ken Fox worried that using << in this way would mean you couldn’t use it for introducing a HERE doc, but Damian assured him that it wasn’t a problem because " (and presumably ') would be illegal as the very first character of a <<...>> delimited list. This worried Paul Johnson slightly who paged Simon Cozens (Champion of Regularity! Smiter of the Unexpected!) who didn’t show up.

Austin Hastings asked if we couldn’t rename coroutine next to be bork (standing for “Break OR Kontinue” or “Brain On Raw Krack”, you decide) just so he could write

   my $cheffy = $recipe.iterator;
   $cheffy.bork.bork.bork;

Damian appeared to take him seriously (well, not about the bork thing, but the post wasn’t just about the silliness).

All of which eventually led to Damian’s rather sensible proposal on the semantics of <...>, which is well worth a read. The rest of the thread was spent with people asking for a few clarifications.

Quote of the Thread:

   Damian: "Think Of It As Evolution In Action"
   Austin: This coming from someone whose national bird is
       the platypus

Hey, it made me laugh.

http://groups.google.com/groups

http://groups.google.com/groups

http://groups.google.com/groups

http://groups.google.com/groups – semantics of <...>

Superpositions and Laziness

Piers Cawley failed to change the subject line as he asked about runtime class creation. He wanted to know if one could do:

    class {
        push @ISA, $parent_class;
        ...
    }

Damian sincerely hoped not. Frankly, so does Piers, what he really wants is a nice interface to Class:

    Class.new( isa => $class ) {
        method { ... }
        method { ... }
    }

But so far everybody has ignored that post…

http://groups.google.com/groups

Dynamic scoping (take 2)

Ralph Mellor posted a summary of his understanding of dynamic scoping with temp and let and went on to propose a system of implicit argument passing, intended to get ‘round the perceived problem of threading and dynamic scope not playing well together. Larry pointed out that Ralph seemed to have a misapprehension about Perl threads where, unless a variable is explicitly marked as shared between threads then dynamically scoped variables work just fine. Larry went on to discuss some rather splendid extensions of the currying concept:

   use Dog.assuming(tail => "cut short", ears => "cut_long")
   my $little_dog = Dog.where_oh_where();

Which is rather cute.

http://groups.google.com/groups

http://groups.google.com/groups

Meanwhile, on the documentation list

The Documentation list continued its mission to explain, spending the week working on Numeric Literals, producing a 5th summary of what is known.

http://groups.google.com/groups

In brief

Last week, Brent Dax stated that we’d have to write Perl6 in Perl ‘because otherwise we can’t have the self modifying grammars’. Which caused Simon Cozens to wonder why he’d been spending so much time writing self modifying parsers in C.

Joseph F. Ryan has been writing tests for numeric and string literals and keeping them in sync with discussions on perl6-documentation. Thanks Joseph.

David Robins wondered when the long double bug would be fixed. Nobody quite knows, but Dan is working on it, once he gets a compiler back up on his long double machine.

Who’s Who in Perl 6?

Who are you?

Nicholas Clark

What do you do for/with Perl 6?

Lurk. Sadly I usually generate more e-mail than code. I sometimes dabble in fixing compiler warnings, the ARM JIT, and anything else that seems interesting to me. It’s a good thing I’m not expected to do anything important, as parrot would never get finished if were.

Where are you coming from?

Well, porting Perl5 to RISC OS, then getting gradually sucked into being a core Perl5 porter. I keep seeing things that look fun to implement which no-one else seems to want to do, so I try to implement them myself.

When do you think Perl 6 will be released?

Before perl 5.10 However, I doubt Perl 6 will be ready by 1st April next year :-(

I believe that the parrot engine will become substantially useful by the middle of next year. However, I expect that the Perl 6 language design will not be complete by then, let alone implemented, let alone implemented optimally. So I suspect that the first real users of the parrot engine will be “other” languages. It’s a shame that many of the major dynamic languages which could be implemented on top of parrot don’t have anywhere near the level of regression tests that Perl does, as I’m told that this lack of tests makes it much harder to go about writing a re-implementation. I blame Schwern for making it too easy for Perl people to write tests :-)

Why are you doing this?

The perl5 internals are a complete mess. It’s like Jenga - to get the perl5 tower taller and do something new you select a block somewhere in the middle, with trepidation pull it out slowly, and then carefully balance it somewhere new, hoping the whole edifice won’t collapse as a result. The only long term solution to the perl5 internals is a complete re-write, and far too many corner cases of perl5 (as well as all of XS) actually depend on how bits of the internals work, so an internals only re-write isn’t going to be possible without some changes at the language level. And as the language itself has to change, then it might as well progress too.

You have 5 words. Describe yourself.

incorrigible pragmatic noisy pedantic perfectionist

Do you have anything to declare?

I’ve probably just contradicted myself. It wouldn’t be the first time. On, and I can’t code anywhere near as fast as I can talk. Sorry.

Acknowledgements

Proofreading was once again provided by Aspell and myself. I really should start writing this thing on Mondays again, then I’d have time to get it properly proofread by other human beings. Ah well. Next week.

I’ve been getting some interesting mail recently about Perl 6 and what it’s doing from people who aren’t active on the mailing lists, to the extent that I’m thinking of adding a `letters to the editor’ section (assuming I ever find the time). Is this a good idea? Am I even madder than you thought I was? What day is this? Are you the nurse? Only they tell me I’m not supposed to talk to strangers…

Ahem.

Here’s the chorus once more:

If you didn’t like the summary, what are you doing still reading it? If you did like it, please consider one or both of the following options:

The fee paid for publication of these summaries on perl.com is paid directly to the Perl Foundation.

Tags

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub