On Thursday, 30 May 2013 at 20:49:53 UTC, Steven Schveighoffer
wrote:
It's actually 4. separate compilation model.
If you are building a module, and it imports a d interface file
which has no function body, there is no conceivable way to tell
what the attributes should be.
For anonymous fu
Hi,
I wonder if there are any plans to allow automatic inference of
function attributes. I think it's a big hassle having to pollute
function declarations with things like @safe, nothrow, pure, etc.
let alone rembering them all.
I know this is done for anonymous functions on a best effort
bas
On Thursday, 16 May 2013 at 15:34:54 UTC, Simen Kjaeraas wrote:
This is one of those weird things. I believe it is intentional,
but
I feel it should be a bug. Basically, overload sets cannot cross
mixin borders. So if two mixins create a function with the same
name,
they don't overload prope
I aim to use a simplistic, rough edged property generator, but
I'm having issues.
See http://dpaste.dzfl.pl/72837a7a.
My code and mixin logic seems to work basically, but it gets
hairy when using mixinMap to generate getters and setters from a
list in a recursive template fashion. It won't work if
On Monday, 29 April 2013 at 16:39:21 UTC, bearophile wrote:
I think there isn't something like that in Phobos (I can't be
fully sure because std.algorithm and std.range contain lot of
powerful stuff, and it's not easy to know every possible
combination of them).
So I think you should use zi
Hi,
is there any way to to something like
auto arr = [1,2,3,4,5];
auto delta = arr.lookahead!"b-a"(1); // or probably pass 1 as
template arg
assert(equal(delta[], [1,1,1,1][]);
or like
// lookahead returns range of tuples (template arg) or arrays
(runtime arg)
foreach (
On Wednesday, 24 April 2013 at 22:29:55 UTC, Ali Çehreli wrote:
On Wednesday, 24 April 2013 at 21:36:48 UTC, Sebastian Graf
wrote:
Seems to me that dmd doesn't do NRVO (?), see the issue.
I can see that NRVO would be faster than the extra bit-copy.
Especially the last one of the foll
On Wednesday, 24 April 2013 at 20:53:11 UTC, Ali Çehreli wrote:
First, as the local 's' in makeS() is local, it cannot be
returned by ref. So, the 'auto ref' return type of makeS()
becomes by-value.
However, rvalues are never copied in D. The compiler
automatically moves the bits of the rva
For this program:
import std.stdio;
struct S
{
ubyte* b;
ubyte buf[128];
this(this)
{
writeln("postblit");
}
}
auto ref makeS()
{
S s;
s.b = s.buf;
writeln("made S at ", cast(void*)&s, ", s.b ==
Hi,
I wonder why I can't use Algebraic like this:
struct Foo(bool flag)
{
size_t bar() { return flag ? 42 : 0; }
}
Foo!false f;
Foo!true t;
Algebraic!(typeof(t), typeof(f)) v;
v = t;
Variant i = v.bar(); // or an Algebraic of the return types.
This doesn
On Saturday, 6 April 2013 at 15:38:55 UTC, Tobias Pankrath wrote:
Is there however some way to generate that switch with cases
for each enum member in a template, so that each case calls
(Machine)() instantiated with the
appropriate enum member? I know you could do it with string
mixins, but
On Friday, 5 April 2013 at 18:00:56 UTC, bearophile wrote:
Sebastian Graf:
I wonder if there is a good way to dry up this:
I suggest to improve that code a lot.
For machineWord there is:
alias machineWord = Select!(machine == Machine.I386, uint,
ulong);
This:
(1 << 32)
Gives:
Hi,
I wonder if there is a good way to dry up this:
enum Machine
{
I386,
AMD64
// , ...
}
template machineWord(Machine machine)
{
static if (machine == Machine.I386)
{
alias machineWord = uint;
}
static if (
13 matches
Mail list logo