something like this:
struct S {
// variables...
string doGen(int n) { return ""; }
alias gen = memoize!doGen;
}
The error I got is:
Error: need 'this' for 'doGen' of type 'string(int n)'
I can't make doGen static because it access non-static struct
members... can I workaround this?
On Monday, 25 December 2017 at 10:42:55 UTC, Sobaya wrote:
```
import std.stdio;
int[] x;
void func(scope int[] a) {
x = a;
}
void main() {
func([0,1,2]);
writeln(x);
}
```
This code was successfully compiled and printed '[0, 1, 2]'.
But according to https://dlang.org/spec/funct
On Monday, 25 December 2017 at 15:16:55 UTC, ag0aep6g wrote:
https://dlang.org/phobos/std_typecons.html#Rebindable
Thanks.
On Monday, 25 December 2017 at 20:39:52 UTC, Mengu wrote:
is partially applying templates possible?
Check out std.meta.Apply{Left, Right}.
— David
On Monday, 25 December 2017 at 21:35:18 UTC, visitor wrote:
On Monday, 25 December 2017 at 21:11:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
On Monday, 25 December 2017 at 21:11:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias
tem
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias
template on Tuple or something that will just deconstruct the
On Monday, 25 December 2017 at 17:59:54 UTC, visitor wrote:
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias
template on Tuple or something that will just deconstruct the
On Monday, 25 December 2017 at 20:39:52 UTC, Mengu wrote:
is partially applying templates possible?
template A(X, Y, Z) {}
alias B(X, Y) = A!(X, Y, int);
is partially applying templates possible?
Hi, Is there any blogs that discuss CRTP, or even Policy
based/introspection based design in idiomatic D?
I would love to see the strategies used to tackle the overhead
involving dynamic dispatch by emulating static polymorphism.
Thanks.
On Monday, 25 December 2017 at 10:57:46 UTC, realhet wrote:
Hello,
I'm very well satisfied with the DMD 32bit compiler and the
OptLink linker on Windows. I even made an incremental builder
to it, and I can see the running program in 1 second.
Lately I sadly noticed, that the OptLink works only
On Monday, 25 December 2017 at 16:35:26 UTC, realhet wrote:
Now I have my first DMD 64bit windows console app running. (And
I'm already afraid of the upcoming windowed application haha)
My recommendation for getting setup on Windows with D is as
follows:
1) Install the latest visual studio
On Monday, 25 December 2017 at 17:46:05 UTC, aliak wrote:
On Monday, 25 December 2017 at 16:38:32 UTC, Thomas Mader wrote:
On Monday, 25 December 2017 at 16:22:11 UTC, Mengu wrote:
is it a relative path? if so:
pragma(msg,
__FILE_FULL_PATH__.split("/")[0..$-1].join("/"));
https://run.d
On Monday, 25 December 2017 at 15:03:08 UTC, aliak wrote:
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
I was kind of hoping for some magical D variadic alias template
on Tuple or something that will just deconstruct the arguments
in to tuple components.
i don't think it's bette
On Monday, 25 December 2017 at 16:38:32 UTC, Thomas Mader wrote:
On Monday, 25 December 2017 at 16:22:11 UTC, Mengu wrote:
is it a relative path? if so:
pragma(msg,
__FILE_FULL_PATH__.split("/")[0..$-1].join("/"));
https://run.dlang.io/is/gRUAD6
Nice idea but it is an absolute path. :
Now I have my first DMD 64bit windows console app running. (And
I'm already afraid of the upcoming windowed application haha)
After further fiddling I installed the >>>Visual Cpp tools
2015<<< package that contains a linker with x64 stuff in it
(along with several GB of bloatware).
contents
On Monday, 25 December 2017 at 16:22:11 UTC, Mengu wrote:
is it a relative path? if so:
pragma(msg,
__FILE_FULL_PATH__.split("/")[0..$-1].join("/"));
https://run.dlang.io/is/gRUAD6
Nice idea but it is an absolute path. :-/
On Monday, 25 December 2017 at 16:13:48 UTC, Thomas Mader wrote:
Hello,
I would like to set the path to a directory at compile time but
it doesn't seem to be possible yet.
I tried it with a -version=CustomPath argument and inside the
version statement in the code I tried to read the value fr
Hello,
I would like to set the path to a directory at compile time but
it doesn't seem to be possible yet.
I tried it with a -version=CustomPath argument and inside the
version statement in the code I tried to read the value from the
environment. Sadly this doesn't work because getenv can no
On Monday, 25 December 2017 at 14:49:11 UTC, Nordlöw wrote:
1. Is there a way to express tail-constness on the parameters
https://dlang.org/phobos/std_typecons.html#Rebindable
On Monday, 25 December 2017 at 14:08:08 UTC, Mengu wrote:
since Point is a Tuple and does not have a constructor that
takes a list of integers (int[]), you should have a helper
function.
Aukay :(
I was kind of hoping for some magical D variadic alias template
on Tuple or something that wil
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
Does to!(string)(char[]) do any memory allocation on conversion
or is this similar to a cast or what else?
As said it calls idup, which calls _trustedDup which seems to
call _dup which does memory allocation ->
https://github.com/dlang/
In a graph library I'm working on I have the following algorithm
bool hasContext(Node sub,// TODO in
Node sup) nothrow // TODO in
{
Node curr = sub;
while (true)
{
Node ctx = curr.context;
if (!ctx) { break;}
if (ctx is sup)
retu
On Monday, 25 December 2017 at 14:37:01 UTC, Mengu wrote:
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
Does to!(string)(char[]) do any memory allocation on
conversion or is this similar to a cast or what else?
yes, it is allocating memory. you can test such cases with
@nogc [0].
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
Does to!(string)(char[]) do any memory allocation on conversion
or is this similar to a cast or what else?
yes, it is allocating memory. you can test such cases with @nogc
[0].
you can get a char[] via .dup of a string and then you can
On Monday, 25 December 2017 at 14:37:01 UTC, Mengu wrote:
yes, it is allocating memory. you can test such cases with
@nogc [0].
nogc is really conservative and thus gives a lot of false
positives. I'd just compare instr.ptr is outstr.ptr here and see
if it changes (it will tho)
On Monday, 25 December 2017 at 14:12:32 UTC, Marc wrote:
Does to!(string)(char[]) do any memory allocation on conversion
or is this similar to a cast or what else?
It is translated to idup.
So yes, it allocates memory.
Does to!(string)(char[]) do any memory allocation on conversion
or is this similar to a cast or what else?
On Monday, 25 December 2017 at 12:03:32 UTC, aliak wrote:
Hi, been looking for a way to convert an array to a tuple, but
can't seem to find one. Is there one?
Looking for something like:
alias Point = Tuple!(int, "x", int, "y");
enum data = "1,2:8,9";
auto points = data
.split(':')
.map!(a
On Monday, 25 December 2017 at 11:09:25 UTC, Jonathan M Davis
wrote:
```
import std.stdio;
int[] x;
void func(scope int[] a) {
x = a;
}
void main() {
func([0,1,2]);
writeln(x);
}
```
This code was successfully compiled and printed '[0, 1, 2]'.
But according to https://dlang.
Hi, been looking for a way to convert an array to a tuple, but
can't seem to find one. Is there one?
Looking for something like:
alias Point = Tuple!(int, "x", int, "y");
enum data = "1,2:8,9";
auto points = data
.split(':')
.map!(a => a
.split(',')
.map!(to!int)
)
.map!Point; /
On Monday, December 25, 2017 10:42:55 Sobaya via Digitalmars-d-learn wrote:
> What means 'scope' in function parameter?
>
> I made a test code.
>
> ```
> import std.stdio;
>
> int[] x;
>
> void func(scope int[] a) {
> x = a;
> }
>
> void main() {
> func([0,1,2]);
> writeln(x);
> }
>
On Sunday, 24 December 2017 at 22:17:23 UTC, Luís Marques wrote:
On Saturday, 2 September 2017 at 20:03:48 UTC, Jean-Louis Leroy
wrote:
jll@ORAC:~/dev/d/tests/modules$ tree
.
├── foo
│ └── bar.d
└── foo.d
I think that shouldn't be allowed. You have a package foo, but
use a normal module ins
Hello,
I'm very well satisfied with the DMD 32bit compiler and the
OptLink linker on Windows. I even made an incremental builder to
it, and I can see the running program in 1 second.
Lately I sadly noticed, that the OptLink works only for 32bit
target, and I need to go to 64bit if I want to ha
What means 'scope' in function parameter?
I made a test code.
```
import std.stdio;
int[] x;
void func(scope int[] a) {
x = a;
}
void main() {
func([0,1,2]);
writeln(x);
}
```
This code was successfully compiled and printed '[0, 1, 2]'.
But according to https://dlang.org/spec/fu
36 matches
Mail list logo