[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

snmpconf Policy MIB: Eliminate pointers



This is a continuation of my series of critiques/suggestions for the C-like 
language in the Policy MIB.

The text of the document indicates that pointers will not be part of the 
language. Indeed, I think it is inappropriate to introduce a machine-level 
concept like pointers into a language that is intended to be small and easy 
to interpret. Pointers are a major complicating subject and C's use of 
pointers is foreign to most people who don't program in C.

The problem with eliminating pointers is that the library function seem to 
use them for pass-by-address parameters. This involves using the address-of 
operator (&) to take the address of a variable before passing it to a 
library function. Both the address-of operator and the dereference operator 
(*) add syntactic and semantic complexity to the language.

My proposed solution: implied pass-by-reference. Library functions that 
needed to modify their arguments would simply be able to do so. Since the 
library functions are all built-in and do not need to be declared 
explicitly, there should be no syntactic issue with this. This eliminates 
the need for the address-of operator and the dereference operator and for 
pointers in general (except for char*, which I addressed in an earlier post).

Another alternative would be to use C++ as a base language instead of C. 
That way, we could use references. The final language wouldn't be bigger, 
we would just have a larger starting point from which to pick-an-choose 
features.

- Pablo
---------------------------------------------------------------------
Pablo Halpern                                    phalpern@newview.org
http://www.halpernwightsoftware.com