On Wednesday, 3 February 2016 at 22:45:47 UTC, Timon Gehr wrote:
I would use enum forceCTFE(alias expr)=expr; though. With alias
it won't force compile-time evaluation of expressions that can
be interpreted as symbols.
I've a code that build a JSON object using a wrapper over
std.json.
On Friday, 5 February 2016 at 09:36:37 UTC, Andrea Fontana wrote:
On Wednesday, 3 February 2016 at 22:45:47 UTC, Timon Gehr wrote:
I would use enum forceCTFE(alias expr)=expr; though. With
alias it won't force compile-time evaluation of expressions
that can be interpreted as symbols.
I've a
On Friday, 5 February 2016 at 09:49:38 UTC, Luis wrote:
Reading/parsing a JSON or a XML using std.json / std.xml could
be done on CTFE ?
parseJSON() from std.json doesn't work with CTFE.
But I can build objects with with my code that works over
std.json.
So if you convert (with mixins)
{
This code:
import std.stdio;
int very_very_long_function(in int k)
{
if (!__ctfe) writeln("Can't use ctfe!");
return k/2;
}
void main()
{
enum first = very_very_long_function(10);
writeln("First is ", first);
auto second = very_very_long_function(12);
On Wednesday, 3 February 2016 at 17:49:39 UTC, Marc Schütz wrote:
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then
optionally copying the value once to avoid the "manifest
constant" copy/paste behaviour, where applicable?
On 02/03/2016 11:39 PM, Andrea Fontana wrote:
On Wednesday, 3 February 2016 at 17:49:39 UTC, Marc Schütz wrote:
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then optionally
copying the value once to avoid the "manifest
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then
optionally copying the value once to avoid the "manifest
constant" copy/paste behaviour, where applicable?
Yes, or static local variables are ctfe initialized too.
On Wednesday, 3 February 2016 at 15:59:43 UTC, Adam D. Ruppe
wrote:
You never asked for CTFE.
CTFE only happens when it *has* to - when you write code that
specifically asks for or requires it.
What is a good way to try to force it? Using enum? Then
optionally copying the value once to
On 03.02.2016 16:34, Andrea Fontana wrote:
void main()
{
enum first = very_very_long_function(10);
writeln("First is ", first);
auto second = very_very_long_function(12);
writeln("Second is ", second);
auto third = first;
third += 1;
On Wednesday, 3 February 2016 at 15:34:51 UTC, Andrea Fontana
wrote:
enum first = very_very_long_function(10);
auto second = very_very_long_function(12);
Why second init doesn't work with CTFE?
You never asked for CTFE.
CTFE only happens when it *has* to - when you write code
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then
optionally copying the value once to avoid the "manifest
constant" copy/paste behaviour, where applicable?
template forceCTFE(alias expr) {
alias forceCTFE = expr;
}
On Wednesday, 3 February 2016 at 17:16:30 UTC, Andrea Fontana
wrote:
But if I want a normal var, not static or enum?
There's no way to force it?
Just make a mutable copy of it, I think.
On Wednesday, 3 February 2016 at 16:24:19 UTC, Adam D. Ruppe
wrote:
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then
optionally copying the value once to avoid the "manifest
constant" copy/paste behaviour, where applicable?
On 2/3/16 12:16 PM, Andrea Fontana wrote:
On Wednesday, 3 February 2016 at 16:24:19 UTC, Adam D. Ruppe wrote:
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then optionally
copying the value once to avoid the "manifest
14 matches
Mail list logo