RE: [sv-bc] Naming of unnamed sequential blocks

From: Steven Sharp <sharp_at_.....>
Date: Thu May 19 2005 - 11:26:50 PDT
Mac wrote:
>S1) I stand by my assertion that if we want hidden variables, the way
>to do this is to add an attribute, much like "static", to the
>declaration.  Allowing declarations in an unnamed block is a very
>surprising and unintuitive way to get this "local" characteristic; and
>also does not address the need for module wide local variables.

I agree with this.  The same sort of thing is happening with "automatic"
variables declared in initial/always blocks.  Such variables are not
really automatic, since there is no possibility of reentrancy.  There
will only be one copy of such a variable, so it can use static storage
(though I suppose you have the possibility of sharing storage with
other "automatics" declared in disjoint scopes in the process).  One
argument in favor of allowing them to be declared automatic was that
this gives the side effect of hiding them.

This reliance on side-effects of an otherwise unrelated feature to get
the feature you really want is poor design.  If the goal is to be able
to declare local variables that can't be accessed from outside, then
there should be a way to declare exactly that.  Note that classes have
a similar concept, and have already reserved the keyword "local" for it
(though I suppose if you directly extrapolate from sub-classes to
sub-scopes, "local" variables would be unavailable in sub-scopes, while
"protected" variables would be available to sub-scopes).


Steven Sharp
sharp@cadence.com
Received on Thu May 19 11:26:55 2005

This archive was generated by hypermail 2.1.8 : Thu May 19 2005 - 11:27:03 PDT