Re: Initial release of Goldie: GOLD Parser Engine for D

2009-08-28 Thread Grzegorz Adam Hankiewicz

Nick Sabalausky escribió:

First release of Goldie is now available on DSource.
http://www.dsource.org/projects/goldie

Goldie (pronounced goal D) is a GOLD Engine for D. It gives D developers 
the ability to easily load, lex and parse a text/source file according to 
any grammar defined using the excellent GOLD Parser Builder tool ( 
http://www.devincook.com/goldparser/ ).


Alternatively, Goldie can be used to merely load a GOLD .cgt file (Compiled 
Grammar Table) if you would like to create your own GOLD lexer/parser.


Goldie is currently at it's first release, v0.01. It is fully-usable and has 
been tested on both Windows and Linux, although the API is still subject to 
change. Goldie is licensed under The zlib/libpng License.


I googled for GOLD vs ANTLR and only found a thread five years ago that 
stated ANTLR was better if you wanted the full kitchen sink, and GOLD 
was just a bunch of hacks.


Has somebody a link to a more recent comparison or do I have to write my 
own homework?


Re: Initial release of Goldie: GOLD Parser Engine for D

2009-08-28 Thread Nick Sabalausky
Grzegorz Adam Hankiewicz gra...@titanium.sabren.com wrote in message 
news:h78ojv$du...@digitalmars.com...

 I googled for GOLD vs ANTLR and only found a thread five years ago that 
 stated ANTLR was better if you wanted the full kitchen sink, and GOLD was 
 just a bunch of hacks.

 Has somebody a link to a more recent comparison or do I have to write my 
 own homework?

You're right, it does seem to be hard to find a good comparison of the two. 
Here's what I was able to find:

Another one a few years old:
http://www.antlr.org/pipermail/antlr-interest/2004-October/009730.html

Newer, but somewhat one-sided in favor of GOLD:
http://books.slashdot.org/comments.pl?sid=566251cid=23579953

Includes a lot of other parser generators:
http://en.wikipedia.org/wiki/Comparison_of_parser_generators#Context-free_languages

I have only very limited experience with ANTLR, and I've spent much more 
time with GOLD (Which I personally prefer, as you can probably tell from the 
fact that I wrote a GOLD engine ;) ), but here's my best attempt at an 
accurate neutral comparison:

[Neutral?] - GOLD is LALR and ANTLR is LL(*) (For whatever that information 
is worthYou could probably find an LALR vs LL(*) comparison somewhere.)

[Pro ANTLR] - ANTLR is open-source and cross-platform (because it runs on 
the JVM). But, GOLD is only available on Windows (although it might work on 
wine, I haven't tried) and doesn't have any released source (although it is 
freeware). However, FWIW, I do intend to make and release an open-source 
cross-platform equivalent to GOLD (fully-compatible with GOLD, of course).

[Pro ANTLR] - ANTLR's grammar definition syntax includes certain bells and 
whistles that GOLD doesn't have, like extensive rewrite rules (with GOLD, 
you have to do rewrites yourself in your app).

[Pro GOLD] - I personally find ANTLR very difficult to learn as it's 
documentation seems to be quite poor. GOLD has very good documentation 
(although that's probably to be expected since GOLD seems to be much 
simpler).

[Pro ANTLR] - ANTLR seems to be much more popular and more heavily used. 
Sometimes a large user base can be good.

[Pro GOLD] - GOLD has much better support for various host languages (by 
that I mean languages that can be used to write the programs that will 
parse/manipulate the generated grammars). GOLD already supports far more 
host languages than ANTLR, and I'm certain this is because adding support 
for a host language is far easier in GOLD. Also, there's no ANTLR for D (I 
tried a while ago, but gave up since it was such a huge painful undertaking, 
I basically would have had to port an entire production-level Java app to 
D).

[Neutral] - With GOLD, host language is completely separated from grammar. 
This allows for far more flexibility (see some of the items below) and it 
makes the grammars much more reusable, but the cost is that you lose the 
convenience of being able to embed code directly into your grammar.

[Pro GOLD] - Since ANTLR wants to convert all it's grammars directly to 
lexer/parser source code, it's not a good choice for programs that need to 
be able to work with grammars that the *users* of your program generate. For 
example, I used GOLD to write a program that outputs the parse tree of any 
source file written in any GOLD grammar. An equivalent ANTLR program would 
have been far more difficult to create and to use.

[Pro GOLD] - Both GOLD and ANTLR come with GUI tools to help build grammars, 
but ANTLR's official GUI tool only works with grammars that have embedded 
Java (ie, grammars that are designed to be generated into a Java app, and 
not any other host language.) Because of GOLD's language-neutrality, it's 
GUI tool is helpful regardless of your desired host app.

[Pro ANTLR?] - GOLD's GUI tool *is* GOLD, and so (unless I'm mistaken) you 
can't use it as a command-line app (but I've found compiling grammars with 
it to be very painless, anyway). I *think* ANTLR can be used command-line. 
(But again, FWIW, I do intend to create an GOLD-compatible program that will 
work on the command line)

[Neutral] - ANTLR's GUI tool is probably a little more fully-featured 
(although maybe doesn't provide quite as detailed information, but then, 
maybe it doesn't need to), but in my experience, it's also very sluggish and 
resource-intensive.




Re: Initial release of Goldie: GOLD Parser Engine for D

2009-08-28 Thread Leandro Lucarella
Nick Sabalausky, el 28 de agosto a las 16:47 me escribiste:
 [Pro ANTLR?] - GOLD's GUI tool *is* GOLD, and so (unless I'm mistaken) you 
 can't use it as a command-line app (but I've found compiling grammars with 
 it to be very painless, anyway). I *think* ANTLR can be used command-line. 
 (But again, FWIW, I do intend to create an GOLD-compatible program that will 
 work on the command line)

I don't know if you has seen Gazelle. It goal is similar to GOLD, to be
able to reuse the grammars easily. It's C and still in development (it
doesn't have any tools to write grammars or anything) but looks promising.

http://www.reverberate.org/gazelle/

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/

GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)

Are you nervy, irritable, depressed, tired of life.
Keep it up.
-- Monty Python


Re: Initial release of Goldie: GOLD Parser Engine for D

2009-08-28 Thread Nick Sabalausky
Leandro Lucarella llu...@gmail.com wrote in message 
news:20090828211541.ga31...@homero.springfield.home...
 Nick Sabalausky, el 28 de agosto a las 16:47 me escribiste:
 [Pro ANTLR?] - GOLD's GUI tool *is* GOLD, and so (unless I'm mistaken) 
 you
 can't use it as a command-line app (but I've found compiling grammars 
 with
 it to be very painless, anyway). I *think* ANTLR can be used 
 command-line.
 (But again, FWIW, I do intend to create an GOLD-compatible program that 
 will
 work on the command line)

 I don't know if you has seen Gazelle. It goal is similar to GOLD, to be
 able to reuse the grammars easily. It's C and still in development (it
 doesn't have any tools to write grammars or anything) but looks promising.

 http://www.reverberate.org/gazelle/


Interesting, thanks for the link. That does sound similar to what I want to 
do, just that I'm doing it in D and using GOLD as a starting point and 
growing from there. Be interesting to see how both turn out.




Re: OT - Which Linux?

2009-08-28 Thread Lars T. Kyllingstad

Paul D. Anderson wrote:

Paul D. Anderson Wrote:


I'm going to add Linux to my PC to get a dual-boot configuration. (I'm tired of 
slw start ups and want to tap into the great tools available.) The tutorial 
I'm looking at suggests Ubuntu. Is there a significant difference in Linux 
implementations? Is Ubuntu one of the better ones? Does it make a difference 
for running D2?

Thanks in advance for your hellp.

Paul



Thanks to everyone who contributed to my off-topic question. I installed Ubuntu 
over the weekend. It took me a couple of tries to get it right (mostly because 
I couldn't decide how to partition the disk) but the installation process was 
so painless that it wasn't hard to redo it. Now I'm getting acquainted with the 
OS. :-)

Thanks again!

Paul



Good luck! Always afraid of unfamilar territory, I first tried Linux in 
a dual-boot setup too, several years ago. I think it took about a week 
before I deleted the Windows partition, and I've been using Linux 
exclusively ever since. :)


-Lars


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright

Jeremie Pelletier wrote:

Isn't it possible to make 'const ref S' or 'in S' generate the same
machine code as 'in S*'? To me it would seem the semantics of the two
are the same, with 'const S*' being useful syntax for C compatibility
while 'in S' and 'const ref S' are both D syntax.


The thing about const is it only specifies a read only view of an 
object, it does *not* specify that the referenced object will not 
change. That is why pass by value cannot be optimized to be pass by 
reference.




Re: OT - Which Linux?

2009-08-28 Thread language_fan
Fri, 28 Aug 2009 08:18:57 -0500, Andrei Alexandrescu thusly wrote:

 Same here! And the step looked unconceivable just a couple months
 earlier. I remember how a friend who was in the beginning stages of
 Linux asked me several times and very incredulously: What do you mean
 you don't have Windows at all on your laptop?

Linux has matured a lot since the early days. When I first tried it, it 
took me 4 years and 2 PC upgrades to get a compatible graphics card which 
was able to display anything other than the 80x25 text mode and 
320x200x4b on xfree86. No, I don't want to manually type some weird bit 
counts and internal clock frequencies ever again!

I bought my first nvidia card in 1999 and everything has worked almost 
flawlessly since then. And that's not even the worst part, 10 years ago 
there was no ntfs write support, many sound drivers sucked, hotplug 
sucked, 56k internal modem drivers sucked, even the mouse drivers acted 
randomly, fscking ext2 (ext3 didn't exist yet!) was dreadfully slow, and 
the distro cds came with broken compiler packages. The fresh new 
installation was mostly useful for learning bash and perl, but not much 
more, a graphical desktop would have been something awesome.


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread downs
Walter Bright wrote:
 Jeremie Pelletier wrote:
 Isn't it possible to make 'const ref S' or 'in S' generate the same
 machine code as 'in S*'? To me it would seem the semantics of the two
 are the same, with 'const S*' being useful syntax for C compatibility
 while 'in S' and 'const ref S' are both D syntax.
 
 The thing about const is it only specifies a read only view of an
 object, it does *not* specify that the referenced object will not
 change. That is why pass by value cannot be optimized to be pass by
 reference.
 

To elaborate on this, consider this case:

import std.stdio;

struct X { int v; }

void test(X x, void delegate() dg) { writefln(x.v); dg(); writefln(x.v); }

void main() {
  X ecks;
  test(ecks, { ecks.v = 17; });
}


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Jeremie Pelletier
downs Wrote:

 Walter Bright wrote:
  Jeremie Pelletier wrote:
  Isn't it possible to make 'const ref S' or 'in S' generate the same
  machine code as 'in S*'? To me it would seem the semantics of the two
  are the same, with 'const S*' being useful syntax for C compatibility
  while 'in S' and 'const ref S' are both D syntax.
  
  The thing about const is it only specifies a read only view of an
  object, it does *not* specify that the referenced object will not
  change. That is why pass by value cannot be optimized to be pass by
  reference.
  
 
 To elaborate on this, consider this case:
 
 import std.stdio;
 
 struct X { int v; }
 
 void test(X x, void delegate() dg) { writefln(x.v); dg(); writefln(x.v); }
 
 void main() {
   X ecks;
   test(ecks, { ecks.v = 17; });
 }

Ok, I understand why it cant be done for 'in S' but I don't see why 'const ref 
S' cannot have the same semantics as 'in S*', unless 'ref' doesn't mean that 
the struct is implicitly dereferenced.

Here is some code to illustrate my point of view:

struct S { int i; }
S s;

void Stuff() { s.i++; }

void Foo(in S* s) {
writefln(s.i);
Stuff();
writefln(s.i);
}
void Bar(const ref S s) {
writefln(s.i);
Stuff();
writefln(s.i);
}

int main() {
// Those both do the exact same thing
Foo(s);
Bar(s);
}

If they are meant to have different semantics, then when is a good time to use 
ref? It would seem to me 'in S*' and 'S*' carry both behaviors you want in a 
referenced parameter: const and mutable. In any case only the reference is 
passed by value, not the struct itself.

If the method calls another method which modifies the const view on the 
reference, then it should be a logic error from the programmer (good old 
shooting yourself in the foot) without the compiler getting in the way. Making 
fool-proof language semantics is a good idea, but IMO it shouldn't impact 
performance, or else any bit of code looking for time critical performance will 
never use the syntax that makes D shine, and a lot of confusion will spread 
around as both types of syntax are used. It also makes it confusing to 
interface with IDL.

Alls I'm suggesting is that 'const ref S' and 'ref S' generate the same machine 
code as 'in S*' and 'S*', which would prevent us from using different syntax to 
get the performance boost, when in the end the intended behavior is the same.


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Jarrett Billingsley
On Thu, Aug 27, 2009 at 8:17 PM, Walter
Brightnewshou...@digitalmars.com wrote:
 Jeremie Pelletier wrote:

 Isn't there a way to implement RVO to work on parameters (PVO?) too
 if the storage is const?

 No, and it doesn't work for C++ either. Consider:


You're addressing the 'const' issue, but you haven't addressed the
OP's issue: that 'ref', for whatever reason, prevents inlining. Const
aside, why is this so?


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright

Jarrett Billingsley wrote:

You're addressing the 'const' issue, but you haven't addressed the
OP's issue: that 'ref', for whatever reason, prevents inlining. Const
aside, why is this so?


Because I never updated the inlining code to handle it.


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Jarrett Billingsley
On Fri, Aug 28, 2009 at 4:20 PM, Walter
Brightnewshou...@digitalmars.com wrote:
 Jarrett Billingsley wrote:

 You're addressing the 'const' issue, but you haven't addressed the
 OP's issue: that 'ref', for whatever reason, prevents inlining. Const
 aside, why is this so?

 Because I never updated the inlining code to handle it.

Well I'm glad it's that simple, and I'm sure Jeremie is too ;)


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright

Jarrett Billingsley wrote:

On Fri, Aug 28, 2009 at 4:20 PM, Walter
Brightnewshou...@digitalmars.com wrote:

Jarrett Billingsley wrote:

You're addressing the 'const' issue, but you haven't addressed the
OP's issue: that 'ref', for whatever reason, prevents inlining. Const
aside, why is this so?

Because I never updated the inlining code to handle it.


Well I'm glad it's that simple, and I'm sure Jeremie is too ;)


There are a lot of D specific optimization opportunities that are left 
undone for now.


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Bill Baxter
On Fri, Aug 28, 2009 at 1:20 PM, Walter
Brightnewshou...@digitalmars.com wrote:
 Jarrett Billingsley wrote:

 You're addressing the 'const' issue, but you haven't addressed the
 OP's issue: that 'ref', for whatever reason, prevents inlining. Const
 aside, why is this so?

 Because I never updated the inlining code to handle it.

Wow.  That's it?  So let's get it done already!  This is really a
shame to have this hanging around in a language whose biggest selling
point over the competition is speed.   It's been shown many times that
DMD's failure to inline ref args has significant impact (~10%) on the
performance of numerical code.  If you can easily give these kinds of
code a 10% boost without too much effort then that's a big win in my
opinion.

--bb


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Brad Roberts
On Fri, 28 Aug 2009, Bill Baxter wrote:

 On Fri, Aug 28, 2009 at 1:20 PM, Walter
 Brightnewshou...@digitalmars.com wrote:
  Jarrett Billingsley wrote:
 
  You're addressing the 'const' issue, but you haven't addressed the
  OP's issue: that 'ref', for whatever reason, prevents inlining. Const
  aside, why is this so?
 
  Because I never updated the inlining code to handle it.
 
 Wow.  That's it?  So let's get it done already!  This is really a
 shame to have this hanging around in a language whose biggest selling
 point over the competition is speed.   It's been shown many times that
 DMD's failure to inline ref args has significant impact (~10%) on the
 performance of numerical code.  If you can easily give these kinds of
 code a 10% boost without too much effort then that's a big win in my
 opinion.
 
 --bb

Ok.. so we should expect a patch from you sometime soon?  You did include 
yourself in the 'us' inside let's, right?


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Ary Borenszweig

Walter Bright escribió:

Jarrett Billingsley wrote:

On Fri, Aug 28, 2009 at 4:20 PM, Walter
Brightnewshou...@digitalmars.com wrote:

Jarrett Billingsley wrote:

You're addressing the 'const' issue, but you haven't addressed the
OP's issue: that 'ref', for whatever reason, prevents inlining. Const
aside, why is this so?

Because I never updated the inlining code to handle it.


Well I'm glad it's that simple, and I'm sure Jeremie is too ;)


There are a lot of D specific optimization opportunities that are left 
undone for now.


Why?

Seeing D as a systems language with features form high-level languages 
but without the performance penalty so you can prefer it over 
C/C++/Java/C# etc., if D's performance isn't that good then there's not 
much competition for people coming from either sides that expect high 
performance.


bearophile and others from time to time complain about performance 
issues in D, just because D promises performance. I think this is more 
important that adding more features that won't give you higher performance.


performance

(sorry, had to repeat that word one more time :-P)


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Bill Baxter
On Fri, Aug 28, 2009 at 3:21 PM, Brad Robertsbra...@puremagic.com wrote:
 On Fri, 28 Aug 2009, Bill Baxter wrote:

 On Fri, Aug 28, 2009 at 1:20 PM, Walter
 Brightnewshou...@digitalmars.com wrote:
  Jarrett Billingsley wrote:
 
  You're addressing the 'const' issue, but you haven't addressed the
  OP's issue: that 'ref', for whatever reason, prevents inlining. Const
  aside, why is this so?
 
  Because I never updated the inlining code to handle it.

 Wow.  That's it?  So let's get it done already!  This is really a
 shame to have this hanging around in a language whose biggest selling
 point over the competition is speed.   It's been shown many times that
 DMD's failure to inline ref args has significant impact (~10%) on the
 performance of numerical code.  If you can easily give these kinds of
 code a 10% boost without too much effort then that's a big win in my
 opinion.

 --bb

 Ok.. so we should expect a patch from you sometime soon?  You did include
 yourself in the 'us' inside let's, right?

I'm actually surprised Don hasn't jumped on this one, given that it's
primarily numerical code that it seems to be affecting.   If I were
still at my old job using D heavily,  I would probably take a whack at
fixing this one, just because it has been such an annoyance to me.   I
put up with it figuring it would be fixed someday, and I assumed there
must be something tricky about it or else it would have been done
already.  But given Walter's answer just now, it sounds like a quick
fix for him or someone else familiar with the compilers internals.

--bb


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Bill Baxter
On Fri, Aug 28, 2009 at 5:01 PM, Ary Borenszweiga...@esperanto.org.ar wrote:
 Walter Bright escribió:

 Jarrett Billingsley wrote:

 On Fri, Aug 28, 2009 at 4:20 PM, Walter
 Brightnewshou...@digitalmars.com wrote:

 Jarrett Billingsley wrote:

 You're addressing the 'const' issue, but you haven't addressed the
 OP's issue: that 'ref', for whatever reason, prevents inlining. Const
 aside, why is this so?

 Because I never updated the inlining code to handle it.

 Well I'm glad it's that simple, and I'm sure Jeremie is too ;)

 There are a lot of D specific optimization opportunities that are left
 undone for now.

 Why?

 Seeing D as a systems language with features form high-level languages but
 without the performance penalty so you can prefer it over C/C++/Java/C#
 etc., if D's performance isn't that good then there's not much competition
 for people coming from either sides that expect high performance.

 bearophile and others from time to time complain about performance issues in
 D, just because D promises performance. I think this is more important that
 adding more features that won't give you higher performance.


I think it's perfectly justified to put off optimizations that are
tricky or only pay off in odd circumstances.   But from Walter's
comment it sounds like this one shouldn't be any harder than enabling
the pointer inlining path for ref args too.  And the payoff would be
decent.

--bb


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Walter Bright

Ary Borenszweig wrote:

Walter Bright escribió:
There are a lot of D specific optimization opportunities that are left 
undone for now.

Why?


Which of the thousand things people want done in D should be done first?


Re: Reference value of structs not optimized or inlined?

2009-08-28 Thread Christopher Wright

Walter Bright wrote:

Ary Borenszweig wrote:

Walter Bright escribió:
There are a lot of D specific optimization opportunities that are 
left undone for now.

Why?


Which of the thousand things people want done in D should be done first?


Those that the askers are willing to implement first, I'd say.


1.0: Missing libs errors

2009-08-28 Thread jicman

Greetings and salutations.

I am trying to compile a program that worked fine with 1.030 and juno 0.5.1, 
but I am trying to compile with 1.046.   I am getting this errors:

17:31:50.57build -I..;c:\dmd\import -version=gui -version=Phobos OpenProjs.d
OPTLINK (R) for Win32 Release 8.00.1
Copyright (C) Digital Mars 1989-2004 All rights reserved.
C:\cygwin\home\us319318\source\d\juno\base\native.obj(native) Offset 002D8H 
Record Type 0091
Error 1: Previous Definition Different : _RT_STRING
version.lib
Warning 2: File Not Found version.lib
crypt32.lib
Warning 2: File Not Found crypt32.lib
OpenProjs.obj(OpenProjs)
Error 42: Symbol Undefined _D3dbi3all12__ModuleInfoZ
C:\cygwin\home\us319318\source\d\juno\com\core.obj(core)
Error 42: Symbol Undefined _var...@16
C:\cygwin\home\us319318\source\d\juno\com\core.obj(core)
Error 42: Symbol Undefined _vardec...@8

i have no idea what to do because I don't have any calls to any libs called 
version or crypt32.

Any ideas?

thanks,

josé


Re: What time is it?

2009-08-28 Thread Jarrett Billingsley
On Fri, Aug 28, 2009 at 11:03 PM, jicmancabre...@_wrc.xerox.com wrote:
 Chad J Wrote:

 Max wrote:
  Is there any way in Phobos to measure the current time with microsecond 
  accuracy?
 
  Max

 Might I suggest std.perf?

 I found it here some years ago:
 http://www.digitalmars.com/techtips/timing_code.html

 It even seems to have survived the transition from D1 to D2.

 Oddly enough, this rather useful module never seems to never be included
 in the web documentation.  :(

 Just read the comments in the source file that comes with your compiler.
 {dmd-path}/src/phobos/std/perf.d

 I've always used PerformanceCounter with good results.

 I also use it.  Why does it not get inserted on D1 and D2?

 thanks,

 josé

std.perf was added *years* ago, in D's infancy. It wasn't even written
by Walter, so the docs never made it into the DM pages. The
documentation embedded in it isn't even DDoc, it's Doxygen. It's
always been sort of a misfit.


[Issue 3037] Off-by-one error in Stride.length

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3037





--- Comment #2 from Andrei Alexandrescu and...@metalanguage.com  2009-08-27 
23:38:34 PDT ---
(In reply to comment #1)
 I fixed length like this:
 
 return (_input.length - 1) / _n + 1;
 
 Thanks!

In fact this doesn't work for _input.length == 0. So I rewrote it as:

return (_input.length + _n - 1) / _n

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3074] std.conv.to!(string)(int.min)

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3074


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3132] std.string.split should be templated on mutable/const/immutable

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3132


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3148] syntax error using invariant

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3148


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com  2009-08-27 
23:48:00 PDT ---
Thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3184] std.algorithm.until should work like find

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3184


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2987] D2 phobos BigInt opMul doesn't work correctly

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2987


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED




--- Comment #3 from Don clugd...@yahoo.com.au  2009-08-28 05:47:53 PDT ---
Thanks!
Actually both cases of updateShr should probably be updateUShr, although AFAICT
the result of the second one is never actually used, so it's a bit irrelevant.
Fixed in svn 1251.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3189] `std.conv.to` : check for a custom `to` method in classes/structs

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3189


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
08:28:09 PDT ---
Ok. I implemented this:

/**
Object-_to-non-object conversions look for a method to of the source
object.

Example:

class Date
{
T to(T)() if(is(T == long))
{
return timestamp;
}
...
}

unittest
{
auto d = new Date;
auto ts = to!long(d); // same as d.to!long()
}

 */
T to(T, S)(S value) if (is(S : Object)  !is(T : Object)  !isSomeString!T
 is(typeof(S.init.to!(T)()) : T))
{
return value.to!T();
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3195] `std.conv` pureness

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3195


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||LATER




--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
08:34:52 PDT ---
They should, but many are not automatically checkable. For example, the
array-to-array conversion writes to a local temporary and then returns it.
Technically that is pure, but the compiler cannot prove that as of this time. I
will close this for now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3199] sort(chain(...)) doesn't work in some cases

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3199


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




--- Comment #2 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
09:10:41 PDT ---
The first example creates three empty slices a, b, and c. Then abc is defined
as a slice of slices initialized with those empty slices. Subsequently abc is
filled but the initial slices a, b, and c remain empty. Therefore sort(chain(a,
b, c)) sorts an empty range so it is ineffectual.

The second example (after fixing) works indeed correctly because abc does not
undergo modifications independently from a, b, and c.

The third example is subtle. Assigning to the length of a slice, e.g.

t,length = uniform(8, 17);

may or may not spawn a new allocation (and therefore a divergence of what abc
holds versus what a, b, and c hold individually). Therefore, the behavior will
be erratic depending on what the random number generator yields.

Assigning to length in slices has always had that danger. We have recently
decided to prevent assignable length and defining a separate array type that
has modifiable length.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 2979] Xml tags with only attributes return as without attributes ElementParser.parse

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=2979


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||and...@metalanguage.com
 Resolution||FIXED




--- Comment #6 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
09:17:31 PDT ---
I have integrated hed010gy's first (small) fix but nothing else. We need to
rewrite xml, so fixing it thoroughly first would be a bad investment.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3218] Performance of std.xml.encode must be improved

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3218


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




--- Comment #1 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
09:54:16 PDT ---
I changed encode (which was indeed horrendous) to this:

S encode(S)(S s, S buffer = null)
{
string r;
size_t lastI;
if (buffer) buffer.length = 0;
auto result = Appender!(string)(buffer);

foreach (i, c; s)
{
switch (c)
{
case '':  r = amp;; break;
case '':  r = quot;; break;
case '\'': r = apos;; break;
case '':  r = lt;; break;
case '':  r = gt;; break;
default: continue;
}
// Replace with r
result.put(s[lastI .. i]);
result.put(r);
lastI = i + 1;
}

if (!result.data) return s;
result.put(s[lastI .. $]);
return result.data;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3219] Inaccurate std.conv.to!(numeric)(numeric) error messages

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3219


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3225] std.string function name casing

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3225


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||REMIND




--- Comment #2 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
10:51:52 PDT ---
This makes sense but the names as chosen reflect existing Python and Ruby APIs.
I'm not sure how to proceed about this. Thoughts?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3269] New: pure functions silently become nothrow

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3269

   Summary: pure functions silently become nothrow
   Product: D
   Version: unspecified
  Platform: Other
OS/Version: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: DMD
AssignedTo: nob...@puremagic.com
ReportedBy: and...@metalanguage.com


class A
{
pure static void raise(string s)
{
throw new Exception(s);
}
}

void main()
{
A.raise(a);
}

This code compiles and runs without an error!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3242] splitter does not handle input range made of a unique separator correctly

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3242


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3245] Easy bug fix available for disabled unit test code in std.encoding

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3245


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




--- Comment #2 from Andrei Alexandrescu and...@metalanguage.com  2009-08-28 
12:43:36 PDT ---
Thanks for the precise instructions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 3249] sort and setIntersection on array of struct or class

2009-08-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3249


Andrei Alexandrescu and...@metalanguage.com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED




-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---