This Week's Summary

2003-10-14 Thread Piers Cawley
The Perl 6 Summary of the week ending 20031012
Good afternoon readers. You find me sitting comfortably and tired after
a vaguely frantic week involving large amounts of new (and huge)
equipment, the delivery of a new Mini Cooper, and four days offline at a
large format photography workshop (photos will be going online soonish,
if you're interested). All of which hopefully goes some way to
explaining the fact that I've only just started writing the summary at
ten to four on Tuesday.

We start (and finish) with the internals list.

  New PMC compiler
Leo Ttsch isn't exactly happy with the current classes/pmc2c.pl PMC
compiler. He outlined the drawbacks as he sees them, proposed a scheme
for reimplementing it, and asked for comments. Dan said that so long as
the resulting code is clearer than the current PMC compiler, Leo should
go for it. So he did.

http://xrl.us/w5m

  The Status of Language, Credit Where It's Due
Melvin Smith has added a LANGUAGES.STATUS file in the languages/
subdirectory and asked for language authors to add summaries of the
various language subdirectories to the file.

Fresh from this success he added a CREDITS file for giving credit where
it's due. Rumours of an entry reading

N: Leon Brocard
D: Running Joke

are (currently) false.

Later in the week, LANGUAGES.STATUS was extended to cover both the
languages found in languages/ but any other languages that people were
working on and making available outside the Parrot distribution for
whatever reason.

http://xrl.us/w5n

http://xrl.us/w5o

  Binary MMD vtable functions are go
Dan's solved an off by one error with multimethod dispatch and checked
everything in, so now Parrot has working two argument multimethod
dispatch. Hurrah! There's still lots it doesn't do mind, but getting
started is always good.

http://xrl.us/w5p

  Attacking the Unicode Monster
Dan's searching for a Unicode Monster Wrangler. ICU is now building on
enough platforms that the time has come to build an encoding and
chartype library for it. Volunteers gratefully received.

Jeff Clites and Michael Scott have both been poking at it a bit;
hopefully they'll be able to put their heads together and emerge with
something wonderful.

http://xrl.us/w5q

  More NCI stuff
Dan's been a busy boy this week. Parrot now comes with
library/postgres.pasm, an interface to libpq (the C library that talks
to Postgres). These NCI interface files are currently built by hand. Tim
Bunce wondered if it might be possible to ExtUtils::XSBuilder to
generate PASM from C header files instead of XS code. It was generally
agreed that this would be a cool thing, but it's not been done yet.

http://xrl.us/w5r

http://www.postgresql.org/

  The Parrot Stack and Z-Machine
Amir Karger is working on getting his head 'round the Z-Machine (The
virtual machine that runs Zork and the other Infocom games, amongst
others) by writing code to translate Z-code into a Perl executable. He
came up with a problem with saving and restoring the stack in order to
save the game state.

http://xrl.us/w5s

  References
Leo's been giving the Reference PMC a hard look and, as a result,
suggests adding a couple of handy ops, deref and ref (which finds
the type of the thing the reference refers to) to use with them. Melvin
Smith pointed out that, actually we only needed one of Leo's proposed
ops. On the other hand, as Nicholas Clark pointed out, ref avoids the
need to grab another PMC register, which may cause a register spill. On
the gripping hand, Melvin argued that spillage is pretty rare with the
number of registers Parrot has.

http://xrl.us/w5t

  The program's ending! DESTROY everything!
Jrgen Bmmels found a subtle bug where objects that had active
destruction weren't having their destroy functions called correctly (at
all) when parrot terminated. After a couple of goes round the 'this
would be so much easier if we were all in the same room
misunderstanding' loop, the Right Thing was settled upon and
implemented.

http://xrl.us/w5u

  An interesting task for the evil
One of the things that Dan would really like to be able to promise with
Parrot's GC is ordered destruction. Taking a leaf out of my lightning
talk on complexity management, he noted that we just need to order the
PMCs before destroying them, to make sure we don't call the destructor
for a PMC before we destroy the things that depend on it and asked for
volunteers to implement it.

Dave Mitchell spoilt the understatement party by pointing out that, in
the presence of circular dependencies things got a little more
complicated (but not that much more complicated, Dan claims).

Nobody's actually volunteered yet.

http://xrl.us/w5v

 

How to create a function that returns nothing

2003-10-14 Thread Joe Gottman
How do you declare a function that doesn't return anything? For instance, a
C++ swap function might be declared
   template class X
void swap(X x, X y);

It would be nice to declare the corresponding Perl6 function as
sub swap ($x is rw, $y is rw) returns nothing {...}
or something similar.

This would be an absolute necessity if you wanted to emulate C++, Java, or
any other strongly typed language.

Also, it could be useful for causing a compile-time error if someone types
something like
$z = swap($x, $y);


Joe Gottman





Re: How to create a function that returns nothing

2003-10-14 Thread Luke Palmer
Joe Gottman writes:
 How do you declare a function that doesn't return anything? For instance, a
 C++ swap function might be declared
template class X
 void swap(X x, X y);
 
 It would be nice to declare the corresponding Perl6 function as
 sub swap ($x is rw, $y is rw) returns nothing {...}
 or something similar.

Use the Void pseudo-type:

sub swap ($x is rw, $y is rw) returns Void {...}

Or if you're in a more C-ish mood:

our Void sub swap ($x is rw, $y is rw) {...}

 This would be an absolute necessity if you wanted to emulate C++, Java, or
 any other strongly typed language.
 
 Also, it could be useful for causing a compile-time error if someone types
 something like
 $z = swap($x, $y);
 
 Joe Gottman