Comment #0 by bearophile_hugs — 2012-04-05T18:05:40Z
This is a low-priority and low-importance "enhancement suggestion" (it's not even an enhancement request because I am not sure if this is a good idea. I will close it if you think it's a bad idea).
Currently you are allowed to use $ to denote array lengths inside their [], like this:
arr[$ - 1]
The idea here is to extend the $ syntax as suffix too, something like this:
@property size_t __dollar(T)(in T[] a) pure nothrow {
return a.length;
}
void main() {
int[5] a;
auto len = a.$;
}
This shortens the code, and this code isn't harder to understand because D programmers already know that $ means the length of the array.
Comment #1 by yebblies — 2013-01-16T18:56:38Z
I would consider this a bad idea, but that's just me.
Comment #2 by pro.mathias.lang — 2019-08-29T17:34:05Z
Yup, sounds like a bad idea, and I'm pretty sure a lot of people would oppose this.
So going to close this as non-actionable.