Re: problem with incomplete type references in draft 8


Subject: Re: problem with incomplete type references in draft 8
From: Paul Graham (pgraham@cadence.com)
Date: Thu May 09 2002 - 06:02:41 PDT


> For modular compilation, surely what matters is that the definitions of the
> types are available to the particular run of the compiler?
>
> I do not see why this depends upon the order of definition and use,
> provided both are visible at the same time.

It always helps when a declaration appears before its use. It saves one
pass in the compiler.

Remember that types can appear in the $root module. So a (non-$root) module
may refer to types declared after itself. In general then, I have to read
the full source before I can even begin to do type checking.

If you really want deferred types, then you don't even need the initial
typedef. As with function or task calls, a reference to a type is clear from
the grammar. So you don't need to do:

    typedef foo;
    foo x;
    typedef int foo;

You could just as clearly have:

    foo x;
    typedef int foo;

If we're going down this path, we might as well allow wires to be declared
after use!

Paul



This archive was generated by hypermail 2b28 : Thu May 09 2002 - 06:04:06 PDT