Re: [sv-bc] Function call without parenthesis

From: Paul Graham <pgraham_at_.....>
Date: Wed Dec 14 2005 - 09:46:23 PST
> As explained in
> 
>    http://eda.org/svdb/bug_view_page.php?bug_id=93
> 
> requiring a () in subroutine calls of no arguments would violate the
> "Uniform Access Principle", which requires that syntax not distinguish
> whether a property is stored or is computed on demand.

This uniform access principle, or principle of referential
transparency, also leads to the use of () for both function
calls and array references, as in vhdl.  But even in vhdl it
doesn't hold completely.  For instance, f(1) could be a
function call or an array reference (or an array reference
of a function call of no arguments, or an array reference of
a dereference of a function of no arguments returning an
access type), but f(bit) can only be an array reference.

It also leads to special cases in vhdl.  For instance, if
function f returns a record type, then f.x occurring within
the body of f could refer to a local variable x within f or
could be the selection of element x in a recursive call to
f.

It also limits future expansion of the language.  For
instance, in C, if f is a function, then only f() can be a
function call, while f is just a reference to the function
(the function's address).  If you allow f to also be a call
to the function, then you need special rules for taking 
function addresses.  I don't know if SV will grow in that
direction, but why put unnecessary barriers in the way?

Anyway, since we're not really following this UAP in
general, then why follow it in this one special case?  It
certainly is causing a lot of controversy.  A principle that
is supposed to create uniformity should not breed this much
confusion.  I think that the principle of syntactic
simplicity and regularity is much more important.

Paul
Received on Wed Dec 14 09:46:27 2005

This archive was generated by hypermail 2.1.8 : Wed Dec 14 2005 - 09:47:01 PST