[sv-bc] Where can $typeof() be used? Issues 224 and 277)

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Wed Apr 13 2005 - 14:50:56 PDT
An important remaining ballot issue (224 and 277) is to clarify
where $typeof() can be used.

The Mantis issue is 619

   http://www.eda.org/svdb/bug_view_page.php?bug_id=619

Here's its text description, and attached are the two partial proposals
from the spreadsheet --

As reported in P1800 ballot item 277, section 24.2 is unclear on where
$typeof() can be used. I think you should be able to use it anywhere. And,
according to the LRM

    "In all contexts, $typeof together with its argument
    can be used in any place an elaboration constant is
    required."

(It's not clear from this that it can be used at run-time.)

Yet I've heard it said that the LRM "calls out" the specific places where
$typeof can be used, namely,

     "The $typeof system function returns a type derived
      from its argument. The data type returned by the
      $typeof system function may be used to assign or
      override a type parameter, or in a comparison with
      another $typeof, evaluated during elaboration."

(Again, not clear if it can be used at run-time.)

I think that sentence should be read as "For example, the data type returned
...", not as an exhaustive list. Otherwise, the two quoted sentences are
inconsistent.

And interpreting that sentence as exhaustive leads to unnatural
restrictions, too.

As reported in P1800 ballot item 224, a $typeof should be useable anywhere a
datatype is useable. $typeof is currently limited to the following places:
to assign or override a type parameter, or in a comparison with another
$typeof, evaluated during elaboration.

As a result, today you can only use $typeof by copying its value into a
parameter type such as:

   parameter type out_type = $typeof(out);

and then you can do things like

   out = out_type'( out_packed );

Examples of requested capability:

   out = $typeof(foo)’(out_packed)

and

   typedef $typeof(foo) my_type

Additional example, today we are forced to do:

   parameter type foo = $typeof(bar);
   foo barbar;
   assign barbar = bar;

This is inconvenient. Why not simply allow:

   $typeof(bar) barbar;




Received on Wed Apr 13 14:51:25 2005

This archive was generated by hypermail 2.1.8 : Wed Apr 13 2005 - 14:51:58 PDT