/.../ If C++-like references are implemented there'd still be a use for pointers.
That wasn't really true. C++-like references together with the current iterators would pretty much make up for pointers.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-04-16 01:16: Subject: Pointers/lvalues
Yes, Grubba and I discussed that a bit too. The C-like syntax has some advantages:
o It's clear that a nonlocal value is referenced/changed in the expression where it occurs.
o Pointers are more flexible, e.g. in the use as iterators. If C++-like references are implemented there'd still be a use for pointers.
o One big feature with C++ references is that the compiler guarantees that they point to a valid location. Pike can't make a similar guarantee since it's weakly typed. So in an expression
x = 17
one could still get a runtime error like "dereferencing the NULL value".
o Implementing references would mean to fix implicit casting from pointer svalues and iterators to the values they reference. That means adding code to almost every C-level function to make such conversions on its arguments before typechecking them. In cmods it can be automated, but it'd still be a major hassle and compatibility issue.
/ Martin Stjernholm, Roxen IS