On Sunday, 7 April 2019 at 03:32:45 UTC, Alex wrote:
just execute them at CT if possible(and the possibility simply
is if the inputs are known at CT).
imho, Bastiaan Veelo want to say about citate above: not just "if
possible", but "only if needed and possible"
On Sunday, 7 April 2019 at 05:36:27 UTC, Vladimir Panteleev wrote:
On Sunday, 7 April 2019 at 05:24:38 UTC, Alex wrote:
Error: template instance `Reflect!(type)` cannot use local
`type` as parameter to non-global template `Reflect(Ts...)()`
mixin(`import `~moduleName!(T)~`;`);
mixin(`alias
On Sunday, 7 April 2019 at 05:24:38 UTC, Alex wrote:
Error: template instance `Reflect!(type)` cannot use local
`type` as parameter to non-global template `Reflect(Ts...)()`
mixin(`import `~moduleName!(T)~`;`);
mixin(`alias X = T.`~name~`;`);
super.Reflect!(X);
I realize X
On Sunday, 7 April 2019 at 05:24:38 UTC, Alex wrote:
Error: template instance `Reflect!(type)` cannot use local
`type` as parameter to non-global template `Reflect(Ts...)()`
mixin(`import `~moduleName!(T)~`;`);
mixin(`alias X = T.`~name~`;`);
super.Reflect!(X);
I realize X
Error: template instance `Reflect!(type)` cannot use local `type`
as parameter to non-global template `Reflect(Ts...)()`
mixin(`import `~moduleName!(T)~`;`);
mixin(`alias X = T.`~name~`;`);
super.Reflect!(X);
I realize X is local but I'm trying to figure out why it can't be
Is there any way to get sequences of sequences?
Using RT, I have to use strings
[[`string`, `0`], ...]
when it would be much better to use
[[string, 0], ...]
Ideally it wouldn't add so much overhead that it defeats the
purpose.
On Saturday, 6 April 2019 at 13:03:31 UTC, Adam D. Ruppe wrote:
On Saturday, 6 April 2019 at 12:20:28 UTC, Alex wrote:
static foreach (f; typeof(__traits(getOverloads, T, m)))
Why are you using typeof here?
I don't know, I want to say I copied that code from somewhere but
it might have been
On Saturday, 6 April 2019 at 14:59:18 UTC, ag0aep6g wrote:
On 06.04.19 16:19, Alex wrote:
That is CTFE is CT RTFE where runtime functions are executed
at compile time when the inputs are CT.
You may have the right idea, but the last part of that sentence
is wrong/misleading. CTFE happens when
Le 06/04/2019 à 21:47, lithium iodate via Digitalmars-d-learn a écrit :
On Saturday, 6 April 2019 at 15:35:22 UTC, diniz wrote:
So, I still could store and use and compare string pointers myself [1], and
get valid results, meaning: pointer equality implies (literal) string
equality. Or am I wro
On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:
I have a C interface that uses a parameter of type intptr_t.
Wondering if size_t is the correct D equivalent?
The correct equivalent is `intptr_t` from `core.stdc.stdint`.
On Saturday, 6 April 2019 at 12:06:22 UTC, Robert M. Münch wrote:
The idea is, that I can write a string (or maybe even a scope
block?) in my DSL and use a CTFE grammer to transpile the code.
Are you aware of Pegged[1]? It’s for exactly that.
[1] http://code.dlang.org/packages/pegged
On Saturday, 6 April 2019 at 19:31:15 UTC, Robert M. Münch wrote:
I have a C interface that uses a parameter of type intptr_t.
Wondering if size_t is the correct D equivalent?
I suppose, ptrdiff_t is.
https://dlang.org/spec/type.html#ptrdiff_t
https://dlang.org/spec/portability.html#32_to_64bi
On Saturday, 6 April 2019 at 15:35:22 UTC, diniz wrote:
So, I still could store and use and compare string pointers
myself [1], and get valid results, meaning: pointer equality
implies (literal) string equality. Or am I wrong? The point is,
the parser, operating on an array of prescanned lexeme
I have a C interface that uses a parameter of type intptr_t. Wondering
if size_t is the correct D equivalent?
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
On Saturday, 6 April 2019 at 18:08:31 UTC, Mek101 wrote:
On Saturday, 6 April 2019 at 17:44:25 UTC, Nicholas Wilson
wrote:
Hmm,
import std.traits;
class WeightedRandom(T, W = float) if(isNumeric!W)
{
// Fields
private W[T] _pairs;
// The total sum of all the weights;
On Saturday, 6 April 2019 at 17:44:25 UTC, Nicholas Wilson wrote:
Hmm,
import std.traits;
class WeightedRandom(T, W = float) if(isNumeric!W)
{
// Fields
private W[T] _pairs;
// The total sum of all the weights;
private W _probabilities;
/// Code...
On Saturday, 6 April 2019 at 17:30:45 UTC, Mek101 wrote:
I'm rewriting from C# a small library of mine to practice with
D.
I have a class:
class WeightedRandom(T, W = float) if(isNumeric!W)
{
// Fields
private W[T] _pairs;
// The total sum of all the weights;
I'm rewriting from C# a small library of mine to practice with D.
I have a class:
class WeightedRandom(T, W = float) if(isNumeric!W)
{
// Fields
private W[T] _pairs;
// The total sum of all the weights;
private W _probabilities;
/// Code...
}
An
Le 06/04/2019 à 16:07, AltFunction1 via Digitalmars-d-learn a écrit :
On Friday, 5 April 2019 at 14:49:50 UTC, diniz wrote:
Hello,
Since literal strings are interned (and immutable), can I count on the fact
that they are compared (==) by pointer?
No. "==" performs a full array comparison and
On 06.04.19 16:19, Alex wrote:
That is CTFE is CT RTFE where runtime functions are executed at compile
time when the inputs are CT.
You may have the right idea, but the last part of that sentence is
wrong/misleading. CTFE happens when the result is required at CT. The
inputs must be available
Thanks alot everyone for your replies, this makes sense now.
On Saturday, 6 April 2019 at 12:06:22 UTC, Robert M. Münch wrote:
I like the idea of DSL which are transpiled into the target
language that gets compiled or are interpreted at run-time.
Since D is compiled, I would like to transpile the DSL to D at
compile-time.
The idea is, that I can write
On Saturday, 6 April 2019 at 12:06:22 UTC, Robert M. Münch wrote:
I like the idea of DSL which are transpiled into the target
language that gets compiled or are interpreted at run-time.
Since D is compiled, I would like to transpile the DSL to D at
compile-time.
The idea is, that I can write
On Friday, 5 April 2019 at 14:49:50 UTC, diniz wrote:
Hello,
Since literal strings are interned (and immutable), can I count
on the fact that they are compared (==) by pointer?
No. "==" performs a full array comparison and "is" is apparently
simplified at compile time. In the compiler there'
On Saturday, 6 April 2019 at 13:34:06 UTC, faissaloo wrote:
ComponentChild is a derived class of Component.
This means it is not a Component*.
new X returns a pointer if X is a struct, but for classes, it is
not.
Are objects automatically assumed to be pointers?
Yeah, for classes.
On 07/04/2019 2:34 AM, faissaloo wrote:
Are objects automatically assumed to be pointers?
It is a reference. Which is a fancy way of saying pointer under the hood.
Just don't do pointer arithmetic with it ;)
Object* means a pointer to a class object reference. Which isn't what
you were inten
I have the following function
static Component* constructComponent(int value) {
return (new ComponentChild(value));
}
ComponentChild is a derived class of Component.
However, I get told that ComponentChild cannot be converted to
Component*. I'm confused here, doe
On Saturday, 6 April 2019 at 12:20:28 UTC, Alex wrote:
static foreach (f; typeof(__traits(getOverloads, T, m)))
Why are you using typeof here?
probably 90% of the mixins are of the form
mixin(`Protection = __traits(getProtection,
(`~T.stringof~`).`~name~`);`);
Try following this rule:
N
On Friday, 5 April 2019 at 15:38:18 UTC, Adam D. Ruppe wrote:
BTW `T.stringof` is usually a bug waiting to happen. You are
using mixin in a lot of places where you shouldn't be and this
is going to lead to name conflicts, import problems, and more.
Just use `T`.
If you need a member, use __tr
I like the idea of DSL which are transpiled into the target language
that gets compiled or are interpreted at run-time. Since D is compiled,
I would like to transpile the DSL to D at compile-time.
The idea is, that I can write a string (or maybe even a scope block?)
in my DSL and use a CTFE gr
30 matches
Mail list logo