debug version = DebugOrUnittest;
else version(unittest)version = DebugOrUnittest;
version(DebugOrUnittest) { static
assert(false,"DebugOrUnittest"); }
On 06/10/2014 08:06 PM, Matt wrote:
> On Wednesday, 11 June 2014 at 02:30:01 UTC, WhatMeWorry wrote:
>> int[] array; // initially empty
>> array.length = 5; // now has 5 elements
>>
>> while in Mr. Alexandrescu's book, it says
>>
>> To create a dynamic array, use a new expression (§ 2.3.6.1 on p
On Wednesday, 11 June 2014 at 02:59:40 UTC, Matt wrote:
I previously asked this over in the DigitalMars.D
board(http://forum.dlang.org/thread/huftyrtbomaimuqkm...@forum.dlang.org#post-hrqvqlzzbkgafvjdtjnb:40forum.dlang.org),
but it was suggested I ask it over here instead.
I have the following
On Tuesday, 10 June 2014 at 20:29:56 UTC, FreeSlave wrote:
dmd has -shared option. Try it instead of -L-shared.
I'm getting a similar error:
/usr/bin/ld:
/usr/local/bin/../lib64/libphobos2.a(object__a_58c.o): relocation
R_X86_64_32 against `_D10TypeInfo_m6__initZ' can not be used when
makin
On Wednesday, 11 June 2014 at 02:30:01 UTC, WhatMeWorry wrote:
In Mr. Cehreli's book it says
Additionally, the length of dynamic arrays can be changed by
assigning a value to this property:
int[] array; // initially empty
array.length = 5; // now has 5 elements
while in Mr. Alexandrescu's bo
On Wednesday, 11 June 2014 at 02:30:01 UTC, WhatMeWorry wrote:
In Mr. Cehreli's book it says
Additionally, the length of dynamic arrays can be changed by
assigning a value to this property:
int[] array; // initially empty
array.length = 5; // now has 5 elements
while in Mr. Alexandrescu's bo
In Mr. Cehreli's book it says
Additionally, the length of dynamic arrays can be changed by
assigning a value to this property:
int[] array; // initially empty
array.length = 5; // now has 5 elements
while in Mr. Alexandrescu's book, it says
To create a dynamic array, use a new expression (§
On Tuesday, 10 June 2014 at 20:01:37 UTC, Nordlöw wrote:
Notice that A.init.tupleof segfaults for classes so that is
_not_ an adviced solution in a generic solution!
There's no need to use .init:
import std.stdio;
struct Foo {
int a, b;
}
void main() {
writeln(__traits(id
On Tuesday, 10 June 2014 at 16:13:31 UTC, Adam D. Ruppe wrote:
Two options: do allMembers and filter it out to only be data
members, or do some slicing of tupleof.stringof:
S s;
foreach(idx, member; s.tupleof) {
writeln("Name: ", s.tupleof[idx].stringof[2..$]);
}
The tupleof[idx] inside th
On Monday, 9 June 2014 at 16:13:50 UTC, monarch_dodra wrote:
On Monday, 9 June 2014 at 15:54:21 UTC, Ivan Kazmenko wrote:
I'd expect a "multiple overrides of same function" error, much
like if I just paste the mixin code by hand. Is that a bug or
working by design? In the latter case, please
On Tuesday, 10 June 2014 at 22:00:34 UTC, Ali Çehreli wrote:
http://stackoverflow.com/questions/10758811/c-syntax-for-functions-returning-function-pointers
int (*(*(*f3)(int))(double))(float);
"f3 is a ..."
Ali
f3 is a pointer to a function taking an int returning a pointer
to a function
Either way, it shouldn't be too hard to implement. Base it off
"splitter!pred", which is actually quite trivial. AFAIK, your
What do you mean by basing it off splitter!pred - should I start
with some existing splitter algorithm in Phobos or start from
scratch?
Thx.
On 06/10/2014 01:48 PM, monarch_dodra wrote:
> I am ***INCREDIBLY*** glad D's stance is simply "depth first left to
> right".
I completely agree.
> It *supports* C style, but unless you are copy pasting some C
> code, you'd have to be mad in your head to actually ever use it.
>
> Honestly, try
On Tuesday, 10 June 2014 at 21:26:50 UTC, monarch_dodr
What exactly are you requesting though?
- Split on the "edge" lowercase to uppercase?
- Split on uppercase but keep the uppercase element?
Thinking about this more: Do you *actually* have two different
predicates, or are they mutually excl
On Tuesday, 10 June 2014 at 21:11:17 UTC, Nordlöw wrote:
1. someName => SomeName
My example is dumb and incorrect.
I actually want this to do the following
2. "_someGreatVariableName" => "Some Great Varible Name"
The current splitter works on the notion of splitter "tokens",
eg, it splits
1. someName => SomeName
My example is dumb and incorrect.
I actually want this to do the following
2. "_someGreatVariableName" => "Some Great Varible Name"
I'm missing a version of splitter that can be used to split
ranges based on arbitrary predicates. I need to for conversion
between different symbol casings, typically:
1. someName => SomeName
In this case the lambda should take two arguments (a,b)
where in
1. a should be lowercase and b shou
Is there a way to, programatically (trait), lookup the source
file and position of a user defined type either dynamically or,
even better, statically?
On Tuesday, 10 June 2014 at 20:33:03 UTC, Ali Çehreli wrote:
I think they are actually legal: This is D's support of C-style
array declaration acting the same in alias declaration:
Ali
C-style array declaration has got to be one of C's *worst*
abominations. There's no real *technical* ration
On 06/10/2014 01:18 PM, Tom Browder via Digitalmars-d-learn wrote:
>>> alias int[2] val5[2]; // D: a 2-dimensional array of ints?
(int[2][2])
>>> ?
>>
>> Pretty strange. :)
>>
>> pragma(msg, val5);
>>
>> outputs this:
>>
>> int[2][2]
>
> Okay, checks with my guess.
>
>>> alias int[4] v
dmd has -shared option. Try it instead of -L-shared.
Hi guys,
I've the following few lines:
module test;
export:
extern(D):
int test()
{
return 0;
}
... and compile it using the following line:
dmd -m64 -fPIC -L-shared test.d -oflibtest.so
But when I try to compile it, I always get the following error:
/usr/bin/ld:
/usr/lib/gcc/x8
On Tuesday, 10 June 2014 at 17:29:35 UTC, Dicebot wrote:
On Tuesday, 10 June 2014 at 16:10:09 UTC, Nordlöw wrote:
Is there a way to iterate over the symbolic names of the data
members of a class instance?
I'm currently using .tupleof to get its values (and in turn
types) to implement pretty
BTW: Can DMD serve use file and line location of user defined
type aswell?
Thx!
Correction: I mean serve *us*
I am not sure I understand the question. Does this help?
struct A
{
int x;
double y;
}
void main()
{
foreach (idx, elem; A.init.tupleof)
{
pragma(msg, __traits(identifier, A.tupleof[idx]));
}
}
// output:
// x
// y
Exactly what I wanted!
I haven't found a detailed description of simple aliases. TPDL shows
aliases of this form:
alias TYPE NAME;
with some complex examples of D types aliased to a simpler name.
The D lang web site language reference says nothing about aliases
(except as it's described in the grammar), and the D l
On Tuesday, 10 June 2014 at 16:10:09 UTC, Nordlöw wrote:
Is there a way to iterate over the symbolic names of the data
members of a class instance?
I'm currently using .tupleof to get its values (and in turn
types) to implement pretty printing to multiple backends
(currently testing HTML) u
On Tuesday, 10 June 2014 at 16:30:52 UTC, Nordlöw wrote:
What trait should I use to filter out data members?
No trait, more like an is thing to see if the thing has an init.
I think
static if(is(typeof(__traits(getMember, Thing, name).init)) { }
will do it. (BTW the sample chapter of my boo
Also I have additional question to this post.
6. If I would convert my repo to git, but use anather hosting
that github.org for example my own local server or bitbucket.org.
How could I specify source for loading dependencies? This is
unclear from dub documentation. Is it a tool for working wit
On Tuesday, 10 June 2014 at 16:13:31 UTC, Adam D. Ruppe wrote:
Two options: do allMembers and filter it out to only be data
members, or do some slicing of tupleof.stringof:
What trait should I use to filter out data members?
S s;
foreach(idx, member; s.tupleof) {
writeln("Name: ", s.tupleo
On Tue, 10 Jun 2014 17:06:08 +0200, Artur Skawina via Digitalmars-d-learn
wrote:
> On 06/10/14 02:28, Byron via Digitalmars-d-learn wrote:
>> Should this work? It seems like the short circuit booleans are not
>> working:
>>
>> enum isPrimitive(T) = isBasicType!T || (isArray!T && isBasicType!
>>
Two options: do allMembers and filter it out to only be data
members, or do some slicing of tupleof.stringof:
S s;
foreach(idx, member; s.tupleof) {
writeln("Name: ", s.tupleof[idx].stringof[2..$]);
}
The tupleof[idx] inside the loop is important instead of just
using member because then y
Is there a way to iterate over the symbolic names of the data
members of a class instance?
I'm currently using .tupleof to get its values (and in turn
types) to implement pretty printing to multiple backends
(currently testing HTML) using as much of D's compile time
reflection as possible:
Hello, has anyone used this https://github.com/andersonpd/decimal
implementation?
I'm learning D and want to know where to start for the decimal
(or bigfloat) stuff.
The goal is to be able to read and write some data from a SQL DB
with a decimal(10,2) field.
On 06/10/14 02:28, Byron via Digitalmars-d-learn wrote:
> Should this work? It seems like the short circuit booleans are not
> working:
>
> enum isPrimitive(T) = isBasicType!T || (isArray!T && isBasicType!
> (ForeachType!T));
[...]
> But this style works:
>
> template isPrimitive(T)
> {
>
Juanjo Alvarez:
Probably I pretty simple question, how could I mark some code
to be compiled when in debug OR unittest mode? (or both, ||)
Regarding your latest ER, Walter is usually not fond of such
ideas. I have seen many similar ideas being shot down.
Bye,
bearophile
On 10/06/14 16:06, bearophile wrote:
You can define a enum boolean value in the version unittest block, and
another inside the debug {} else {}. And then you can use "if (b1 || b2)
{ ... }".
"static if" is probably what's needed.
--
/Jacob Carlborg
Juanjo Alvarez:
Probably I pretty simple question, how could I mark some code
to be compiled when in debug OR unittest mode? (or both, ||)
At first I tough I could do:
version(unittest, debug) {}
You can define a enum boolean value in the version unittest
block, and another inside the debu
Hi,
Probably I pretty simple question, how could I mark some code to
be compiled when in debug OR unittest mode? (or both, ||)
At first I tough I could do:
version(unittest, debug) {}
but this doesn't work.
Then I tried to define a new version:
version(DebugOrUnittest)
{
version = debug;
I have web-application project in D language hosted on
bitbucket.org. So I using Mercurial repository. I exactly have
two *logical* projects but currently they are in one repo. The
first is my library that includes not only D code, but also some
resources like HTML-page templates (not compiled
40 matches
Mail list logo