Re: Exposing the Garbage Collector

2005-07-26 Thread Piers Cawley
TSa (Thomas Sandlaß) [EMAIL PROTECTED] writes:

 Piers Cawley wrote:
 Let's say I have a class, call it Foo which has a bunch of attributes, and 
 I've
 created a few of them. Then, at runtime I do:
eval 'class Foo { has $.a_new_attribute is :default10 }';
 Assuming I've got the syntax right for defaulting an attribute,

 I think you need a 'class Foo is extended' to re-open the class.
 Otherwise you produce a redefinition error if the scope you call
 eval in already contains---or is that extains because of the name
 search beeing *outwards*---one you start from scratch.

Oh for heaven's sake! That's the last time I go trying to come up with concrete
examples for this sort of thing. Of course, you're right, I should have said
'is extended', but if I were doing it for real, the eval would fail and I'd
have a meaningful error message. 

[ An explanation of why this particular case doesn't require iterating over the
live set ]

I really shouldn't go picking concrete examples that can be worked around
should I? Suffice to say that sometimes (say for debugging purposes, or program
analysis -- Smalltalk can do some cunning typer inferencing tricks by examining
the live set for instance) I would like to be able to iterate over all the
objects in the live set. ISTM that exposing the Garbage Collector at the
Language level is the neatest way of doing this (or coming up with something
like Ruby's ObjectSpace, but conceptually I reckon the GC is the right place to
hang it).


Re: Exposing the Garbage Collector (Iterating the live set)

2005-07-26 Thread TSa (Thomas Sandlaß)

Piers Cawley wrote:

I would like to be able to iterate over all the
objects in the live set.


My Idea actually is to embedd that into the namespace syntax.
The idea is that of looking up non-negativ integer literals
with 0 beeing the namespace owner.

  for ::Namespace - $instance
  {
 if +$instance != 0 { reconfigure $instance }
  }

Hmm, how would that be written inside the owning class?

  for :: - $instance {...} # or perhaps ::_ or ::0

H, and the current actor/owner is $/ which gives the expanded
method call syntax:

   .method   #  really means:   $/.method($_)

Then we need to distinguish between the owner of a block and
the topic of the block. In methods the owner is called invocant,
of course. This also nicely unifies rules and methods. But with
the drawback that the brawl then shifts from topic versus invocant
to rules and method competing for ownership :)



ISTM that exposing the Garbage Collector at the
Language level is the neatest way of doing this (or coming up with something
like Ruby's ObjectSpace, but conceptually I reckon the GC is the right place to
hang it).


To me the GC is an implementation detail for rendering the
illussion of infinite memory :)

For example +::Int could return the number of instances in use
not the potential Inf many ones. Adding the infix namespace wildcard
could allow to retrieve attributes as arrays indexed by object id:

  @instvalues = ::SomeClass::*::attr;

The access control on a level behooves its owner/origin that
is ::NameSpace::0. This gives in the end a virtual tree of all
static information. As a fallout, structured rule matches can also
be queried with :: and as such nicely blend strings into the
type system. E.g. after successfull recognition an object could
be created by simply reparenting it from the rule to its class/owner.

The referential fabric and the call chains are hang-off this
structure somehow, as well. Everything else is basically garbage.

Too far off the mark? If not, I've ideas for ?? and :: beeing
top precedence namespace query ops. Only effect is that the
current meaning needs parens like ($condition ?? $value :: $other)
for preventing strange tokenization. OTOH would the barebone
structure of Perl6 revolve around ?? :: ::= () ; and namespace lookup.
--
TSa (Thomas Sandlaß)




Perl 6 Summary for 2005-07-19 through 2005-07-26

2005-07-26 Thread Matt Fowles
Perl 6 Summary for 2005-07-19 through 2005-07-26
All~

Welcome to another Perl 6 Summary brought to you by microwaved chinese
food and air conditioning. I love the modern era. Without further ado, I
bring you

  Perl 6 Compilers
Grégoire Péan announed the release of PxPerl 5.8.7-3, allowing people
who want to play with Pugs and Parrot on windows easy access.

http://xrl.us/gv6k

   Test Report for Windows
Ronald Hill reported some failing tests for Pugs on windows.
Fortunately, given Pugs's developement, there is a reasonable chance of
these problems being fixed. Unfortunately, given Pugs developement, no
such information made it to the list.

http://xrl.us/gv6m

   Parsing Perl6 Rules
Nathan Gray wondered how Jeff Pinyan's parsing perl6 rules project was
going. Jeff said that it did not get very far, but he posted what he did
have to http://feather.perl6.nl/~japhy/.

http://xrl.us/gv6n

   Pugs Problems
Vadim Konovalov was playing with slurp and found two problems. Adriano
Ferreira showed him how to work around slurp not accepting a :raw
option. Nobody commented on the peculariar $*ARGS[0] value when the
argument is -foobarfluffy.

http://xrl.us/gv6o

   Official Perl6 Rules Grammar
Patrick announced an official Perl 6 grammar whichi he would be
mainting closely with PGE in Parrot. It is incomplete at this point, but
patches are most welcome.

http://xrl.us/gv6p

   PIL Nodes's Descriptions
Allison Randal posted a request for a clue batting, listing various
types of nodes in PIL and explaining her guess at their descriptions.
Stuart Cook and Patrick both provided a little help, although not
everything on her list was addressed.

http://xrl.us/gv6q

   Perl 6 FAQ Patch
Autrijus provided a patch for the Perl 6 FAQ removing an outdated
question. Robert Spier applied the patch (modulo some confusion about
staged vs live copies).

http://xrl.us/gv6r

  Parrot
   Opcode Optimizability
Curtis Rawls noted that it is often simpler from an optimizer writers
standpoint to do constant folding and optimization on a smaller set of
opcodes (just one variant add instead of five (seven if you count inc
and dec)). Leo explained that removing these opcodes isn't an option,
but that a suggestion for compiler writers to only emit the more verbose
codes could be added to the faq.

http://xrl.us/gv6s

   Refcounting Hash
Nicholas Clark wants to use a hash to hold reference counts for Ponie
(something like dod_register_pmc in pmc.c), but he doesn't want to
duplicate code. Leo suggested that he move some of the code into a pmc
and then switch the real registry to use that PMC.

http://xrl.us/gv6t

   New PGE Test
Mitchell N Charity submited a test for a large pugs grammar, which
currently fails. Patrick noted that the test like came from
rx_grammar.pl in the Pugs distribution. This probably led to his above
addition of an Official Perl6 Rules Grammar.

http://xrl.us/gv6u

   Jit Emit Help
Adam Preble decided that he would play with an x86_64 code generator.
Unfortunately, he was hitting some stumbling blocks. Leo offered to help
him and provided pointers from #parrot.

http://xrl.us/gv6v

   Call Opcode Cleanup
Leo wants to cleanup some of the various invoke opcodes. He posted a
request for comment, but Warnock applies. It seems that Leo's request
for comments like this get Warnocked a lot...

http://xrl.us/gv6w

http://xrl.us/gv6x

   spawnw Return Value
Jerry Gay opened a TODO ticket for switching spawnw to return something
object like to wrap platform-specific oddities. Prompted by Jonathan
Worthington submitting a patch to make the spawnw tests pass on windows
(which was applied).

http://xrl.us/gv6y -- Ticket

http://xrl.us/gv6z -- TODO

   Bugs in ops2vim.pl
Amir Karger noticed a bug in ops2vim.pl and suggested a fix. Jerry Gay
fixed it.

http://xrl.us/gv62

   Leo's Ctx Branch Tests
Jerry Gay and Leo worked together to get his branch passing a few more
tests on windows. Nick Glencross wondered if the python dynclasses tests
were being run too. Jonathan Worthington explained that they were being
skipped for the moment.

http://xrl.us/gv63

   Raised by the Aliens
Matt Diephouse was surprised to discover that you cannot use addparent
with a PMC for either argument. He suggested that this be made to work
or officially documented.

http://xrl.us/gv64

   Patches Accumulating
Leo requested that people with commit bits pick up some of the patches
that were building up as he was running a little low on tuits.

http://xrl.us/gv65

   Dump CFG
Curtis Rawls moved the dump_cfg call from reg_alloc.c to cfg.c. Leo
applied the patch.

http://xrl.us/gv66

   string_to_cstring leaks
Jonathan Worthington