grep

janderson askme at me.com
Fri May 9 22:50:23 PDT 2008


Dee Girl wrote:
> One good argument for a cast keyword is that persons can grep for it. But I just compiled this program:
> 
> void main() {
>     int a = 4;
>     float b = mixin("ca" ~ "st(float)(a)");
> }
> 
> It seems like string mixin makes it possible for bad persons to avoid being exposed by a grep. Just a thought, Dee Girl ^_^

I guess your not being serious but in case you are, you want to make bad 
coding difficult to do and good coding easy.  People area not likely to 
go to that much effort to circumvent cast.  There are a couple of other 
ways to get around cast:

//ie
class A
{

};

class B : A
{

};

	B[] b;
	b ~= new B;
	A[] a = b;
	a ~= new A;
//b[1] Is not an A type (not a B type), but is essentially a reinterpret 
A -> B.


Unions are another one.
You could also hide your cast in a lib file.



More information about the Digitalmars-d mailing list