Is [] mandatory for array operations?

2010-05-04 Thread Don
According to my reading of the spec, array operations only require [] after the lvalue, not after any of the rvalues. So this should work: int[3] x, y; x[] = y * 2; // should work, but currently fails But in DMD at present, array operations only work if you write [] after _every_ array. x[] =

Re: Tango & Phobos

2010-05-04 Thread Gurney Halleck
== Quote from Walter Bright (newshou...@digitalmars.com)'s article > Gurney Halleck wrote: > > Srsly?!? Its better to censor Walters informative post because the Tango > > Komintern > > has no good retort? > > > > The dimwits tried to rewrite history once. They edited the title of Dons bug > > rep

Re: Is [] mandatory for array operations?

2010-05-04 Thread Walter Bright
Don wrote: There are several compiler bugs relating to array operations, and almost all relate to this issue. I'd like to fix them, but I need to know which way it is supposed to work. The [] should be required. I worry that otherwise there will be ambiguous cases that will cause trouble.

Re: Is [] mandatory for array operations?

2010-05-04 Thread Don
Walter Bright wrote: Don wrote: There are several compiler bugs relating to array operations, and almost all relate to this issue. I'd like to fix them, but I need to know which way it is supposed to work. The [] should be required. I worry that otherwise there will be ambiguous cases that w

Re: Improving Compiler Error Messages [OT]

2010-05-04 Thread Jacob Carlborg
On 5/3/10 21:03, Nick Sabalausky wrote: "Walter Bright" wrote in message news:hrn5ft$oq...@digitalmars.com... Nick Sabalausky wrote: I'm also another person that finds semicolons magically appearing at the end of statements...even when I use a language that doesn't allow them ;) It's funny h

Re: Improving Compiler Error Messages

2010-05-04 Thread Jacob Carlborg
On 5/3/10 22:06, Michel Fortin wrote: On 2010-05-03 15:33:53 -0400, Michel Fortin said: On 2010-05-03 05:53:34 -0400, Jacob Carlborg said: foo((int i) { writeln(i); }); I agree that the semicolon looks out of place for one-line function bodies. The semicolon could be made optional for th

Re: Improving Compiler Error Messages

2010-05-04 Thread Jacob Carlborg
On 5/3/10 21:33, Michel Fortin wrote: On 2010-05-03 05:53:34 -0400, Jacob Carlborg said: foo((int i) { writeln(i); }); I agree that the semicolon looks out of place for one-line function bodies. The semicolon could be made optional for the last statement in a block. Just have it be a statem

Re: Improving Compiler Error Messages

2010-05-04 Thread Jacob Carlborg
On 5/4/10 00:30, Michel Fortin wrote: On 2010-05-03 18:05:11 -0400, Walter Bright said: Nick Sabalausky wrote: "Walter Bright" wrote in message news:hrncpk$14t...@digitalmars.com... Michel Fortin wrote: That's an argument against returning the value of the last statement. It's not an argum

Re: Improving Compiler Error Messages

2010-05-04 Thread Jacob Carlborg
On 5/4/10 00:30, Michel Fortin wrote: On 2010-05-03 18:05:11 -0400, Walter Bright said: Nick Sabalausky wrote: "Walter Bright" wrote in message news:hrncpk$14t...@digitalmars.com... Michel Fortin wrote: That's an argument against returning the value of the last statement. It's not an argum

Re: Is [] mandatory for array operations?

2010-05-04 Thread Trass3r
int[3] x, y; x[] = y * 2; // should work, but currently fails Don't know if this would cause any compiler problems but y could also be a scalar value. So requiring the [] would at least be unambiguous to the programmer. Hmm, maybe if you have two variables named very similarly and you mistyp

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Graham Fawcett
On Mon, 03 May 2010 16:01:30 -0700, Andrei Alexandrescu wrote: > Graham Fawcett wrote: >> The fact that libxml2/libxslt support not only XML parsing and DOM >> building, but also XSLT, XPath, XPointer, XInclude, RelaxNG, etc., >> means that any homegrown library will be hard-pressed to cover the s

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread BCS
Hello Adam, An important aspect of mimicing js is I don't really care about the xml standard; it tries to figure out whatever ugly crap you throw its way and makes a few assumptions for html. But, it can be used for generic xml stuff too. That can be handy but can also lead to problems. -- ..

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Andrei Alexandrescu
Graham Fawcett wrote: On Mon, 03 May 2010 16:01:30 -0700, Andrei Alexandrescu wrote: Graham Fawcett wrote: The fact that libxml2/libxslt support not only XML parsing and DOM building, but also XSLT, XPath, XPointer, XInclude, RelaxNG, etc., means that any homegrown library will be hard-pressed

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Richard Webb
RapidXML also uses the Boost license (it's included as part of the Boost PropertyTree library). I haven't used it though, so i can't say how i compares to the others.

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Graham Fawcett
On Tue, 04 May 2010 09:09:29 -0700, Andrei Alexandrescu wrote: > Graham Fawcett wrote: >> On Mon, 03 May 2010 16:01:30 -0700, Andrei Alexandrescu wrote: >> >>> Graham Fawcett wrote: The fact that libxml2/libxslt support not only XML parsing and DOM building, but also XSLT, XPath, XPoint

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Andrei Alexandrescu
Graham Fawcett wrote: On Tue, 04 May 2010 09:09:29 -0700, Andrei Alexandrescu wrote: Graham Fawcett wrote: On Mon, 03 May 2010 16:01:30 -0700, Andrei Alexandrescu wrote: Graham Fawcett wrote: The fact that libxml2/libxslt support not only XML parsing and DOM building, but also XSLT, XPath,

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Graham Fawcett
On Tue, 04 May 2010 11:56:31 -0700, Andrei Alexandrescu wrote: > Graham Fawcett wrote: >> On Tue, 04 May 2010 09:09:29 -0700, Andrei Alexandrescu wrote: >> >>> Graham Fawcett wrote: On Mon, 03 May 2010 16:01:30 -0700, Andrei Alexandrescu wrote: > Graham Fawcett wrote: >> The fac

Re: Is [] mandatory for array operations?

2010-05-04 Thread Walter Bright
Don wrote: Walter Bright wrote: Don wrote: There are several compiler bugs relating to array operations, and almost all relate to this issue. I'd like to fix them, but I need to know which way it is supposed to work. The [] should be required. I worry that otherwise there will be ambiguous

// Function parameters, sound, clear and clean //

2010-05-04 Thread Rick Trelles
(This I posted in http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Function#section2 I add it here so more people could see and comment it.) I'm new to D. I think D is a great idea, a much needed thing. But I find its specs are terribly sketchy. With sketchy specs D can't go anywhere, I thin

Re: Improving Compiler Error Messages

2010-05-04 Thread dennis luehring
Am 02.05.2010 04:56, schrieb Walter Bright: http://www.drdobbs.com/blog/archives/2010/05/improving_compi.html The next dmd update is getting the fruits of this. do you think that something like this is also doable to the syntax analyse phase - so that parts of the parsed file can be syntax-co

Re: Is [] mandatory for array operations?

2010-05-04 Thread Don
Walter Bright wrote: Don wrote: Walter Bright wrote: Don wrote: There are several compiler bugs relating to array operations, and almost all relate to this issue. I'd like to fix them, but I need to know which way it is supposed to work. The [] should be required. I worry that otherwise the

Re: // Function parameters, sound, clear and clean //

2010-05-04 Thread Robert Jacques
On Tue, 04 May 2010 16:51:57 -0400, Rick Trelles wrote: [snip] I'd recommend reading the D language documentation on the Digital Mars website. in, out, ref and lazy are on the functions page: http://www.digitalmars.com/d/2.0/function.html const, immutable, scope, inout are all listed on

Re: Is [] mandatory for array operations?

2010-05-04 Thread Andrei Alexandrescu
Walter Bright wrote: Don wrote: Walter Bright wrote: Don wrote: There are several compiler bugs relating to array operations, and almost all relate to this issue. I'd like to fix them, but I need to know which way it is supposed to work. The [] should be required. I worry that otherwise the

c++ vs lisp -- D perspective

2010-05-04 Thread Graham Fawcett
Hi folks, I just read a provocative critique of a blog article comparing C++ to Lisp: http://funcall.blogspot.com/2010/05/c-vs-lisp.html I've enjoyed using Lisp languages in the past, and appreciate that D offers a lot of metaprogramming features that could probably result in a cleaner, short

Re: c++ vs lisp -- D perspective

2010-05-04 Thread Ellery Newcomer
On 05/04/2010 03:32 PM, Graham Fawcett wrote: Hi folks, I just read a provocative critique of a blog article comparing C++ to Lisp: http://funcall.blogspot.com/2010/05/c-vs-lisp.html I've enjoyed using Lisp languages in the past, and appreciate that D offers a lot of metaprogramming features t

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Michel Fortin
On 2010-05-04 12:09:29 -0400, Andrei Alexandrescu said: Graham Fawcett wrote: By "adapt" do you mean writing a wrapper for an existing library, or translating the source code of the library into D? What constitutes a "generous license" in this context? (For what it's worth, libxml2 is under

Re: Is [] mandatory for array operations?

2010-05-04 Thread Bernard Helyer
On 05/05/10 08:19, Andrei Alexandrescu wrote: In the same vein, probably it's time to bite the bullet and require @property for parens-less function calls. Andrei Agreed. Is there any word on rewriting things like `fooInstance.prop += 3` for @properties?

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2010-05-04 12:09:29 -0400, Andrei Alexandrescu said: Graham Fawcett wrote: By "adapt" do you mean writing a wrapper for an existing library, or translating the source code of the library into D? What constitutes a "generous license" in this context? (For what it's wo

Unit tests in D

2010-05-04 Thread bearophile
dmd D 2.045 improves the built-in unit tests resuming their run when they fail (it reports only the first failed assert for each unit test). There are many features that today a professional unittest system is expected to offer, I can write a long list. But in the past I have explained that it's

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Michel Fortin
On 2010-05-04 19:41:39 -0400, Andrei Alexandrescu said: Anyway, just in case, would you be interested in an XML tokenizer and simple DOM following this model? http://michelf.com/docs/d/mfr/xmltok.html http://michelf.com/docs/d/mfr/xml.html At the base is a pull parser and an event p

Re: Unit tests in D

2010-05-04 Thread Michel Fortin
On 2010-05-04 21:24:50 -0400, bearophile said: There are ways to partially implement this for run-time asserts, but badly: void throws(Exceptions, TCallable, string filename=__FILE__, int line=__LINE__) (lazy TCallable callable) { try callable(); catch (Exception e)

Re: Phobos Proposal: replace std.xml with kxml.

2010-05-04 Thread Robert Jacques
On Tue, 04 May 2010 21:55:53 -0400, Michel Fortin wrote: // String version: can slice string readUntil(isAtEndPredicate)(ref string input) { string savedInput; while (!input.empty && isAtEndPredicate(input.front)) { input.p