July 26, 2019
On Thursday, 25 July 2019 at 12:46:48 UTC, Oleg B wrote:
> What reason for such restrictions? It's fundamental idea or temporary implementation?

I think it's a dmd limitation. Currently it has a bug that it can still generate code for ctfe templated functions, and they will fail to link if they use runtime. So yeah, currently betterC really means betterC all the way down. The alternative is to compile without -betterC switch and just use a minimal runtime if you use runtime features, then you have full language in ctfe.
July 26, 2019
On Thursday, July 25, 2019 6:13:38 PM MDT Mike Franklin via Digitalmars-d- learn wrote:
> On Thursday, 25 July 2019 at 18:37:49 UTC, Jonathan M Davis wrote:
> > There's probably at least one bug report on it, but as I understand it, it's not a bug in the sense that the implementation is currently expected to handle such a case. It's an area where betterC should be improved upon, but it would be an enhancement, not a bug fix.
>
> Yes.  The point is that libraries have to be written with betterC and compile-time evaluation in mind.  If they aren't the code is likely not going to work in those use cases.  Much of the code in Phobos was written long before betterC was introduced.
>
> There are probably changes that could be made to Phobos so the OP could get a build, but that requires someone with enough interest in the issue to volunteer their time and talent to improve the implementation for betterC and compile-time use cases.
>
> We have a GSoC student making changes the druntime to help with this matter and I have been picking away at it too.  It will take time and could use more contributors.

I honestly don't see why how the library works should matter for CTFE so long as it's CTFE-able. format creates a string, and mixin then mixes in that string as code. None of that should have any effect on the generated code or what happens at runtime beyond the code that's mixed in. Sure, whether a library can be used with betterC at runtime depends on how the library was implemented, but runtime is a completely different beast from compile time. IMHO, the fact that you can't use format to create a compile-time construct with betterC is purely a problem with dmd's current implementation.

- Jonathan M Davis



July 26, 2019
On Thursday, 25 July 2019 at 14:20:03 UTC, Ali Çehreli wrote:
> On 07/25/2019 05:46 AM, Oleg B wrote:
>> On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote:
>>> Those restrictions don't stop at runtime.
>> 
>> It's vary sad.
>> 
>> What reason for such restrictions? It's fundamental idea or temporary implementation?
>
> It looks like a bug to me.
>
> Ali

If the spec is to be believed then it is.

I filed a bugzilla, https://issues.dlang.org/show_bug.cgi?id=20086
1 2
Next ›   Last »