I'm using the myAssert() suggested by others in the D forum, with
a few tweaks:
void myAssert(int line = __LINE__, string file = __FILE__,
Args...)(lazy bool condition, lazy Args args) {
string string_version_of_condition = //? how?
if (!condition)
{
writefln("Assertion (%s) f
On 31-8-2013 4:08, maarten van damme wrote:
the entry :
http://rosettacode.org/wiki/File_IO
is wrong because as stated by the asignment : "In this task, the job is to create a file called
"output.txt", and place in it the contents of the file "input.txt", /via an intermediate
variable.//"/
/
/
On Saturday, 31 August 2013 at 01:42:43 UTC, bearophile wrote:
I have added a D entry for the "Go Fish" game:
hmm there's too much text output, it makes following the game
hard, and seeing what the computer drew means you can cheat!
But I think it plays correctly, I was able to finish a game
the entry :
http://rosettacode.org/wiki/File_IO
is wrong because as stated by the asignment : "In this task, the job is to
create a file called "output.txt", and place in it the contents of the file
"input.txt", *via an intermediate variable.**"*
*
*
there is no intermediate variable; I don't know
I have added a D entry for the "Go Fish" game:
http://rosettacode.org/wiki/Go_Fish#D
I don't know the Go Fish game, so I am not sure this code is
correct. Is some of you able and willing to test its play a bit?
(This D entry is very Python-style because it's a translation of
the Python entry
On 30/08/13 23:51, bearophile wrote:
Perhaps can shorten that code writing a hasMembers helper (and I suggest to keep
those names sorted)
Nice thought, I might look into that at some point. :-)
Joseph Rushton Wakeling:
static if (!__traits(hasMember, G, "directed") ||
!__traits(hasMember, G, "edge") ||
!__traits(hasMember, G, "edgeCount") ||
!__traits(hasMember, G, "vertexCount") ||
!__traits(hasMember, G, "isEdge") ||
On Fri, Aug 30, 2013 at 11:51:37PM +0200, bearophile wrote:
> Joseph Rushton Wakeling:
>
> >static if (!__traits(hasMember, G, "directed") ||
> > !__traits(hasMember, G, "edge") ||
> > !__traits(hasMember, G, "edgeCount") ||
> > !__traits(hasMember, G,
On 08/30/2013 01:57 PM, Joseph Rushton Wakeling wrote:
On 30/08/13 21:40, Benjamin Thaut wrote:
You need to put it into a static if, otherwise the compiler will continue
semantic checks on the second part of the expression. E.g.
template isGraph(G)
{
static if(__traits(hasMember, G, "directe
On 30/08/13 23:06, Ali Çehreli wrote:
How about allSatisfy:
http://dlang.org/phobos/std_typetuple.html#.allSatisfy
I'll have a look at that, thanks :-)
Here's what I came up with, for now. It should probably be extended with
further tests on the characteristics of the various member func
Ah, forgot to say :
I executed "python3.3 setup.py pydexe --compiler=gdc"
Any other way won't work.
tried hacking dcompiler.py in the python local packages, no luck.
Libraries won't be taken into account.
May I read something wrong..
Hello,
Not working here on a Debian sid :
gdc -fproperty -c -fversion=Python_2_4_Or_Later
-fversion=Python_2_5_Or_Later -fversion=Python_2_6_Or_Later
-fversion=Python_2_7_Or_Later -fversion=Python_3_0_Or_Later
-fversion=Python_3_1_Or_Later -fversion=Python_3_2_Or_Later
-fversion=Python_3_3_O
On 30/08/13 21:40, Benjamin Thaut wrote:
You need to put it into a static if, otherwise the compiler will continue
semantic checks on the second part of the expression. E.g.
template isGraph(G)
{
static if(__traits(hasMember, G, "directed"))
enum bool isGraph = isBoolean!(typeof(G.direct
Hello all,
I find myself wanting to write for the first time one of these isSomething(T) or
hasSomething(T) templates that perform compile-time checks, so I was hoping
people could give me some good general advice on traits.
The goal here is to be able to confirm (i) type T has certain member
Am 30.08.2013 21:36, schrieb Joseph Rushton Wakeling:
Hello all,
I find myself wanting to write for the first time one of these
isSomething(T) or hasSomething(T) templates that perform compile-time
checks, so I was hoping people could give me some good general advice on
traits.
The goal here is
On Friday, 30 August 2013 at 14:18:22 UTC, Dicebot wrote:
On Friday, 30 August 2013 at 06:31:39 UTC, Paul Jurczak wrote:
BTW, DMD produces faster code when for loop is used instead,
with GDC it makes no difference.
This pretty much shows that there is nothing wrong in language
with current io
On Friday, 30 August 2013 at 17:19:11 UTC, Paul Jurczak wrote:
On Friday, 30 August 2013 at 14:11:06 UTC, Namespace wrote:
[..]
Can you prove this on DPaste?
It's there at: http://dpaste.dzfl.pl/2cf504db
I'm not sure what are the compiler switches on DPaste and I don't
see an option to cha
On 08/30/2013 07:02 AM, Andrej Mitrovic wrote:
> However will the compiler align all static arrays so their memory
> begins at a proper offset?
The compiler considers only the element type of the static array.
> Maybe a more appropriate question is: Is all stack data guaranteed to
> be properly
On Friday, 30 August 2013 at 14:11:06 UTC, Namespace wrote:
On Friday, 30 August 2013 at 06:31:39 UTC, Paul Jurczak wrote:
Is there a better way to express a range with stride than this:
foreach (i; iota(0, N, 2))
Maybe something similar to F# syntax:
foreach (i; 0..2..N)
I found this thread
On 8/30/13, Namespace wrote:
> I hate this "magic" library fix.. Why cannot we use 'scope' for
> this?
> I know currently it is an unsafe feature that was also proposed
> for rejection, but it would look better, feel better, and the
> compiler could take the dirty work for us. And maybe better
> o
On Friday, 30 August 2013 at 14:45:40 UTC, Andrej Mitrovic wrote:
On 8/30/13, Namespace wrote:
I hate this "magic" library fix.. Why cannot we use 'scope' for
this?
I know currently it is an unsafe feature that was also proposed
for rejection, but it would look better, feel better, and the
comp
I hate this "magic" library fix.. Why cannot we use 'scope' for
this?
I know currently it is an unsafe feature that was also proposed
for rejection, but it would look better, feel better, and the
compiler could take the dirty work for us. And maybe better
optimized.
On Friday, 30 August 2013 at 06:31:39 UTC, Paul Jurczak wrote:
BTW, DMD produces faster code when for loop is used instead,
with GDC it makes no difference.
This pretty much shows that there is nothing wrong in language
with current iota approach and it is simply problem of bad dmd
code gener
On Friday, 30 August 2013 at 06:31:39 UTC, Paul Jurczak wrote:
Is there a better way to express a range with stride than this:
foreach (i; iota(0, N, 2))
Maybe something similar to F# syntax:
foreach (i; 0..2..N)
I found this thread suggesting syntax improvement
http://forum.dlang.org/thread
On 8/30/13, Ali Çehreli wrote:
> Now your program works with a single change:
>
> enum Size = paddedSize!C();
Excellent.
However will the compiler align all static arrays so their memory
begins at a proper offset?
Maybe a more appropriate question is: Is all stack data guaranteed to
be pro
On Friday, 30 August 2013 at 11:34:59 UTC, Jacob Carlborg wrote:
On 2013-08-30 09:39, eles wrote:
I'm pretty sure it's DMD that is the problem.
Yes. But that's, the least to say, limiting.
This:
https://github.com/D-Programming-Language/tools/blob/master/rdmd.d#L160
should be solved in othe
On 8/30/13, Andrej Mitrovic wrote:
> On 8/30/13, Andrej Mitrovic wrote:
>> I'm not looking for a workaround (there's plenty of ways to work
>> around this)
>
> Here's one way:
Sorry, better version, the second function doesn't need to be a
template (in git-head anyway):
void opAssign(T)(T t
On 8/30/13, Andrej Mitrovic wrote:
> I'm not looking for a workaround (there's plenty of ways to work
> around this)
Here's one way:
void opAssign(T)(T t)
if (is(typeof(Constraint!T)) && Constraint!T)
{
pragma(msg, "T");
}
void opAssign(T)(T t)
if (is(T =
You're going to need DMD git-head to run this reduced example:
-
struct S
{
void opAssign(T)(T t)
if (Constraint!T)
{
}
void opAssign(typeof(null))
{
}
template Constraint(T)
if (is(T == int))
{
enum bool Constraint = false;
}
}
vo
On Friday, 30 August 2013 at 12:45:22 UTC, chmike wrote:
Hello,
I'm trying to compile and run the Vibe.d First Step example
[http://vibed.org/docs#first-steps] but I have unresolved
libraries error from the linker :
Linking...
/usr/bin/ld: ne peut trouver -levent
/usr/bin/ld: ne peut trouver
On Friday, 30 August 2013 at 12:51:16 UTC, chmike wrote:
Does it expect 32bit library versions ?
It may happen if you use 32-but dmd (or it is set to use -m32 in
dmd.conf)
/usr/bin/ld: ne peut trouver -levent
/usr/bin/ld: ne peut trouver -levent_pthreads
/usr/bin/ld: ne peut trouver -lssl
/usr/bin/ld: ne peut trouver -lcrypto
All four libraries (amd64) are installed, at least libevent,
libevent_pthreads and libssl.
Does it expect 32bit library versions ?
Hello,
I'm trying to compile and run the Vibe.d First Step example
[http://vibed.org/docs#first-steps] but I have unresolved
libraries error from the linker :
Linking...
/usr/bin/ld: ne peut trouver -levent
/usr/bin/ld: ne peut trouver -levent_pthreads
/usr/bin/ld: ne peut trouver -lssl
/usr/
On 30-8-2013 0:40, H. S. Teoh wrote:
(...)
A far better implementation is to use std.range.recurrence:
uint fib(in uint n) pure nothrow {
return recurrence!((a,n) => a[n-2] + a[n-1])(1, 1)
.drop(n-1)
.front;
}
This
On 2013-08-30 09:39, eles wrote:
On Linux 64
$chmod +x htest
$cat ./htest
#!/usr/bin/env rdmd
import std.stdio;
void main() {
writeln("hello world!");
}
then:
$./htest
Error: cannot read file ./htest.d
Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
OTOH:
$cp htest htest.d
$./htest.d
hello
On Friday, 30 August 2013 at 07:56:14 UTC, anonymous wrote:
On Friday, 30 August 2013 at 07:39:41 UTC, eles wrote:
A workaround for this?
ln htest htest.d
Thanks.
On Thursday, 29 August 2013 at 21:10:41 UTC, Rory McGuire wrote:
On Thursday, 29 August 2013 at 21:06:04 UTC, Rory McGuire wrote:
Hi all,
I've got this little ctfe template function that checks if a
function called member with first argument T exists. Its for
checking if a type has a custom e
so second question : I would like to know if using destroy
function will help enough gc when working in big memory and
saving time.
On Friday, 30 August 2013 at 07:39:41 UTC, eles wrote:
On Linux 64
$chmod +x htest
$cat ./htest
#!/usr/bin/env rdmd
import std.stdio;
void main() {
writeln("hello world!");
}
then:
$./htest
Error: cannot read file ./htest.d
Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
OTOH:
$cp htest
On Linux 64
$chmod +x htest
$cat ./htest
#!/usr/bin/env rdmd
import std.stdio;
void main() {
writeln("hello world!");
}
then:
$./htest
Error: cannot read file ./htest.d
Failed: 'dmd' '-v' '-o-' './htest.d' '-I.'
OTOH:
$cp htest htest.d
$./htest.d
hello world!
It seems that rdmd expe
40 matches
Mail list logo