Overzealous recursive template expansion protection?

2010-11-02 Thread Gareth Charnock
I've been trying to correctly implement the interpreter patten/expression templates in D (for reference this is a summary of the C++ interpreter patten can be found here http://www.drdobbs.com/184401627). I've run into a problem and I'm not sure if it's a compiler bug or not. The testcase is:

Re: Immutable fields

2010-11-02 Thread Gareth Charnock
On 03/11/10 00:54, bearophile wrote: Is it correct for immutable struct fields to act like enum or static const fields? (I don't think so, but I am wrong often): struct Foo { immutable int x = 1; } static assert(Foo.sizeof == 4); void main() {} More info in the D.learn thread: http://www

Re: Immutable fields

2010-11-02 Thread Gareth Charnock
On 03/11/10 02:20, Gareth Charnock wrote: On 03/11/10 00:54, bearophile wrote: Is it correct for immutable struct fields to act like enum or static const fields? (I don't think so, but I am wrong often): struct Foo { immutable int x = 1; } static assert(Foo.sizeof == 4); void main() {}

Re: Overzealous recursive template expansion protection?

2010-11-03 Thread Gareth Charnock
On 03/11/10 03:21, Robert Jacques wrote: struct BinaryOp(L,string op,R) { pragma(msg,"Instansiating " ~ typeof(this).stringof); BinaryOp!(typeof(this),s,R1) opBinary(string s,R1)(R1 r) { pragma(msg,"Instansiating BinaryOp.opBinary ~L.stringof ~ op ~ R1.stringof); retu

A CTFE Segfault (with explanation, but I'm not sure what the fix is).

2010-11-21 Thread Gareth Charnock
This code makes the DMD compiler segfault struct LeafType { string Compile_not_ovloaded() { return "expression"; } }; struct MatrixASTNode { LeafType Right; string Compile() { return Right.Compile_not_ovloaded(); } }; void main() { enum AST = MatrixASTN

Re: A CTFE Segfault (with explanation, but I'm not sure what the fix is).

2010-11-21 Thread Gareth Charnock
Done. http://d.puremagic.com/issues/show_bug.cgi?id=5248 I'm sorry if I'm a bit over-cautious before submitting bugs. On 21/11/10 22:18, Brad Roberts wrote: On 11/21/2010 2:11 PM, Gareth Charnock wrote: This code makes the DMD compiler segfault struct LeafType {

I noticed std.typetuple.staticMap was looking lonely without a reduce

2011-01-17 Thread Gareth Charnock
And I needed one. So here's a staticReduce a that appears to work, uploaded as a github gist for anyone who is interested. That is all. https://gist.github.com/783771

Re: repeat

2011-01-17 Thread Gareth Charnock
On 17/01/11 18:10, Andrei Alexandrescu wrote: std.range has a function repeat that repeats one value forever. For example, repeat(42) is an infinite range containing 42, 42, 42,... The same module also has a function replicate that repeats one value a specific number of times. In fact, replicate

Re: Pretty please: Named arguments

2011-03-09 Thread Gareth Charnock
Named arguments are useful when you have a function that takes a large number of parameters, the vast majority of which have default values. For example, have a look at this constructor in wxWidgets: http://docs.wxwidgets.org/trunk/classwx_frame.html#01b53ac2d4a5e6b0773ecbcf7b5f6af8 wxFrame::w

Re: Haskell infix syntax

2011-03-09 Thread Gareth Charnock
On 07/03/11 01:01, Caligo wrote: On Sun, Mar 6, 2011 at 12:24 PM, Peter Alexander http://peter.alexander.au>@gmail.com > wrote: On 6/03/11 4:22 PM, bearophile wrote: So I think it's not worth adding to D. But if you don't agree... talk. Bye

Re: About Andrei's interview, part 3

2010-08-27 Thread Gareth Charnock
On 26/08/10 07:57, Don wrote: Walter Bright wrote: bearophile wrote: This is why I don't like a lot the current work done for the 64 bit implementation. A lot of groups cannot consider D unless it supports 64 bit compilation. D2 has some design problems (I don't call them 'enhancement requ

Re: Array types

2010-08-27 Thread Gareth Charnock
-- The (C) arrays are not the same thing as dynamic arrays of dynamic arrays because: - Some algorithms are not designed for a triangle where rows may differ in length. Testing that rows are all the same length at runtime wastes time, and if you don't test it then it may

Re: Reporting TDPL bugs in Bugzilla

2010-09-01 Thread Gareth Charnock
On 01/09/10 16:49, user wrote: To everyone reporting inconsistencies between Andrei's book and the compiler -- please include TDPL or [tdpl] in the bug title, to make it easier to search for them. These bugs have high priority. To everyone reporting inconsistencies between Andrei's book and t

Re: Reporting TDPL bugs in Bugzilla

2010-09-01 Thread Gareth Charnock
On 01/09/10 21:50, Stanislav Blinov wrote: Is it just me, or spam bots suddenly became incredibly clever? You call that clever? O_o For a bot. It almost seems as there is some intelligence behind this. Well, a little too almost, maybe. I checked and bug #1 isn't actually "give up already",

Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Gareth Charnock
On 02/09/10 09:46, Jacob Carlborg wrote: On 2010-09-02 09:48, Nick Sabalausky wrote: "Andrei Alexandrescu" wrote in message news:i5ni8j$1nk...@digitalmars.com... Time to zero in on the overall design and start working on the content. Please give the design one more round of comments. I think

Re: Please comment on http://d-programming-language.org/

2010-09-02 Thread Gareth Charnock
PS: Google Chrome on a 1680x1050 resolution display. I'm afraid I really like the red flare; it makes the website look more visually appealing. A solid background colour would just look blander. However, I agree with the comments about the c1.gif and d3.gif images. They don't really fit with the

Re: CMake for D2 ready for testers

2010-09-06 Thread Gareth Charnock
I will definitely be checking this out. I've used CMake with C++ for quite a large project and it's been very good at of getting the done without being the infinite tower of turtles on turtles that autotools seems to be. (I never managed to learn autotools so perhaps they don't seem as bad on

Re: Is there anybody working on a linear algebra library for D2?

2010-10-05 Thread Gareth Charnock
On 05/10/10 14:41, Michael Chen wrote: I remember that one of D's goal is easy scientific computation. However I haven't seen any linear algebra package for D2. My work heavily relays on all kinds of matrix stuff (matrix multiplication, factorization, linear system etc). I like D and am willing t

Re: Is there anybody working on a linear algebra library for D2?

2010-10-05 Thread Gareth Charnock
On 05/10/10 16:31, Don wrote: Gareth Charnock wrote: On 05/10/10 14:41, Michael Chen wrote: I remember that one of D's goal is easy scientific computation. However I haven't seen any linear algebra package for D2. My work heavily relays on all kinds of matrix stuff (matrix mult

Re: Using DMD2 on Ubuntu 9.04 x64?

2010-02-01 Thread Gareth Charnock
Yes it is possible and you don't even have to mess about with chroot. I think the package you're looking for is ia32-libs. This is my dmd.conf file: [Environment] dflags=...@p%/../../src/phobos -...@p%/../../src/druntime/import -l...@p%/../lib -L-L/lib32 -L-L/usr/lib32 I think the important

Re: TDPL a bad idea?

2010-02-05 Thread Gareth Charnock
Mike Parker wrote: Walter Bright wrote: Yigal Chripun wrote: I've thought about building such a system for these forums many times. Registration would not be required to post, but registering would enable features like voting on posts, establishing a profile, preferences, etc. That sounds a

Re: Whither Tango?

2010-02-19 Thread Gareth Charnock
dave eveloper wrote: Ezneh Wrote: So, it is not better to find a compromise between these libraries ? Why they have to be "two" libraries rather than one which was designed by larsivi, Walter Bright and Andrei Alexandrescu ? I haven't seen larsivi around lately. Is it possible that there's a

Low dimensional matrices, vectors, quaternions and a cubic equation solver

2010-04-15 Thread Gareth Charnock
Would this sort of functionality be useful for phobos? At the moment, I can't promise anything, I'm just trying to judge the interest should I find time to look into it. Gareth Charnock

Re: Low dimensional matrices, vectors, quaternions and a cubic equation solver

2010-04-16 Thread Gareth Charnock
are that D has a reputation for not being as open as one might like, but the general consensus seems to be that things are getting better, which is why I'm posting first to check if the authors of Phobos are open to the idea of having matrices, vectors and quaternions and such. Gareth C

Re: Low dimensional matrices, vectors, quaternions and a cubic equation solver

2010-04-16 Thread Gareth Charnock
ng to stdout/streams and such. Andrei Alexandrescu wrote: On 04/15/2010 01:49 PM, Gareth Charnock wrote: As a side effect of my PhD project I've got a collection of mathematical classes. I'd be happy to collect them together, tidy them up and donate them to phobos the authors are interested in in

Re: Low dimensional matrices, vectors, quaternions and a cubic equation solver

2010-04-18 Thread Gareth Charnock
Andrei Alexandrescu wrote: On 04/16/2010 04:25 PM, Gareth Charnock wrote: Okay, here goes. I've collected together the basic functionality that would probably make a good starting point. As I've mentioned my code is very messy and has bits missing (e.g. I never had a use for the cro

Re: Low dimensional matrices, vectors, quaternions and a cubic equation

2010-04-20 Thread Gareth Charnock
Clemens wrote: Eric Poggel Wrote: On 4/16/2010 10:41 PM, Andrei Alexandrescu wrote: Generally I'd strongly suggest making operations free generic functions instead of members. I disagree on this one. It unnecessarily adds more names to an outer namespace and makes code less readable: vec1.

Anyone know what's going on here? (variable with an instantiated template as a type shows up as void when instantiating another template)

2010-04-23 Thread Gareth Charnock
Is this a bug, or am I being dense? I've tried it this on 2.036,2.042 and 2.043 and on each the compiler produces errors. Searched bugzilla for "template and instantiated" and "template and instantiate" struct A(uint N) { } void unary_op(uint N)(A!(N)) { } void main() { A!(3) a3; prag

Re: Anyone know what's going on here? (variable with an instantiated template as a type shows up as void when instantiating another template)

2010-04-23 Thread Gareth Charnock
Thanks! Robert Jacques wrote: On Fri, 23 Apr 2010 10:25:35 -0300, Gareth Charnock wrote: Is this a bug, or am I being dense? I've tried it this on 2.036,2.042 and 2.043 and on each the compiler produces errors. Searched bugzilla for "template and instantiated" and "temp

Re: Anyone know what's going on here? (variable with an instantiated template as a type shows up as void when instantiating another template)

2010-04-23 Thread Gareth Charnock
...er... ... I think I'll just put on the dunce hat and stand in the corner then. This is why, as someone with dyslexia, I like statically typed languages. I hate finding out about these errors at runtime. Lars T. Kyllingstad wrote: Gareth Charnock wrote: Is this a bug, or am I being

Re: Anyone know what's going on here? (variable with an instantiated template as a type shows up as void when instantiating another template)

2010-04-24 Thread Gareth Charnock
Just got a chance to test the isInstanceOf template and it does (after some fiddling) provide a workaround for this bug. Thanks. Philippe Sigaud wrote: On Fri, Apr 23, 2010 at 14:57, Robert Jacques > wrote: PS. You can get things like this to work using template co

Re: Things I Learned from ACCU 2010

2010-04-25 Thread Gareth Charnock
Walter Bright wrote: Nick Sabalausky wrote: Heh. I've surprised a lot of laymen, after telling them I'm a programmer, by my opinions that most programmers are incompetent and most software and consumer electronics are terrible. Seems hugely ironic to those unfamiliar with the field, but being

Results are in: static foreach is a slower than hand unrolling your loops or using mixins.

2010-04-29 Thread Gareth Charnock
I managed to get some free time to look at this and it would appear that static foreach is slower than hand unrolling a loop. Fortunately there are no detectable differences between hand unrolling a loop and building the body of the loop in a compile time string and using a mixin. Results are h

Re: Results are in: static foreach is a slower than hand unrolling your loops or using mixins.

2010-04-29 Thread Gareth Charnock
Correction, two of the loops were going backwards (mixin and hand unrolled). Fixed this but the conclusion remains the same. Gareth Charnock wrote: I managed to get some free time to look at this and it would appear that static foreach is slower than hand unrolling a loop. Fortunately there

Re: Results are in: static foreach is a slower than hand unrolling yourloops or using mixins.

2010-04-30 Thread Gareth Charnock
I don't actually know assembly language so no, this is all purely empirical. BCS wrote: Hello Gareth, I managed to get some free time to look at this and it would appear that static foreach is slower than hand unrolling a loop. Fortunately there are no detectable differences between hand unro

Re: Improving Compiler Error Messages

2010-05-03 Thread Gareth Charnock
> As far as I'm concerned the inventor of Python should be beaten to death with a sock full of tab keys. That mental image just made my day! :)