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

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 peter.alexander.au http://peter.alexander.au@gmail.com http://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...

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,

Is there any way to fix this elegant way to walk a tree at compile time?

2011-01-17 Thread Gareth Charnock
I was trying to walk a tree at compile time and I came up with this method. It seems very elegant, but unfortunately it fails with a recursive alias declaration error. I have a bad feeling there's no way to fix this but I thought I'd ask in case anyone had any ideas.

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

2010-12-08 Thread Gareth Charnock
On 21/11/10 22:39, bearophile wrote: Gareth Charnock: struct LeafType { string Compile_not_ovloaded() { return expression; } }; Note that D structs don't require the ending semicolon, so in practice it is not used. And in D method names start with a lower

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 =

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 { string

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

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); return

Re: dmd 1.065 and 2.050 release

2010-11-02 Thread Gareth Charnock
On 29/10/10 18:35, Walter Bright wrote: This is primarily a bug fix release. http://www.digitalmars.com/d/1.0/changelog.html http://ftp.digitalmars.com/dmd.1.065.zip http://www.digitalmars.com/d/2.0/changelog.html http://ftp.digitalmars.com/dmd.2.050.zip This bug was also fixed.

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:

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() {} More

Re: Emacs D Mode now on Launchpad

2010-10-25 Thread Gareth Charnock
As one of those strange creatures who use emacs, I thank you for taking this up! Sadly I'm not an elisper but if I find bugs I'll let you know. On 25/10/10 07:32, Russel Winder wrote: Walter asked me to post this to this list. The Emacs D Mode project is at:

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

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 multiplication

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

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 Alexandrescuseewebsiteforem...@erdani.org 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

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

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

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: 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

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

Re: cannot evalute mixin(uuid(bla)) at compile time

2010-08-03 Thread Gareth Charnock
On 03/08/10 15:19, Sam Hu wrote: Base on D1: interface IADsPropertyEntry : IDispatch { mixin(uuid(05792c8e-941f-11d0-8529-00c04fd8d503)); ... Error when compile: argument to mixin must be a string,not mixin(uuid(05792c8e-941f-11d0-8529-00c04fd8d503)) cannot evaluate

Overzealous immutable and classes

2010-07-15 Thread Gareth Charnock
So having got a collectors' edition TDPL, I though I'd have a try at writing some concurrent code. The idea was a worker thread(s) would do some work and write the results to some immutable objects. These would get passed to an indexer thread that would do neat stuff like indexing the

Re: Is the memory address of classinfo the same for all instances of a class?

2010-07-15 Thread Gareth Charnock
On 02/07/10 15:18, Heywood Floyd wrote: On Jul 2, 2010, at 15:34 , Steven Schveighoffer wrote: On Fri, 02 Jul 2010 09:32:39 -0400, Steven Schveighofferschvei...@yahoo.com wrote: On Fri, 02 Jul 2010 09:24:20 -0400, Heywood Floydsoul...@gmail.com wrote: Good day! Consider // - - - -

Re: Overzealous immutable and classes

2010-07-15 Thread Gareth Charnock
On 16/07/10 02:08, Jonathan M Davis wrote: On Thursday, July 15, 2010 17:40:26 Gareth Charnock wrote: So having got a collectors' edition TDPL, I though I'd have a try at writing some concurrent code. The idea was a worker thread(s) would do some work and write the results to some immutable

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! :)

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

Re: Small vector and matrix proposed for phobos2 now on github

2010-04-29 Thread Gareth Charnock
Jérôme M. Berger wrote: Gareth Charnock wrote: PS: Okay so I just had a looked at the matrix and vector classes in Ogre3D and irrlicht. Looks like they both define v*v as element wise multiplication but m*m is matrix multiplication. That just seems even more inconsistent. Eigen (http

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

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

Re: Small vector and matrix proposed for phobos2 now on github

2010-04-26 Thread Gareth Charnock
Thanks. To quickly answer this: - The version I'm seeing on github doesn't seem to have all the features you're referencing (i.e. v*v). Why are some ops limited to */ and other +-? It was quite late (3am) when I typed up that email. I'm sorry if I got the ops wrong. v*v was actually

Re: Small vector and matrix proposed for phobos2 now on github

2010-04-26 Thread Gareth Charnock
I need a better name for ArgList. It originally made sense because because I assumed I be using the tuple like this: this(ArgList argList) But then I ended up using it in a load of static foreaches. I think it would be useful to actually be able to say static foreach so that readers (and

Small vector and matrix proposed for phobos2 now on github

2010-04-25 Thread Gareth Charnock
I've put the beginnings of my matrix-vector library up on github (between swizzling, generalising to N dimensions and making use of static foreach this project quickly turned from a cleanup to a rewrite). You can find it here. http://github.com/gcharnock/phoboslinalgebra Some highlights so

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

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 sandf...@jhu.edu mailto:sandf...@jhu.edu wrote: PS. You can get things like this to work

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;

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 gar...@oerc.ox.ac.uk 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 template

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 dense

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:

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 cross product

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

2010-04-16 Thread Gareth Charnock
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 Charnock Lars T

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

2010-04-16 Thread Gareth Charnock
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 including them. Matrices and vectors in particular get

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

2010-04-15 Thread Gareth Charnock
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: dmd 1.057 and 2.041 release

2010-03-08 Thread Gareth Charnock
I think this bug has been squished as well. Both test cases now compile fine. http://d.puremagic.com/issues/show_bug.cgi?id=3694 Walter Bright wrote: Lots of meat and potatoes here, and a cookie! (spelling checker for error messages) http://www.digitalmars.com/d/1.0/changelog.html

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

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

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

rt_attachDisposeEvent: the apparent magic behind std.signals

2010-01-26 Thread Gareth Charnock
I was looking at the std.signals code in svn to find out how the magic of the observer class not needing to inherit anything was done and I was somewhat disappointed to see rt_attachDisposeEvent. Is this function standardised or exposed anywhere? I can think of cases where being able to listen

Re: TLS definition in curses.o section .tbss mismatches non-TLS reference in /usr/lib/libncurses.a(lib_initscr.o)

2009-12-11 Thread Gareth Charnock
Bernard Helyer wrote: On 11/12/09 10:48, Gareth Charnock wrote: Is there any way to tell dmd to just share them between threads? __gshared type whatever; Thanks. And now I see there was an article about that on website all along. I guess my eyes must have just scanned over it. A good

TLS definition in curses.o section .tbss mismatches non-TLS reference in /usr/lib/libncurses.a(lib_initscr.o)

2009-12-10 Thread Gareth Charnock
I've been trying to link a d program to a c library (ncurses in this case) on ubuntu 9.10 with dmd v2.036. Converting curses.c to a .d header seemed to go okay when I try to link the files together I get this: dmd -c main.d dmd -c curses.d dmd main.o curses.o -L/usr/lib/libncurses.a