View mode: basic / threaded / horizontal-split · Log in · Help
February 22, 2007
Re: dmd.1.007.zip not on website
Bump.  Please fix this, it's still down.

Russell Lewis wrote:
> Touch.  It's still missing.
> 
> jcc7 wrote:
>> == Quote from Carlos Santander (csantander619@gmail.com)'s article
>>> Walter Bright escribió:
>>>> Cleanup of compile time function execution issues.
>>>>
>>>> http://www.digitalmars.com/d/changelog.html
>>>>
>>>> http://ftp.digitalmars.com/dmd.1.007.zip
>>> The zip file is gone. What happened?
>>
>> I've noticed the same problem.
>>
>> And "http://ftp.digitalmars.com/dmd.zip" seems to contain DMD 1.006.
February 22, 2007
Re: dmd.1.007.zip not on website
>>>>> http://ftp.digitalmars.com/dmd.1.007.zip
>>>> The zip file is gone. What happened?

ftp://ftp.digitalmars.com/dmd.1.007.zip

works

- Paul
February 22, 2007
Re: dmd.1.007.zip not on website
Paul Findlay wrote:
>>>>>> http://ftp.digitalmars.com/dmd.1.007.zip
>>>>> The zip file is gone. What happened?
> 
> ftp://ftp.digitalmars.com/dmd.1.007.zip
> 
> works
> 
> - Paul

Ah, the file is back now.

-- 
jcc7
February 22, 2007
Re: DMD 1.007 release
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
February 23, 2007
Re: DMD 1.007 release
On Thu, 22 Feb 2007 14:20:30 -0700, Hasan Aljudy
<hasan.aljudy@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
February 24, 2007
Re: DMD 1.007 release
Max Samukha wrote:
> On Thu, 22 Feb 2007 14:20:30 -0700, Hasan Aljudy
> <hasan.aljudy@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
> 

What I was pointing out was that slicing doesn't seem to work.
February 24, 2007
Re: DMD 1.007 release
On Fri, 23 Feb 2007 17:00:55 -0700, Hasan Aljudy
<hasan.aljudy@gmail.com> wrote:

>
>
>Max Samukha wrote:
>> On Thu, 22 Feb 2007 14:20:30 -0700, Hasan Aljudy
>> <hasan.aljudy@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
>> 
>
>What I was pointing out was that slicing doesn't seem to work.

Slicing works. Comparisons is what makes your function unevaluable at
compiletime. Try to use a function to compare slices. Something like
this:

bool isEqual(dchar[] str1, dchar[] str2)
{
	if (str1.length != str2.length)
		return false;

	for (int i = 0; i < str1.length; i++)
		if (str1[i] != str2[i])
			return false;
	
	return true;
}

dchar[] testd( dchar[] input )
{
	if( !isEqual(input[3..5], "rt"))
	{
		return input[1..3];
	}
	return "my";
}

void main()
{
	static x = testd( "hello" );
}

Trickier workarounds might exist
Next ›   Last »
1 2 3 4
Top | Discussion index | About this forum | D home