What languages other than C and C++ have explicit reference and pointer type qualifiers? People seem to be easily confused by the right-to-left reading order of types, where char*& is "a reference to a pointer to a character", or a "character-pointer reference"; do any languages with explicit references make use of a left-to-right reading order, such as &*char/ref ptr char? I'm working on a little language project, and legibility is one of my key concerns.
It seems to me that this is one of those questions to which it's easy for a person but hard for a search engine to provide an answer. Thanks in advance!
Stroustrup is on record as saying the declaration syntax is "an experiment that failed". Unfortunately, C++ has to go along with it for C compatibility. The original idea was that a declaration looked like a use, for example:
char * p; // declare
* p; // use (dereference)
but this quickly falls apart for more complex declarations. Many people (at least many Pascal programmers) prefer the syntax:
variable : type;
where type is something like:
array of char
which is about as readable as you are going to get, and is left-to-right.
I think this is defunct but it might be of use to you: http://en.wikipedia.org/wiki/Significantly_Prettier_and_Easier_C%2B%2B_Syntax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With