January 29, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On 1/25/17 4:44 PM, Stefan Koch wrote:
> On Wednesday, 25 January 2017 at 15:26:39 UTC, jmh530 wrote:
>> On Wednesday, 25 January 2017 at 12:36:02 UTC, Stefan Koch wrote:
>>> newCTFE is green now on all platforms!
>>
>> Congrats.
>>
>> How much work remains?
>
> Quite a lot.
>
> - Slicing
> - Appending
> - ||
> - String support (implying utf conversions)
> - Floating-Point
>
> - classes
> - exceptions
> - function pointers
> - closures
>
> and
>
> proper handling of more complex types
> such as arrays of structures
Will note that std.regex will requires at least basic support for classes (construct and return from a function) and slicing.
---
Dmitry Olshansky
|
January 29, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Sunday, 29 January 2017 at 13:18:11 UTC, Dmitry Olshansky wrote:
> Essentially this:
>
> foreach(dchar ch; some_string){ ... }
>
> Becomes:
>
> import std.utf;
> size_t i=0;
> while(i<some_string.length){
> dchar ch = decode(some_string, i);
> ...
> }
>
> ---
> Dmitry Olshansky
Won't work right now, since ref is not supported.
Also I really want to minimize dependency and phobos.
|
January 29, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Sunday, 29 January 2017 at 13:21:47 UTC, Dmitry Olshansky wrote:
> On 1/25/17 4:44 PM, Stefan Koch wrote:
>> On Wednesday, 25 January 2017 at 15:26:39 UTC, jmh530 wrote:
>>> On Wednesday, 25 January 2017 at 12:36:02 UTC, Stefan Koch wrote:
>>>> newCTFE is green now on all platforms!
>>>
>>> Congrats.
>>>
>>> How much work remains?
>>
>> Quite a lot.
>>
>> - Slicing
>> - Appending
>> - ||
>> - String support (implying utf conversions)
>> - Floating-Point
>>
>> - classes
>> - exceptions
>> - function pointers
>> - closures
>>
>> and
>>
>> proper handling of more complex types
>> such as arrays of structures
>
> Will note that std.regex will requires at least basic support for classes (construct and return from a function) and slicing.
>
> ---
> Dmitry Olshansky
I can support non-polymorphic classes in near future (mid of march ?).
Slicing needs to be considered together with concatenation esentially it will require a memory-manager.
I still need to figure out if druntime could be reused here.
|
January 30, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | New bugs incoming: uint fn(uint a) { final switch(a) { case 1 : { while(a < 20) // bool whileCondition; // WhileBlockEvalCond : // whileCondition = (a < 20); { // WhileBlockBegin: a++; if (a == 17) break; /* WhlieBlockEnd: if(!whileCondition) goto WhileBlockAfter // break seems to go here :-/ goto WhileBlockEvalCond; // break should go here! */ } // WhileBlockAfter: return a; } } return 1; } pragma(msg, fn(1)); // should print 17 when executed with with newCTFE this will print 20 |
January 31, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Monday, 30 January 2017 at 15:15:55 UTC, Stefan Koch wrote:
> New bugs incoming:
>
> uint fn(uint a)
> {
> final switch(a)
> {
> case 1 : {
>
> while(a < 20)
> // bool whileCondition;
> // WhileBlockEvalCond :
> // whileCondition = (a < 20);
> {
> // WhileBlockBegin:
> a++;
> if (a == 17) break;
> /*
> WhlieBlockEnd:
> if(!whileCondition)
> goto WhileBlockAfter
> // break seems to go here :-/
> goto WhileBlockEvalCond;
> // break should go here!
> */
> }
> // WhileBlockAfter:
> return a;
> }
> }
>
> return 1;
> }
>
> pragma(msg, fn(1)); // should print 17
> when executed with with newCTFE this will print 20
This bug is fixed now!!
it was a simple oversight were the mechanism I build to deal with this was simply not invoked.
Luckily not a failure of the mechanism itself.
|
January 31, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | newCTFE is now green on all platforms on travis as well. function pointer support are coming! with it most of std.algorithm will be supported. |
January 31, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Tuesday, 31 January 2017 at 16:21:27 UTC, Stefan Koch wrote:
> newCTFE is now green on all platforms on travis as well.
>
> function pointer support are coming!
> with it most of std.algorithm will be supported.
Cool!
|
February 01, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Tuesday, 31 January 2017 at 16:21:27 UTC, Stefan Koch wrote:
> function pointer support is coming!
This is more difficult then I expected,
since the argument handling system was build without considering that we could have functions as arguments, therefore when trying to evaluate the function-argument it will overwrite the data-structures that are supposed to hold the information for the function we currently processing the arguments for.
As you can imagine this bug took me two days to find :)
maybe this can be fixed by handling the arguments before handling the function itself.
|
February 03, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Wednesday, 1 February 2017 at 11:53:09 UTC, Stefan Koch wrote:
> On Tuesday, 31 January 2017 at 16:21:27 UTC, Stefan Koch wrote:
>> function pointer support is coming!
>
> This is more difficult then I expected,
> since the argument handling system was build without considering that we could have functions as arguments, therefore when trying to evaluate the function-argument it will overwrite the data-structures that are supposed to hold the information for the function we currently processing the arguments for.
>
> maybe this can be fixed by handling the arguments before handling the function itself.
I have not fixed the bug with top-level function arguments yet,
However I have enabled function-pointer support for non-toplevel use
such as in :
int[] filterBy(int[] arr , bool function(uint) fn)
{
int[] result;
uint resultLength;
result.length = arr.length;
foreach(i;0 .. arr.length)
{
auto e = arr[i];
bool r = true;
r = fn(e);
if(r)
{
result[resultLength++] = e;
}
}
int[] filterResult;
filterResult.length = resultLength;
foreach(i; 0 .. resultLength)
{
filterResult[i] = result[i];
}
return filterResult;
}
bool isDiv2(uint e)
{
bool result_;
result_ = (e % 2 == 0);
return result_;
}
bool isNotDiv2(uint e)
{
bool result_;
result_ = (e % 2 != 0);
return result_;
}
int[] run(int[] arr, bool div2)
{
return filterBy(arr, div2 ? &isDiv2 : &isNotDiv2);
}
static assert(run([3,4,5], true) == [4]);
static assert(run([3,4,5], false) == [3,5]);
//static assert(filterBy([3,4,5], &isDiv2) == [4]);
// top-level function arguments do currently not work with newCTFE
Enjoy!
|
February 04, 2017 Re: CTFE Status | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | std.conv.to is no longer blacklisted. since I now bail on every string foreach. As soon as ctfeable utf-conversion functions are in place, newCTFE can be used for fast low-memory overhead comptiletime parsing. |
Copyright © 1999-2021 by the D Language Foundation