DMD 1.007 release

Max Samukha samukha at voliacable.com
Fri Feb 23 07:23:25 PST 2007


On Thu, 22 Feb 2007 14:20:30 -0700, Hasan Aljudy
<hasan.aljudy at gmail.com> wrote:

>
>
>Walter Bright wrote:
>> Hasan Aljudy wrote:
>>> Is there a reason why this shouldn't work?! It seems to me this is the 
>>> most basic usage for mixin & compile time functions.
>> 
>> Try putting the definition of getstruct() before the mixin.
>
>What about this one?
>
>---------------
>dchar[] testd( dchar[] input )
>{
>	if( input[3..5] != "rt" )
>	{
>		return input[1..3];
>	}
>	return "my";
>}
>
>void main()
>{
>	static x = testd( "hello" );
>}
>----------------
>
>it says:
>  Error: cannot evaluate testd("hello") at compile time

I've been racking my brain over the problem too. It seems like string
comparison expressions are not evaluable at compile time. 

input[3] != 'r' || input[4] != ''t" should work

you can also make your own compare function




More information about the Digitalmars-d-announce mailing list