Re: dmd 1.043 alpha for FreeBSD 7.1
On Thu, Apr 16, 2009 at 1:08 AM, Jordan Miner jminer2...@nospam.students.pcci.edu wrote: Walter Bright Wrote: Because gcc on linux predefines linux, not Linux. Please change the version identifier from linux to Linux. I realise I probably did my part to spike this discussion. However, given the complaints Walter got from adding the Posix identifier, removing linux is obviously a really bad idea. But I must say I think Linux should be added, and linux be there for legacy reasons, like darwin I guess. -Tomas
Re: dmd 1.043 alpha for FreeBSD 7.1
Walter Bright wrote: Jacob Carlborg wrote: They call it Mac OS, then they add a version like this: Mac OS 9. Then when the tenth versions came it happened to be built on a nix base/core (known as darwin) and they also added the X (probably to reflect the new nix base, X is also ten using roman numerals) making it: Mac OS X. They still call it mac os ten (though some people, including me, like to call it mac os x and pronounce the x as in the letter x). After the x they add a name to reflect the version i.e. Leopard for version 10.5. Sometimes they refer to the os version with the name and sometimes with the version number. Apple calls it Mac OS X version 10.5. There is little consistency in how Apple names their OSs, so there is no way to come up with a version identifier for it that is completely consistent. About the darwin vs OSX. There are other operating systems than Mac OS X that could use darwin as the version identifier if someone made a D compiler available. iPhone OS (this is just Mac OS X on the iphone and ipod thouch but it's called iPhone OS) and GNU/Darwin for example.
Re: dmd 1.043 alpha for FreeBSD 7.1
Tomas Lindquist Olsen, el 16 de abril a las 10:46 me escribiste: On Thu, Apr 16, 2009 at 1:08 AM, Jordan Miner jminer2...@nospam.students.pcci.edu wrote: Walter Bright Wrote: Because gcc on linux predefines linux, not Linux. Please change the version identifier from linux to Linux. I realise I probably did my part to spike this discussion. However, given the complaints Walter got from adding the Posix identifier, removing linux is obviously a really bad idea. But I must say I think Linux should be added, and linux be there for legacy reasons, like darwin I guess. This seems like a reasonable tradeoff, issuing a deprecation warning when the legacy version identifiers are used can be a good idea too, so people can update the code eventually and the redundant identifiers can be removed in the future. -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
Re: dmd 1.043 alpha for FreeBSD 7.1
Jacob Carlborg wrote: About the darwin vs OSX. There are other operating systems than Mac OS X that could use darwin as the version identifier if someone made a D compiler available. iPhone OS (this is just Mac OS X on the iphone and ipod thouch but it's called iPhone OS) and GNU/Darwin for example. I wasn't aware of that. Would the OSX compiler and Phobos run out of the box on them?
Re: dmd 1.043 alpha for FreeBSD 7.1
On Thu, Apr 16, 2009 at 19:32, Walter Bright newshou...@digitalmars.com wrote: Jacob Carlborg wrote: About the darwin vs OSX. There are other operating systems than Mac OS X that could use darwin as the version identifier if someone made a D compiler available. iPhone OS (this is just Mac OS X on the iphone and ipod thouch but it's called iPhone OS) and GNU/Darwin for example. I wasn't aware of that. Would the OSX compiler and Phobos run out of the box on them? You could probably make dmd run on some GNU/Darwin, but it's sort of dead. There's http://www.puredarwin.org/ but I'm not sure if it actually works yet. The iPhone is an ARM platform so dmd would certainly not work there... -- Anders Bergh
Re: dmd 1.043 alpha for FreeBSD 7.1
Walter Bright wrote: Jacob Carlborg wrote: They call it Mac OS, then they add a version like this: Mac OS 9. Then when the tenth versions came it happened to be built on a nix base/core (known as darwin) and they also added the X (probably to reflect the new nix base, X is also ten using roman numerals) making it: Mac OS X. They still call it mac os ten (though some people, including me, like to call it mac os x and pronounce the x as in the letter x). After the x they add a name to reflect the version i.e. Leopard for version 10.5. Sometimes they refer to the os version with the name and sometimes with the version number. Apple calls it Mac OS X version 10.5. There is little consistency in how Apple names their OSs, so there is no way to come up with a version identifier for it that is completely consistent. There's a good word for them. They're Good Marketers. Now, in an honest man's world that is equivalent with Good Liars. (The definition being, whenever a liar is good at achieving his goal, and at the same time avoiding accusations of lying, then he's a Good Liar. We had a discussion about this in Elementary School, on the school yard. Of course, the bigger boys won, but that didn't mean that the rest of us would forget it, ever.) So, in anticipation of how the world goes, all we need is a table lookup. Apple this or that, translates to this or that Version.
Re: dmd 1.043 alpha for FreeBSD 7.1
Anders Bergh wrote: You could probably make dmd run on some GNU/Darwin, but it's sort of dead. There's http://www.puredarwin.org/ but I'm not sure if it actually works yet. The iPhone is an ARM platform so dmd would certainly not work there... If dmd/phobos binaries for osx won't work on those machines, then it's appropriate to have a different version identifier.
Re: dmd 1.043 alpha for FreeBSD 7.1
Hello Walter, If dmd/phobos binaries for osx won't work on those machines, then it's appropriate to have a different version identifier. I'd assert the test should be if the systems are source code compatible.
Re: dmd 1.043 alpha for FreeBSD 7.1
Walter Bright wrote: Anders Bergh wrote: You could probably make dmd run on some GNU/Darwin, but it's sort of dead. There's http://www.puredarwin.org/ but I'm not sure if it actually works yet. The iPhone is an ARM platform so dmd would certainly not work there... If dmd/phobos binaries for osx won't work on those machines, then it's appropriate to have a different version identifier. So you're saying version(linux) shouldn't be defined on PPC or ARM Linux systems? After all, dmd/phobos binaries for Linux won't run on them... (I agree with BCS; the test should be source code compatibility)
Re: dmd 1.043 alpha for FreeBSD 7.1
Frits van Bommel wrote: Walter Bright wrote: Anders Bergh wrote: You could probably make dmd run on some GNU/Darwin, but it's sort of dead. There's http://www.puredarwin.org/ but I'm not sure if it actually works yet. The iPhone is an ARM platform so dmd would certainly not work there... If dmd/phobos binaries for osx won't work on those machines, then it's appropriate to have a different version identifier. So you're saying version(linux) shouldn't be defined on PPC or ARM Linux systems? After all, dmd/phobos binaries for Linux won't run on them... (I agree with BCS; the test should be source code compatibility) I meant if they were running on an x86 yet the binaries are different.
Re: dmd 1.043 alpha for FreeBSD 7.1
On Fri, Apr 17, 2009 at 02:18, Walter Bright newshou...@digitalmars.com wrote: Anders Bergh wrote: You could probably make dmd run on some GNU/Darwin, but it's sort of dead. There's http://www.puredarwin.org/ but I'm not sure if it actually works yet. The iPhone is an ARM platform so dmd would certainly not work there... If dmd/phobos binaries for osx won't work on those machines, then it's appropriate to have a different version identifier. The current dmd binaries would run and work on PureDarwin as long as they don't use Cocoa or Carbon etc (which I doubt they do). -- Anders Bergh
Re: Vectors and matrices
Andrei Alexandrescu wrote: Lars Kyllingstad wrote: I am writing a D library based some of the stuff in SLATEC, and I've come to a point where I need to decide on a way to manipulate vectors and matrices. To that end, I have some ideas and questions I would like comments on from the community. Ideally, I want to restrict the user as little as possible, so I'm writing heavily templated code in which one can use both library-defined vector/matrix types and built-in arrays (both static and dynamic). My reasons for this are: a) Different problems may benefit from different types. Sparse matrices, dense matrices, triangular matrices, etc. can all be represented differently based on efficiency and/or memory requirements. I use all of the above. It would be great to have them all within an integrated framework. I don't think I'm the man to provide you with that, at least not yet. I have next to no experience with high-performance linear algebra. This is a major part of the reason why I want to let people choose for themselves what matrix types/libraries they want to use in conjunction with my stuff. Therefore I am, for now, focusing on other things. I am about halfway done writing D versions of the QUADPACK routines, and I have started work on MINPACK. It is for the latter that some basic linear algebra functionality is needed. You could take a look at Bill Baxter's MultiArray library, which contains wrappers for several linear algebra libraries, as well as storage formats for different types of matrices. Also, I think, it works with Don's BLADE library. (Kudos to Don for that awesome name, by the way -- it's a lot cooler than BLAS.) Both are written in D1, though. b) I hope that, at some point, my library will be of such a quality that it may be useful to others, and in that event I will release it. Interoperability with other libraries is therefore a goal for me, and a part of this is to let the user choose other vector/matrix types than the ones provided by me. Yes please. It would be great if you considered submitting it to Phobos. I agree that a set of decent vector and matrix types should be put into phobos. But the packages I mention above are perhaps more suited for a dedicated scientific library, don't you think? Right now I use D1, but I've been looking at the new phobos lately, and I have to say that the combination D2+phobos2 is a very enticing one. Writing array wrappers has never been easier than with the new alias this feature. :) If it weren't for the lack of a 64-bit compiler for Linux I would switch immediately. As it is, I am seriously considering using the 32-bit one, even though it just feels... wrong. Actually, I tried compiling my lib with the latest 32-bit DMD2. Immediately after pressing enter, memory usage went through the roof and my computer became completely unresponsive. It took me forever to kill the dmd process. I guess it has something to do with the heavy use of templates. Has anyone else experienced this? c) Often, for reasons of both efficiency and simplicity, it is desirable to use arrays directly. Yah. My first question goes to those among you who do a lot of linear algebra in D: Do you think supporting both library types and arrays is worth the trouble? Or should I just go with one and be done with it? If you go templated you don't need to explicitly support built-in arrays - they'll just work. Yeah, vectors work fine, especially now that D has built-in vector operations. The problem is with matrices, as described in the following. A user-defined matrix type would have opIndex(i,j) defined, and to retrieve elements one would write m[i,j]. Yah. However, the syntax for two-dimensional arrays is m[i][j], and this means I have to put a lot of static ifs around my code, in order to check the type every time I access a matrix. No, that's not a two-dimensional array; it's an array of arrays. If you want to make your lib work with arrays of arrays, you could easily build a little wrapper arround it (e.g. JaggedMatrix). OK, technically it may not be what is called a two-dimensional array. But it's the closest we've got, no? Or perhaps that would be a rectangular (static) array, but those still have the [][] indexing syntax. This leads me to my second question, which is a suggestion for a language change, so I expect a lot of resistance. :) Would it be problematic to define m[i,j,...] to be equivalent to m[i][j][...] for built-in arrays, so that arrays and user-defined types could be used interchangeably? (And, importantly, are there anyone but me who think they would benefit from this?) This wouldn't harm, but it would be a special case. I know, and possibly an esoteric one, at that. But it would make it easier to create drop-in array replacements. -Lars
Re: Vectors and matrices
Robert Jacques wrote: On Wed, 15 Apr 2009 10:07:38 -0400, Lars Kyllingstad pub...@kyllingen.nospamnet wrote: I am writing a D library based some of the stuff in SLATEC, and I've come to a point where I need to decide on a way to manipulate vectors and matrices. To that end, I have some ideas and questions I would like comments on from the community. Ideally, I want to restrict the user as little as possible, so I'm writing heavily templated code in which one can use both library-defined vector/matrix types and built-in arrays (both static and dynamic). My reasons for this are: a) Different problems may benefit from different types. Sparse matrices, dense matrices, triangular matrices, etc. can all be represented differently based on efficiency and/or memory requirements. b) I hope that, at some point, my library will be of such a quality that it may be useful to others, and in that event I will release it. Interoperability with other libraries is therefore a goal for me, and a part of this is to let the user choose other vector/matrix types than the ones provided by me. c) Often, for reasons of both efficiency and simplicity, it is desirable to use arrays directly. My first question goes to those among you who do a lot of linear algebra in D: Do you think supporting both library types and arrays is worth the trouble? Or should I just go with one and be done with it? I'd say its worth the trouble. A user-defined matrix type would have opIndex(i,j) defined, and to retrieve elements one would write m[i,j]. However, the syntax for two-dimensional arrays is m[i][j], and this means I have to put a lot of static ifs around my code, in order to check the type every time I access a matrix. This leads me to my second question, which is a suggestion for a language change, so I expect a lot of resistance. :) I consider m[i][j] to be a jagged array, which is logically different from matrix types. (i.e. its not square, etc.) Would it be problematic to define m[i,j,...] to be equivalent to m[i][j][...] for built-in arrays, so that arrays and user-defined types could be used interchangeably? Actually, I'd prefer actual dense arrays over syntactic sugar for jagged arrays. Me too, but that's a bigger language change. At least there ought to be a matrix type in the standard library. (And, importantly, are there anyone but me who think they would benefit from this?) -Lars Good numerics and linear algebra is always appreciated. To that end there's a nice performance speedup in storing machine/byte strides instead of logical/element strides. (See: http://dobbscodetalk.com/index.php?option=com_contenttask=viewid=502Itemid=52 Also, my lab maintains a vector/numerics/robotics package that might be of interest https://trac.lcsr.jhu.edu/cisst) Thanks for the tip! -Lars
Re: Why does readln include the line terminator?
Stewart Gordon Wrote: So you expect text editors to discard both kinds of information? No. Text editor is a *specialized* text processing tool and it usually uses specialized text processing algorithms. Otherwise it is *quite* decent.
Re: Vectors and matrices
Lars Kyllingstad Wrote: I am writing a D library based some of the stuff in SLATEC, and I've come to a point where I need to decide on a way to manipulate vectors and matrices. To that end, I have some ideas and questions I would like comments on from the community. My first question goes to those among you who do a lot of linear algebra in D: Do you think supporting both library types and arrays is worth the trouble? Or should I just go with one and be done with it? A user-defined matrix type would have opIndex(i,j) defined, and to retrieve elements one would write m[i,j]. However, the syntax for two-dimensional arrays is m[i][j], and this means I have to put a lot of static ifs around my code, in order to check the type every time I access a matrix. This leads me to my second question, which is a suggestion for a language change, so I expect a lot of resistance. :) Would it be problematic to define m[i,j,...] to be equivalent to m[i][j][...] for built-in arrays, so that arrays and user-defined types could be used interchangeably? (And, importantly, are there anyone but me who think they would benefit from this?) -Lars If your looking for votes you have mine. I'd like to see a consistent interface for multidimensional rectangular arrays using the m[i,j,k,...] syntax. I know we've got people, like yourself, to provide implementations. Paul
Spec of align attribute is a mess
The great inapplicable attribute debate http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=87915 drifted into a discussion on alignment in relation to unions. However, I've looked around the spec and found that quite a bit of work is needed on the specification of align as a whole. 1. ctod.html says Clearly, since much of the point to setting alignment is for portability of data, a portable means of expressing it is necessary. However, attribute.html says AlignAttribute is meant for C ABI compatiblity [sic], which is not the same thing as binary compatibility across diverse platforms. For that, use packed structs: which is basically claiming that align isn't good for portability of data after all. 2. Still on attribute.html, the basic documentation of align says Specifies the alignment of struct members. align by itself sets it to the default, which matches the default member alignment of the companion C compiler. Integer specifies the alignment which matches the behavior of the companion C compiler when non-default alignments are used. What if the companion C compiler: - doesn't exist? - has no alignment control facilities? - has alignment control only on whole structs - IWC how should alignment applied to individual members be interpreted? - doesn't support a particular align value that's used in the D code? Moreover, if the sole purpose of align is to provide an interface to C-compiler-dependent alignment features, then this is incongruous with alignment control being given as one of D's improvements over C. It may be the case that _a standardised notation for_ alignment control is an improvement, but that's different. 3. What kind of alignment is it meant to be anyway? Absolute (based on raw memory addresses) or relative (to the beginning of the struct)? It seems that various people have assumed various answers to this. Together with the inapplicable attribute debate, this affects the logicality of the statement on attribute.html AlignAttribute is ignored when applied to declarations that are not structs or struct members. If alignment is relative, then it's naturally inapplicable to anything that isn't a struct or a member thereof. If OTOH alignment is absolute, some attempts to use align become cases of an attribute that makes sense in the context being silently ignored. There are probably other issues with the align documentation, but I can't think of them at the mo Thoughts? Stewart.
Re: Ternary Search Trees
On 2009-04-16 18:19:36 +0200, bearophile bearophileh...@lycos.com said: [...] struct TST(T) { TST* left, right; union { TST* mid; int index; } T item; // methods here } Note that inside there you don't need TST!(T)*, TST* is probably enough, but I don't know why yet. struct TST(T){ ... } is syntactic sugar for template TST(T){ struct TST{ ...} } so TST in the structure refers by default to the struct itself. Fawzi
Re: Navigate from ClassInfo to TypeInfo
Fawzi Mohamed schrieb: For people interested in runtime introspection tango.core.RuntimeTraits might be interesting. Fawzi After the next tango release :)
DMD2028+Phobos cannot compile sample
When compile winsamp.d in dmd\sample\d: C:\DTwo\samples\ddmd winsamp gdi32.lib winsamp.def OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. winsamp.obj(winsamp) Error 42: Symbol Undefined __moduleUnitTests --- errorlevel 1 C:\DTwo\samples\d And several other samples can not pass compiler:chello.d d2html.d Just wanna know whether this is the case or just my own installation problem?Thanks so much!! Sam
DMD2028+Phobos cannot compile sample
When compile winsamp.d in dmd\sample\d: C:\DTwo\samples\ddmd winsamp gdi32.lib winsamp.def OPTLINK (R) for Win32 Release 8.00.1 Copyright (C) Digital Mars 1989-2004 All rights reserved. winsamp.obj(winsamp) Error 42: Symbol Undefined __moduleUnitTests --- errorlevel 1 C:\DTwo\samples\d And several other samples can not pass compiler:chello.d d2html.d Just wanna know whether this is the case or just my own installation problem?Thanks so much!! Sam
Andrie's new Phobos preview package
Hi, I am interested to the subjected new phobos from below link: http://www.erdani.dreamhosters.com/d/ So I downloaded the libphobos2.lib and libphobos2.a from this site manually and then I downloaded the whole package from http://svn.dsource.org/projects/phobos/trunk using TortoiseSVN.I just simply rename the libphobos2.lib to phobos.lib to overwrote the exsiting one and overwrote the whole phobos package under dmd\src by the new one.But it seems it does not work.The compiling message is No Stack. Is there anybody here kindly let me know what's the proper installation to get started with the new phobos preview package? Thanks and best regards, Sam
Re: Andrie's new Phobos preview package
dmd/src should be deleted rather than overwritten.
Re: Template classes
Jarrett Billingsley skrev: On Wed, Apr 15, 2009 at 12:13 PM, Arild Boes abo...@gmail.com wrote: Take a look at the 'this' of D2, it allows to create wrapper structs, so you can just add methods to the built-in arrays. Bye, bearophile Please elaborate on this. How does one do that? With the new, delicious alias this. struct Array(T) { T[] blah; alias blah this; // woo! void print() { writefln(blah); } } void main() { Array!(int) x; // anything not defined in Array will instead be looked up in the 'alias this' member x.length = 5; x[2] = 3; x.print(); } Though actually I'm not sure why bearophile suggested this, since even in D1, you can define 'extension' methods for arrays and AAs by simply declaring a function that takes an array or AA as its first parameter. It's syntactic sugar for a normal function call. By taking advantage of templates and IFTI you can make these methods work for all kinds of arrays. void print(T)(T[] arr) { writefln(arr); } void main() { int[] x; x.length = 5; x[2] = 3; x.print(); // same as print(x); } This will work in D1 or D2. I see. Thank you very much for that answer. Actually the f-call syntactic sugar seems like a good way to keep core classes of any library very lean and mean, whilst maintaining the ability to expand the module without re-compiling the original library! (just import this guy, and the new functions will be available to you as if declared in the original type).
Re: Template classes
On Thu, Apr 16, 2009 at 1:14 PM, Arild Boes abo...@gmail.com wrote: Actually the f-call syntactic sugar seems like a good way to keep core classes of any library very lean and mean, whilst maintaining the ability to expand the module without re-compiling the original library! (just import this guy, and the new functions will be available to you as if declared in the original type). Unfortunately it only works with arrays and AAs at the moment, though the plan for D2 was to extend it to arbitrary types. Some libraries (like Dog) do abuse the fact that it works on arrays, though, by doing clever things like typedef void[] Something;, and you don't even know it's an array ;)
Widening a type
OK, here's one for you that sounds like it ought to be easy, but I don't immediately see how to do it in a pretty way. Given a type parameter T of a template: If T is an integral type, I want to declare a variable 'widest' of type ulong; If T is a floating-point type, I want to declare a variable 'widest' of type double. And it has to be prettier than my solution. :) static if (is (T: ulong)) ulong widest = 0; else if (is (T: double)) double widest = 0.0; else static assert (false, Unimplemented type ~ T.stringof) ; Now, I thought this sounds like a great job for a mixin: template Widen (T, alias varname) { static if (is (T: ulong)) ulong varname = 0; else if (is (T: double)) double varname = 0.0; else static assert (false, Unimplemented type ~ T.stringof) ; } mixin Widen!(T, widest); ...but alas, Declaration expected, not 'if'. Help?
Re: Widening a type
Doctor J wrote: OK, here's one for you that sounds like it ought to be easy, but I don't immediately see how to do it in a pretty way. Given a type parameter T of a template: If T is an integral type, I want to declare a variable 'widest' of type ulong; If T is a floating-point type, I want to declare a variable 'widest' of type double. And it has to be prettier than my solution. :) static if (is (T: ulong)) ulong widest = 0; else if (is (T: double)) double widest = 0.0; else static assert (false, Unimplemented type ~ T.stringof) ; Now, I thought this sounds like a great job for a mixin: template Widen (T, alias varname) { static if (is (T: ulong)) ulong varname = 0; else if (is (T: double)) double varname = 0.0; else static assert (false, Unimplemented type ~ T.stringof) ; } mixin Widen!(T, widest); but alas, Declaration expected, not 'if'. Help? The error tells you everything you need to know if you read it. Actually, you have two problems: you're trying to use if where you should be using static if, and you can't alias a symbol name then use it in a declaration. Here's a fixed, expanded version. template Widen (T, char[] varname) { static if (is (T: ulong)) { mixin(`ulong `~varname~` = 0;`); } else { static if (is (T: double)) { mixin(`double `~varname~` = 0.0`); } else { static assert (false, Unimplmented type ~ T.stringof); } } } You can remove those braces, I just wanted to point out that putting static out the front of an if doesn't magically make the else branch static as well. -- Daniel
Re: Widening a type
On Thu, Apr 16, 2009 at 10:11 PM, Doctor J nob...@nowhere.com wrote: template Widen (T, alias varname) { static if (is (T: ulong)) ulong varname = 0; else if (is (T: double)) else *static* if(is(T: double))
Re: Widening a type
Hello Daniel, You can remove those braces, I just wanted to point out that putting static out the front of an if doesn't magically make the else branch static as well. I known what you are saying but that didn't read right to me: An if as a static if's else clause is not magically a static if. -- Daniel
[Issue 718] ICE with int /= cast(creal)
http://d.puremagic.com/issues/show_bug.cgi?id=718 clugd...@yahoo.com.au changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | Summary|Internal error: |ICE with int /= |../ztc/cgcod.c 562 |cast(creal) Version|0.177 |2.000 --- Comment #3 from clugd...@yahoo.com.au 2009-04-16 03:35 --- The bug_cgcod_562_x1 cases have been fixed, but the bug_cgcod_562_x3 cases remain. This bug accounts for 20% of the remaining Dstress cases which ICE. Much simpler test case: void main(){ int x; x/= cast(creal)1; } Internal error: ..\ztc\cgcod.c 564 Applies to DMD2.028 as well. --
[Issue 2840] New: Missing line number for int %= complex
http://d.puremagic.com/issues/show_bug.cgi?id=2840 Summary: Missing line number for int %= complex Product: D Version: 1.042 Platform: PC OS/Version: Windows Status: NEW Keywords: diagnostic Severity: minor Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: clugd...@yahoo.com.au void main(){ int x; x %= 2+2i; } fog.d(3): Error: cannot perform modulo complex arithmetic Error: long has no effect in expression (0) --- I don't know where the 'long' comes from. Both D1 and D2. This is one of the many op= bugs for erroneous complex operations, along with issue #718 and issue #2839. --
[Issue 934] Segfault taking mangleof a forward reference in a template.
http://d.puremagic.com/issues/show_bug.cgi?id=934 clugd...@yahoo.com.au changed: What|Removed |Added Summary|forward reference by|Segfault taking mangleof a |pragma(msg) in template:|forward reference in a |mtype.c:550: virtual |template. |Expression* | |Type::getProperty(Loc, | |Identifier*): Assertion | |`deco' failed | --- Comment #2 from clugd...@yahoo.com.au 2009-04-16 04:05 --- Actually it's nothing to do with pragma(msg). It's the mangleof which is the problem. Change it to .stringof and problem disappears. template Templ(T) { const char [] XXX = Type.mangleof; alias T Type; } void main() { Templ!(int).Type x; // instantiate } Segfaults on DMD2.028. assert mtype.c(1272) deco segfault DMD1.042 Assertion failure: 'deco' on line 576 in file 'mtype.c' abnormal program termination --
[Issue 2841] New: char[] template value arguments broken in D2
http://d.puremagic.com/issues/show_bug.cgi?id=2841 Summary: char[] template value arguments broken in D2 Product: D Version: 2.027 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: regression Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: clugd...@yahoo.com.au int foo(char[] c)() { return 0; } void main(){ int a = foo!(abc)(); } --- fog.d(6): Error: template fog.foo(char[] c) does not match any function template declaration fog.d(6): Error: template fog.foo(char[] c) cannot deduce template function from argument types !(abc)() fog.d(6): Error: template instance errors instantiating template This all works in D1.042. Fails in D2.028. The code below is similar. Also for class and union. -- struct C(char[] c){ } void main(){ C!(abc) a; } --
[Issue 2842] New: std.file.listdir on OSX produces invalid UTF-8 sequence
http://d.puremagic.com/issues/show_bug.cgi?id=2842 Summary: std.file.listdir on OSX produces invalid UTF-8 sequence Product: D Version: 1.043 Platform: PC OS/Version: Mac OS X Status: NEW Severity: minor Priority: P2 Component: Phobos AssignedTo: bugzi...@digitalmars.com ReportedBy: a...@liquidstate.eu std.file.listdir throws an invalid UTF-8 sequence exception. please see the source file and the produced output below. thanks. -- import std.stdio, std.file; int main(char[][] args) { foreach (file; listdir(.)) writefln(%s, file); return 0; } -- blah:misc user$ dmd listdir.d blah:misc user$ ./listdir .. some_directory Error: 1invalid UTF-8 sequence blah:misc user$ --
[Issue 2843] New: ICE with is-expression with invalid dot-expression in is-expression involving typeid expression
http://d.puremagic.com/issues/show_bug.cgi?id=2843 Summary: ICE with is-expression with invalid dot-expression in is-expression involving typeid expression Product: D Version: 2.027 Platform: PC OS/Version: Linux Status: NEW Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: dhase...@gmail.com foo.bar is typeid(int); Error message: bug.d(3): Error: undefined identifier foo bug.d(3): Error: no property 'bar' for type 'int' bug.d(3): Error: incompatible types for ((1) is (_D10TypeInfo_i6__initZ)): 'int' and 'object.TypeInfo' bug.d(3): Error: is has no effect in expression (1 is _D10TypeInfo_i6__initZ) dmd: constfold.c:863: Expression* Identity(TOK, Type*, Expression*, Expression*): Assertion `0' failed. Aborted Thankfully, it gives you the full error message first. --
[Issue 2844] New: Result of getMembers cannot be used because of const
http://d.puremagic.com/issues/show_bug.cgi?id=2844 Summary: Result of getMembers cannot be used because of const Product: D Version: 2.027 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: daniel.keep+d.puremagic@gmail.com (Note: report is for DMD 2.028.) The getMembers and xgetMembers functions in ClassInfo and TypeInfo_Struct are more or less useless because they return const(MemberInfo[]). None of the methods of MemberInfo are const, and so cannot be called unless you explicitly cast away const-ness. --
[Issue 2835] std.socket.TcpSocket.connect doesn't actually connect
http://d.puremagic.com/issues/show_bug.cgi?id=2835 --- Comment #4 from graham.stj...@internode.on.net 2009-04-16 20:00 --- It did indeed fix the issue. My (improved) test code now works in 2.026 and 2.028 when I use the workaround. --
[Issue 2838] std.file.rmdirRecurse fails
http://d.puremagic.com/issues/show_bug.cgi?id=2838 --- Comment #3 from graham.stj...@internode.on.net 2009-04-16 20:05 --- I have looked into it some more, and it looks like setting of d_type is only supported on some filesystems. I am using reiserfs, which I guess is a bit unusual, and it could be that. Yes, I just tried it with a vfat filesystem on a flash-stick, and d_type was populated ok. Can I suggest that, since the posix standard makes population of d_type (and others) optional, we do something to handle the case where it is set to 0 (DT_UNKNOWN)? Maybe the easiest thing to do is to modify std.file.DirEntry.init to be something like: void init(string path, dirent *fd) { immutable len = std.c.string.strlen(fd.d_name.ptr); name = std.path.join(path, fd.d_name[0 .. len].idup); d_type = fd.d_type; didstat = false; if (d_type == DT_UNKNOWN) { ensureStatDone; } } or maybe defer it until isdir or isdile are called. ensureStatDone would need to be modified to be something like: void ensureStatDone() { if (didstat) return; enforce(core.sys.posix.sys.stat.stat(toStringz(name), statbuf) == 0, Failed to stat file `~name~'); _size = cast(ulong)statbuf.st_size; _creationTime = cast(d_time)statbuf.st_ctime * std.date.TicksPerSecond; _lastAccessTime = cast(d_time)statbuf.st_atime * std.date.TicksPerSecond; _lastWriteTime = cast(d_time)statbuf.st_mtime * std.date.TicksPerSecond; if (d_type == DT_UNKNOWN) { if (S_ISDIR(statbuf.st_mode)) { d_type = DT_DIR; } else if (S_ISREG(statbuf.st_mode)) { d_type = DT_REG; } } didstat = true; } And of course std.file needs to be changed to use readdir_r too. If this approach is acceptable to you, I could have a go at submitting a patch if you like... --
[Issue 2838] std.file.rmdirRecurse fails
http://d.puremagic.com/issues/show_bug.cgi?id=2838 --- Comment #4 from unkn...@simplemachines.org 2009-04-16 21:03 --- Ah, yes, that makes sense. Please feel free to attach a patch. I'm not the one who'd accept it, but I think your approach looks sound. But, beware of convention - curlies, call syntax, etc. - it's best to stay common within a file. -[Unknown] --
[Issue 2838] std.file.rmdirRecurse fails
http://d.puremagic.com/issues/show_bug.cgi?id=2838 --- Comment #5 from graham.stj...@internode.on.net 2009-04-16 22:05 --- Created an attachment (id=325) -- (http://d.puremagic.com/issues/attachment.cgi?id=325action=view) Proposed patch for std.file to handle case of linux filesystems that don't set d_type Submitted a proposed patch to set DirEntry.d_type in the linux version when the filesystem doesn't provide d_type is direntry, such as reiserfs. --