The D Programming Language (was: Still more new operators)
Henry Spencer
henry at utzoo.uucp
Fri Feb 26 06:22:37 AEST 1988
> ... An undeclared variable should be an error, not an int.
Um, perhaps you should learn C before you start designing D...? An
undeclared variable *is* an error.
> Another thing that should go is the assumption that the unit of storage is
> the byte. The base unit of storage is the bit, and sizeof should return the
> number of bits in the object. This enables to treat objects smaller than a
> byte as first class objects.
Here we have a key decision: is D to share C's emphasis on generation
of efficient code? (Bearing in mind that this had a lot to do with C's
success.) If so, then trying to forget that bytes exist is a serious
mistake. Most machines cannot handle bits with anywhere near the efficiency
with which they handle bytes; the appropriate base unit for efficient code
*is* the byte.
> ... In keeping with the spirit of C, we avoid
> superfluous words, and keep the ones we do use short.
>
> With these changes, the {} statement delimiters become much less useful. I
> would probably drop them, and add a "begin ... end;" construct...
Please explain how avoiding superfluous words and keeping necessary ones
short is consistent with changing {/} to begin/end for no particular reason.
> To get even more radical -- with typedefs, enums, const declarations, and
> (if we add them) inline functions, do we really need the pre-processor any
> more? ...
The C++ people claim that the answer is "not much", given inline functions
in particular. They do still use it for some specialized problems, though.
> I would omit the automatic insertion of a null byte at the end of character
> constants. If you want nul terminated strings, write the nul. If you want
> strings with counts, the language should not get in your way.
Pray tell, how do you write a counted-string constant? I would suggest
that "abc" should mean a length-3 string with any necessary terminator,
regardless of what flavor of string is in use. That way you get a choice,
without recoding all your string constants.
--
Those who do not understand Unix are | Henry Spencer @ U of Toronto Zoology
condemned to reinvent it, poorly. | {allegra,ihnp4,decvax,utai}!utzoo!henry
More information about the Comp.lang.c
mailing list