[sv-ec] calls to constructor after "begin"

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Wed Dec 20 2006 - 15:12:49 PST
Francoise, strictly speaking, Brad is correct and calling
"super.new" after a "begin" is not legal by the BNF.

I think this is an unintentional artifact or (if intentional
by someone) not terribly reasonable.

I think this should be a semantic constraint, not a structural
one.  We certainly allow
    function new();
      begin
         super.new();
         ...
      end
    endfunction

The constraint really should be (in imprecise language)
that the first statement other than a scope entry "begin"
must be the super.new call.

I don't think that customers would be amused if we didn't
allow this.

Gord.

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


---------------------------------------

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Thu Dec 07 2006 - 13:32:12 PST

According to Syntax 10-1, the first statement executed is the begin-end,
not the call to super.new().

-- Brad

________________________________

From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Francoise Martinolle
Sent: Thursday, December 07, 2006 11:00 AM
To: sv-ec@eda-stds.org
Subject: [sv-ec] question about the bnf for function new


This is a minor comment about the bnf for the declaration of the class
constructor.

The BNF for the constructor new makes the following example illegal:

         function new(input string name,input urm_named_object parent);
             begin
                 super.new(name, parent);
                 begin

                 end
             end
         endfunction

If the enclosing begin/end block is deleted, the example is legal.
As far as I can tell, super.new is in both examples the first statement
executed. So was it really intended to make that example illegal?


The bnf is:

class_constructor_declaration ::=

function [ class_scope ] new [ ( [ tf_port_list ] ) ] ;

{ block_item_declaration }

[ super . new [ ( list_of_arguments ) ] ; ]

{ function_statement_or_null }

endfunction [ : new ]
Received on Wed Dec 20 15:12:51 2006

This archive was generated by hypermail 2.1.8 : Wed Dec 20 2006 - 15:12:59 PST