5 ms·
As a crazy random thought, wouldn't '@' work well as an alternative to the asterisk to dereference pointers? It's available, it's ASCII, it's pronounced "at" wh
by unwind 16y ago
As a crazy random thought, wouldn't '@' work well as an alternative to the asterisk to dereference pointers? It's available, it's ASCII, it's pronounced "at" which seems to jive with pointer semantics, and it's not used in C-like languages.
Just a very quick thought after reading Mr Pike's closing words that the use of the asterisk for pointers makes the syntax a bit clumsier than they would have wished.
- by 16y agoThat would invert the use in Pascal where P := @X; means assign the address of X to P. And Y := P^; means dereference P and assign the result to Y. I think anyone who has written any Pascal/Delphi would prefer ^ for dereference.
- btilly 16y agoAnyone who has done a lot of bit twiddling in C has other uses for ^. (I find it ironic that 4^5 has an obvious meaning outside of programming that it doesn't have in a large variety of widely used programming languages.)
- Groxx 16y agoC and many other languages. ^ is very nearly a universal code-XOR, at least where single-characters are concerned.
- by 16y agoI suppose they should be allocated based on frequency of use within the intended domain of the language, with the most frequent getting first choice. I guess pointer dereferencing would be more important than xor for most domains. Not that I am particularly advocating ^ for pointers, * is just as good, but I do think using @ for the opposite of its meaning in Pascal would be confusing.
- nddrylliog 16y agoThat's very funny sir, because http://ooc-lang.org/ http://ooc-lang.org/ happens to do just that. In addition, & and @ are postfix, which pretty much settles the question.