On Friday, 29 September 2017 at 03:37:53 UTC, Jonathan M Davis
wrote:
On Friday, September 29, 2017 01:51:36 Jerry via Digitalmars-d
wrote:
I miss ref variables, for the simple fact that using the
square brackets with a ref variable doesn't access the
pointer. Don't know how many times I've accidentially used a
pointer as an array. Not very easy to catch especially if the
object has pointers to other objects of the same type.
Possibly adding something like this, if ref variables are off
the table?
@noarray int* value;
value[x] = 10; // compile error, pointer is not an array.
You could always create a wrapper struct for the pointer and
then not overload opIndex.
- Jonathan M Davis
Not the most ideal solution, doesn't work with several other
features like auto.