Re: [sv-bc] Function call without parenthesis

From: Joao Geada <jgeada_at_.....>
Date: Wed Dec 14 2005 - 10:11:49 PST
Have you all noticed that the bulk of the highly used, highly regarded
OO languages do not attempt to achieve this "uniform access principle" ?
C, C++, Java, Python, ... do not attempt to hide from coders whether
a function call or variable reference is taking place. Heck, even Common Lisp
doesn't try to do this.

Though in principle "uniform access" is cute, it imposes too many corner cases,
too many difficult to analyze situations and leads to hard to predict code behavior.
It is, in my opinion, neither good for implementors nor users.
This property has nothing to do with object orientation or its artifacts. Whether
a language provides this or not is a choice and I find it interesting that few
languages have choosen to implement it.

If, as the coder of a class, you don't want your users whether something is directly
available or compueted, then always provide an accessor method.
This is "object oriented design" 101; I do not see why we should cause this much
implementation pain and uncertainty for something so easily bypassed.

Joao
==============================================================================
Dr Joćo Geada                                            CLK Design Automation
Chief Architect                                   295 Foster Street, Suite 102
978-486 1056 x204                                          Littleton, MA 01460
==============================================================================

----- Original Message ----- 
From: "Paul Graham" <pgraham@cadence.com>
To: <mcnamara@cadence.com>
Cc: <Brad.Pierce@synopsys.com>; <sv-bc@eda.org>
Sent: Wednesday, December 14, 2005 12:52 PM
Subject: Re: [sv-bc] Function call without parenthesis


>> Is the above code illegal? Or is the compiler is supposed to figure out
>> that "f1.first" is a hierarchcial reference, where "f2.first" is an
>> attribute inquiry?
>
> And f2 could be a variable of a parameterized type, so that
> f2.first might be an enum method or a struct field.  Pity
> the poor reader.  Pity the poor implementor!
>
> Paul
> 
Received on Wed Dec 14 10:11:55 2005

This archive was generated by hypermail 2.1.8 : Wed Dec 14 2005 - 10:12:19 PST