Re: SV 3.1 draft 1 LRM available


Subject: Re: SV 3.1 draft 1 LRM available
From: Kevin Cameron (Kevin.Cameron@nsc.com)
Date: Tue Dec 03 2002 - 18:25:25 PST


I still have a major problem with the lack of syntactic distinction between references
and actual objects in this extension, and the use of "var" (as a keyword). It makes
the language a lot harder to parse and makes it quite unlike C/C++. [ Can this
be added to the issue list?]

On page 26 there is an example of an array copy:

    int A[100:1]; // fixed-size array of 100 elements
    int B[*]; // empty dynamic array
    int C[*] = new[8]; // dynamic array of size 8

    B = A; // ok. B has 100 elements
    B = C; // ok. B has 8 elements

- B & C are effectively references (to dynamically allocated objects), similar
statements in C:

       int A[100],
            *B,
            *C = (int *)malloc(8 * sizeof(int));

        B = A;
        B = C;

- have entirely different semantics: SV does a copy of the object, C copies the
reference (address). [Is there syntax for copying a reference in SV?]

Also, the inability to distinguish between pass-by-reference and pass-by-value
in the caller's context makes it a lot harder to analyze modules in isolation when
they use non-local functions or tasks.

It would be nice to have the SV syntax/semantics match C and C++ conventions
as much as possible so that it is easy to translate C/C++ algorithms into SV (and
users don't get confused).

In the same vein I don't see why the "*" is necessary in the "[*]" for unsized arrays,
C just omits the size.

Kev.

--
National Semiconductor, Tel: (408) 721 3251
2900 Semiconductor Drive, Mail Stop D3-500, Santa Clara, CA 95052-8090



This archive was generated by hypermail 2b28 : Tue Dec 03 2002 - 18:25:45 PST