{ All you HLL implementors and other PIR users out there, please be assured
  that I'll be providing as easy a transition as possible when/if these global
  opcodes are adjusted. }

On Thu, Jul 06, 2006 at 11:53:59AM -0700, Allison Randal wrote:
> I ran through a number of possibilities, but so far my favorite is: 
> find_global and store_global are truly 'global', that is, they always 
> require a fully specified namespace, including the HLL namespace.
> 
> Then a set of opcodes using the add_*, del_*, get_* naming scheme handle 
> the "magically assume the HLL root/current namespace" behavior. (PDD 21 
> uses both get_* and find_* for retrieval. It's better to standardize on 
> one, but it doesn't really matter which one.)

Well, I see a lot to like about this, but (and you knew there was a "but"
("but" that's my job now :-))), in descending order of difficulty:

 * The division into two categories ("global" and "symbol") leaves the third
   category (current namespace) with no clear home.

 * All the things being accessed are globals.  Seems like the word "global"
   should be used consistently, and "symbol" has many meanings in Parrot
   that only partly overlap the specific meaning of "global".

 * We still don't have way to ask for "my HLL" without spelling it.  I can
   say "my HLL's Foo" without spelling my HLL, but when I go up to my HLL's
   root I must suddenly know the spelling of my HLL and say it.  Seems like
   a sign of a design problem.

 * The global root is available as C<interpinfo .INTERPINFO_ROOT_NAMESPACE>
   at present -- awkward but fast.  Since global root accesses are supposed
   to be rare, awkwardness doesn't bug me for that case.  But adding opcodes
   for absolute-root ... hey, "absolute", that's a good name.
 
 * Huffmanizing shouldn't be as big a consideration with PIR/pasm as with
   most languages.  Most PIR/pasm is program-generated.

So here's an illustrative suggestion, which I think is a variant on one of
your also-rans, albeit one that leaves the common HLL case unmarked:

      .HLL 'perl5', perl5_group
      .namespace ['Foo']

      $P0 = get_cur_global 'x'              # ['perl5';'Foo';'x']
      $P0 = get_cur_global ['Bar'], 'x'     # ['perl5';'Foo';'Bar';'x']

      $P0 = get_global 'x'                  # ['perl5';'x']
      $P0 = get_global ['Corge'], 'x'       # ['perl5';'Corge';'x']

      $P0 = get_abs_global 'x'              # ['x']
      $P0 = get_abs_global ['parrot'], 'x'  # ['parrot';'x']

(If there is no Null, substitute a null PMC register.)
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to