In an effort to improve its error reporting ability and internal maintainability,
I'm considering the following changes; well number (1) is already decided,
but I need feedback from compiler maintainers before doing so.


1) Currently typenames are not checked except with 'new <classname>'

C<.local <type> identifier> and C<.param <type> identifier> both assume
that anything for type other than (int|float|string) is a PMC. This was
not intended to be permanent behaviour, but I never added the proper checking.


Patching my local copy has uncovered a few places where people have
used the undocumented "feature". The downside to the "feature" is lazy error
checking and confusing messages from IMCC that have nothing to do with the error.


    New hackers write ".local integer i" and then waste time wondering why
    IMCC keeps saying "unknown parrot op foo_p_p" because integer really
    isn't a type, what they meant was (int).

I see in a lot of tests the use of C<var> and C<object> as types in IMC code.
I believe Jako and Perl6 compilers use C<object> as well.


    I'm ok with just adding those 2 as aliases for C<pmc> register, but I only
    want to add aliases that are appropriate. The feature of defaulting to PMC
    is going away, so get your requests in now. I also want to keep the
    aliases to a minimum.

From now on any declarations in IMCC will require either an IMC register type
or a predefined classname or PMC. Else, just use C<pmc> to mean generic.


Comments from the compiler maintainers (especially the Perl, Forth & Jako guys)?


2) In the absence of some sort of return instruction, subs currently just run off the end of their code and continue merrily. This feature really isn't useful as far as I can see because it is not supported to assume any ordering between compilation unit, which a sub _is_.

It is easier to just assume a sub returns by the active convention.

I'd like to just be able to write void subs as:

    .sub _foo
       print "hello\n"
    .end


3) Strict prototyping mode shortcut (backwards compatible of course):
As usual, shortcuts are for hand-hackers, but its easier to debug either way.


   .sub _baz (pmc p, int i)
      ...
   .end

Same as:

   .sub _baz protoyped
      .param pmc p
      .param int i
      ...
   .end


4) No implicit global labels with the label :== IDENTIFIER COLON syntax.
Currently labels beginning in _ are global. I'd like to remove the implicit aspect of it.
sub definitions will create global labels, as might other directives, but there will no longer be
a requirement that subs start with _ in order to get the correct behaviour.


We might still want global labels declarable, somehow, so I'm open to suggestions, but
I don't see the need, really.



A couple of these suggestions might seem uncalled for. Honestly I am trying to tighten up things and officialize IMCC behaviour so expect more soon. Some changes might cause minor breakage to existing compilers but that is just growing pain.

-Melvin




Reply via email to