Static Method

In reply to dave_59:

Great responses! I know that I’m gonna learn much from you any time I’d ask; really appreciate this; I agree with most of them.

  1. Indeed the compile needs to know if a type exists; I must agree with your response on this principle. This is precisely why we sometimes do typedef class uvm_component; etc.
    The point is a compile may not know what pss_env_config is until it is defined; therefore, the code as written may not work. More likely or not, it will result in a syntax error due to “undefined” type. For your example, the reason that uvm_component works is that it is typedef’ed in its parent class uvm_report_object line 26.

  2. Who knows and remembers all the terminologies of OOP all the time? Thanks a bunch to point it out :-) I completely agree with you about their loaded words!
    The key word “static” is not a legacy term; it is defined in all IEEE 1800’s including the IEEE 1800-2012 section 8.10 page 141. It is stated that “A static method has no access to non-static members (class properties or methods)”. Accessing a non-static method as shown in pss_env_config::get_config will be a syntax error.
    The reason that uvm_fatal_context works and uvm_fatal does not is that uvm_fatal_context uses a static method but uvm_fatal does not.

The point of my inquiry is that the code as written will have at least a syntax error unless there is some clever trick hidden somewhere which I don’t know and would like to learn.
In my humble opinion, the code would be fine if it would has been written as:
1.
typedef class pss_env_config;
include “pss_env_config.svh” These can be written in the package in which the pss_env_config.svh is include’d.

  1. uvm_fatal_context should be used instead of uvm_fatal.

Thanks again; it is always a pleasure reading your posts; I am a big fan of yours.
Best regards