Couple minor m0 thoughts

Christoph Otto christoph at mksig.org
Fri Aug 5 17:26:29 UTC 2011


On Fri, 05 Aug 2011 06:36 -0500, "Aaron Faanes" <dafrito at gmail.com>
wrote:
> I was reading the m0 spec and had a couple thoughts/questions as I read:

Thank you for taking the time to comment on them.

> 
> * The term "x" is used to indicate an argument's value is ignored. In
> a few other languages, a single underscore is commonly used for this
> purpose. It's a little unusual to see, but I think the underscore
> indicates "ignore me" better than x.

'x' was the first thing that came to mind, but "_" does seem a bit more
readable.  We won't be writing a whole lot of M0 code once Mole is
ready, but we will be reading quite a bit of it, so readability will be
valuable (especially if it's an easy change like this).  I'll add the
change to my todo list.

> 
> * I also noticed that labels cannot begin with underscores (at least,
> according to the provided regex). Is this intentional? I know in some
> dark corners of the world, prefixing a label/function with underscores
> indicates that it's more magical than usual.

+0.  I'll accept a patch, but labels are pretty internal.  Relying on
their names (or any aspect thereof) should be avoided.  I wasn't
explicitly thinking that labels shouldn't start with an underscore, but
I don't see much reason why they should either.

> 
> * Can copy_mem copy to/from GC memory to sys-allocated memory? I'd
> assume so, but I feel that this capability should be made explicit.

Yes.  I'm not sure why this wouldn't be the case.  I'll add it to my
todo list to make this explicit.

> 
> * The discussion about registers and the discussion of spilling should
> probably be closer together, in a lexical sense, since they seem
> related.

todo'd.  A general reorganization of the pdd has been in order for a
while.  I would reject a patch that did it for me. ;)

> 
> * Regarding registers, is it acceptable/possible for a M0 VM to
> contain more than 256 registers, to prevent spilling?

No,  but I think it will be more common to need far fewer than 256
registers.  If we don't write explicit tests for register spilling, I
expect that only very unusual code will use it.

> 
> -- 
> Aaron Faanes <dafrito at gmail.com>
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
> 

Christoph


More information about the parrot-dev mailing list