Extend vector ops to boolean operators?

Sean Cavanaugh WorksOnMyMachine at gmail.com
Tue Mar 6 13:05:42 PST 2012


On 3/6/2012 2:30 PM, H. S. Teoh wrote:
> It'd be really cool if I could do this:
>
> 	void func(int[] vector, int[] bounds) {
> 		assert(vector[]>= 0&&  vector[]<  bounds[]);
> 		...
> 	}
>
> Is there any reason why we shouldn't implement this?
>
>
> T
>

This same problem exists for making proper syntactical sugar for simd 
comparison functions.

!= ==  (opEquals is required to return a bool)

and

<= >= < > (opCmp is required to return an int)


Granted its possible to live without the sugar but the code looks more 
like asm, and reading the code takes longer without the operators in it.



More information about the Digitalmars-d mailing list