So, does anyone want to take up the challenge of writing such a
function that can safely get the function body? I guess D
CTFE'able D parser would be required and basically use what I've
given above. I've seen a few lexers around but not messed with
them.
This will at least fill in a gap.
On Saturday, 28 July 2018 at 14:59:31 UTC, Robert M. Münch wrote:
Hi, I'm seeking for ideas/comments/experiences how to best
implement a DSL in D.
What I would like to do is something like this:
... my D code ...
my-dsl {
... my multi-line DSL code ...
On Thursday, 26 July 2018 at 13:27:09 UTC, Alex wrote:
On Thursday, 26 July 2018 at 11:54:39 UTC, Mr.Bingo wrote:
The string itself could be useful however... Whatever OP has
in mind with this string...
Having a code block is useful in many ways simply because not
having it is the most
On Thursday, 26 July 2018 at 10:20:04 UTC, Alex wrote:
On Thursday, 26 July 2018 at 07:32:19 UTC, Mr.Bingo wrote:
If all you need is the string you can write a template
function that imports the file and searches for the function
and returns it's body.
It's not very robust but it can work
On Tuesday, 24 July 2018 at 04:43:33 UTC, Guillaume Lathoud wrote:
Hello,
__traits and std.traits already offer access to function
information like input parameters, e.g. in std.traits:
ParameterIdentifierTuple ParameterStorageClassTuple
Even if that might sound strange, is there a compile
On Wednesday, 4 July 2018 at 15:47:25 UTC, JN wrote:
Imagine I have a very short-lived class:
void print(File f)
{
PrinterManager pm = new PrinterManager();
pm.print(f);
}
My understanding is that PrinterManager will be GC allocated,
and when it goes out of scope, the GC will possibly
The problem is that it seems that when one has a parameterized
type, you must completely specify the parameters when using
Algebraic,
Algebraic!(T, Vector!int, Vector!(double, 3), Vector!(double, 3),
...)[] data;
to be able to encapsulate an Algebraic on Vector(as a collection
of all fixed
I'm trying to create a vector of vectors(more general than
vectors or matrices).
The idea is that a Vector can contain another Vector or another
type. Vector can be specified to be fixed in length or dynamic
for efficiency. Vector!(T, N) creates a vector of leaf type T and
length N. If N =
On Thursday, 28 June 2018 at 18:03:09 UTC, Ali Çehreli wrote:
On 06/28/2018 10:00 AM, Mr.Bingo wrote:
> But is this going to be optimized?
Not our job! :o)
> That is, a tuple is a range!
Similar to the array-slice distinction, tuple is a container,
needing its range.
> It is clearly easy
On Thursday, 28 June 2018 at 16:02:59 UTC, Alex wrote:
On Thursday, 28 June 2018 at 14:35:33 UTC, Mr.Bingo wrote:
Seems like it would unify things quite a bit.
Yeah... this is, because you can't popFront on a tuple, as the
amount of entries is fixed. You can, however, popFront on every
Seems like it would unify things quite a bit.
import std.typecons, std.range, std.array, std.algorithm,
std.stdio;
void main()
{
auto t = tuple(3,4,5,6);
//auto t = [3,4,5,6];
writeln(t.map!(a => 3*a).sum());
}
On Monday, 25 June 2018 at 14:41:28 UTC, rikki cattermole wrote:
Let me get this straight, you decided to max out your memory
address space /twice over/ before you hit run time, and think
that this would be a good idea?
Well, that cause was suppose to allocate a dynamic array instead
of a
On Monday, 25 June 2018 at 13:58:54 UTC, aliak wrote:
On Monday, 25 June 2018 at 13:37:01 UTC, Mr.Bingo wrote:
One can overload assignment and dispatch so that something like
A.x = ... is valid when x is not a typical member but gets
resolved by the above functions.
Therefore, I can create
import std.stdio;
union Vector(T, size_t N = size_t.max)
{
import std.range, std.typecons, std.meta, std.algorithm,
std.conv, std.math;
static if (N == size_t.max) // For size_t.max sets N to be
infinite/dynamic;
{
mixin("Tuple!("~"T,".repeat(N).join()~") data;");
One can overload assignment and dispatch so that something like
A.x = ... is valid when x is not a typical member but gets
resolved by the above functions.
Therefore, I can create a member for assignment. How can I create
a member for getting the value?
A.x = 3; // Seems to get
On Monday, 25 June 2018 at 10:49:26 UTC, Simen Kjærås wrote:
On Monday, 25 June 2018 at 09:36:45 UTC, Martin Tschierschke
wrote:
I am not sure that I understood it right, but there is a way
to detect the status of a parameter:
My question was different, but I wished to get a ctRegex! or
On Monday, 25 June 2018 at 07:02:24 UTC, Jonathan M Davis wrote:
On Monday, June 25, 2018 05:47:30 Mr.Bingo via
Digitalmars-d-learn wrote:
The problem then, if D can't arbitrarily use ctfe, means that
there should be a way to force ctfe optionally!
If you want to use CTFE, then give an enum
On Monday, 25 June 2018 at 05:14:31 UTC, Jonathan M Davis wrote:
On Monday, June 25, 2018 05:03:26 Mr.Bingo via
Digitalmars-d-learn wrote:
The compiler should be easily able to figure out that foo(3)
can be precomputed(ctfe'ed) and do so. It can already do this,
as you say, by forcing enum
On Sunday, 24 June 2018 at 20:03:19 UTC, arturg wrote:
On Sunday, 24 June 2018 at 19:10:36 UTC, Mr.Bingo wrote:
On Sunday, 24 June 2018 at 18:21:09 UTC, rjframe wrote:
On Sun, 24 Jun 2018 14:43:09 +, Mr.Bingo wrote:
let is(CTFE == x) mean that x is a compile time constant.
CTFE(x)
On Sunday, 24 June 2018 at 18:21:09 UTC, rjframe wrote:
On Sun, 24 Jun 2018 14:43:09 +, Mr.Bingo wrote:
let is(CTFE == x) mean that x is a compile time constant.
CTFE(x)
converts a x to this compile time constant. Passing any
compile time
constant essentially turns the variable in to a
let is(CTFE == x) mean that x is a compile time constant. CTFE(x)
converts a x to this compile time constant. Passing any compile
time constant essentially turns the variable in to a compile time
constant(effectively turns it in to a template with template
parameter)
void foo(size_t i)
{
On Monday, 18 June 2018 at 09:10:59 UTC, rikki cattermole wrote:
On 18/06/2018 9:03 PM, Mr.Bingo wrote:
In the code I posted before about CRC, sometimes I get a
visibility error for some modules. I would like to be able to
filter those out using traits. Is there any way to determine
if a
In the code I posted before about CRC, sometimes I get a
visibility error for some modules. I would like to be able to
filter those out using traits. Is there any way to determine if a
module is visible/reachable in the current scope?
The modules that are causing the problems are imported
I got tired of waiting for a solution and rolled my own:
static this()
{
import std.meta, std.stdio;
// Find all ___This functions linked to this module
auto Iterate()()
{
string[string] s;
void Iterate2(alias m, int depth =
I have static this scattered throughout. Some are module static
this and some are struct and class.
In a test case I have reduced to a struct that uses a static this
and I get a cycle... even though, of course, the static this does
nothing accept internal things.
It is very annoying to
25 matches
Mail list logo