On 08/27/2016 07:35 PM, cy wrote:
When I saw `auto a = b;` at the module level, I thought that b had to be
something you could evaluate at compile time.
That's right.
But I guess it can be a
runtime calculated value, acting like it was assigned in a a static
this() clause,
No, that's not ri
On Saturday, 27 August 2016 at 17:47:33 UTC, Dicebot wrote:
But actual value of that Regex struct is perfectly known during
compile time. Thus it is possible and fine to use it as
initializer. You can use any struct or class as initializer if
it can be computed during compile-time.
Yes, regex
On Saturday, 27 August 2016 at 17:35:04 UTC, cy wrote:
On Wednesday, 24 August 2016 at 05:29:57 UTC, ag0aep6g wrote:
The plain regex function doesn't have such a requirement. It
also works with a pattern that's generated at run time, e.g.
from user input. But you can use it with a compile time
On Wednesday, 24 August 2016 at 05:29:57 UTC, ag0aep6g wrote:
The plain regex function doesn't have such a requirement. It
also works with a pattern that's generated at run time, e.g.
from user input. But you can use it with a compile time
constant, too. And it works in CTFE then, but it does n
On Wednesday, 24 August 2016 at 05:29:57 UTC, ag0aep6g wrote:
On 08/24/2016 03:07 AM, cy wrote:
Then what's ctRegex in there for at all...?
Optimization.
ctRegex requires that the pattern is available as a compile
time constant. It uses that property to "generate optimized
native machine co
On 08/24/2016 03:07 AM, cy wrote:
Then what's ctRegex in there for at all...?
Optimization.
ctRegex requires that the pattern is available as a compile time
constant. It uses that property to "generate optimized native machine code".
The plain regex function doesn't have such a requirement.
On Tuesday, 23 August 2016 at 04:51:19 UTC, ag0aep6g wrote:
That's true, and apparently `regex("foobar")` can be evaluated
at compile time.
Then what's ctRegex in there for at all...?
On 08/23/2016 06:06 AM, cy wrote:
On Sunday, 21 August 2016 at 21:18:11 UTC, ag0aep6g wrote:
I may be missing the point here, but just putting `auto pattern =
regex("foobar");` at module level works for me.
Really? I thought global variables could only be initialized with static
stuff availab
On Sunday, 21 August 2016 at 21:18:11 UTC, ag0aep6g wrote:
I may be missing the point here, but just putting `auto pattern
= regex("foobar");` at module level works for me.
Really? I thought global variables could only be initialized with
static stuff available during compile time, and you ne
On 08/21/2016 10:06 PM, cy wrote:
in the module scope, you start with:
auto pattern = ctRegex!"foobar";
and you substitute with:
typeof(regex("")) pattern;
static this() {
pattern = regex("foobar");
}
I may be missing the point here, but just putting `auto pattern =
regex("foobar");` at mod
At seconds PER (character range) pattern, ctRegex slows down
compilation like crazy, but it's not obvious how to avoid using
it, since Regex(Char) is kind of weird for a type. So, here's
what I do. I think this is right.
in the module scope, you start with:
auto pattern = ctRegex!"foobar";
an
11 matches
Mail list logo