Re: Array collection ?

2010-02-09 Thread Steve Teale
On Wed, 10 Feb 2010 01:16:53 -0500, GG wrote: > I would like to know if it's possible to have a associative array with > multiple type as a collection with phobos. > You could try std.boxer, or std.variant.

Re: Array collection ?

2010-02-09 Thread Daniel Keep
GG wrote: > Actually I use an associative array with name as index, to contain different > data but it allows only string type. It forces me to cast all time. > ex: > string[char[]][int] a; > > a[0]["Month"] = "Jan"; > a[0]["Profit"] = to!string(1000); // when I want use this as int, I use :

Array collection ?

2010-02-09 Thread GG
Actually I use an associative array with name as index, to contain different data but it allows only string type. It forces me to cast all time. ex: string[char[]][int] a; a[0]["Month"] = "Jan"; a[0]["Profit"] = to!string(1000); // when I want use this as int, I use : to!int() a[0]["Expenses"]

Re: Is there a modern GC for D?

2010-02-09 Thread Andrei Alexandrescu
Robert Jacques wrote: Based on a thread on the DMD concurrency mailing list I've begun to get a sinking regarding the future of the garbage collector in D: most of the work in GC algorithms has gone into functional and (mostly) pure-OO languages, leaving a multi-paradigm systems programming lan

Is there a modern GC for D?

2010-02-09 Thread Robert Jacques
Based on a thread on the DMD concurrency mailing list I've begun to get a sinking regarding the future of the garbage collector in D: most of the work in GC algorithms has gone into functional and (mostly) pure-OO languages, leaving a multi-paradigm systems programming language like D out i

Re: Coverity tool

2010-02-09 Thread Walter Bright
Brad Roberts wrote: Nice black and white world you are acting like you live in there Walter. I know you know better, so why do you pretend otherwise? First off, yes, if you program in C style, despite using D, your code is vulnerable to many of the problems that Coverity detects. You're ass

Re: Coverity tool

2010-02-09 Thread Brad Roberts
On Tue, 9 Feb 2010, Walter Bright wrote: > @safe guarantees memory safety, so these are non-issues in D. > > Using @safe makes these non-issues. > > As you say, exceptions solve these problems. > > It is a mistake to rely on the GC to free resources other than memory. > Properly, either RAII or

Re: Coverity tool

2010-02-09 Thread Michel Fortin
On 2010-02-09 19:26:05 -0500, bearophile said: Walter Bright: I don't know why Google proscribes exceptions, If you look at that link, and you click on the arrow, you will see a nice list of pro-cons :-) And below the pro-cons it says they avoid exceptions because they have a lot of exce

Re: Coverity tool

2010-02-09 Thread bearophile
Walter Bright: > I don't know why Google proscribes exceptions, If you look at that link, and you click on the arrow, you will see a nice list of pro-cons :-) Bye, bearophile

Re: Coverity tool

2010-02-09 Thread Walter Bright
sybrandy wrote: - Use Before Test: here the bugs are in the code paths of the try-except. Not sure what this means. If I remember correctly from when I had an opportunity to look at these types of tools, this is a case where, in C or C++, you have a variable that may be uninitialized or set

Re: Static initialization order

2010-02-09 Thread BCS
Hello Justin, BCS wrote: Hello Justin, Yes, well, that unfortunately is what I'm doing in my C++ project .. putting implementation of all the static class declarations in one big file. could you do that same sort of things that you do with .h files? Sorry, I'm not sure I understand your

Re: Coverity tool

2010-02-09 Thread Walter Bright
bearophile wrote: But there are many C++ programmers that don't use exceptions, for example they are not allowed in Google C++ code: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Exceptions So surely not 100% of D code will use exceptions. That's why I have said that D avoids

Re: Coverity tool

2010-02-09 Thread sybrandy
- Use Before Test: here the bugs are in the code paths of the try-except. Not sure what this means. If I remember correctly from when I had an opportunity to look at these types of tools, this is a case where, in C or C++, you have a variable that may be uninitialized or set to NULL, but you

Re: Coverity tool

2010-02-09 Thread bearophile
Walter Bright: >@safe guarantees memory safety, so these are non-issues in D.< I think people want to use D instead of Java/C# for (when necessary) its lower level features, because if they don't need that extra little percentage of performance they probably want to use Java/C# in the first pla

Re: A special treat

2010-02-09 Thread Steven Schveighoffer
On Tue, 09 Feb 2010 17:01:10 -0500, Walter Bright wrote: There's still a lot you can do with DLLs and D. Yet nobody does, including Phobos. I wonder why... -Steve

Re: A special treat

2010-02-09 Thread Justin Johansson
Steven Schveighoffer wrote: It is very important that Phobos be a dynamic library and that you can build dynamic libraries easily without manual manipulation of the runtime. If these two things are accomplished, then D can say it supports dynamic libraries, not before. Half ass support doesn'

Re: A special treat

2010-02-09 Thread Walter Bright
Steven Schveighoffer wrote: But implicitly loaded DLLs aren't supported by D! Sure they are, see the program in dmd/samples/d Shared libraries (on Linux) and Windows DLLs are very different things. Yes, I agree they are two different problems to solve. But to a developer, they look the s

Re: A special treat

2010-02-09 Thread Steven Schveighoffer
On Tue, 09 Feb 2010 16:28:27 -0500, Walter Bright wrote: Steven Schveighoffer wrote: On Tue, 09 Feb 2010 15:58:37 -0500, Walter Bright wrote: Steve Teale wrote: The inability to do this is a real show-stopper for D on Linux, and unless things have got better since I last tried, the sa

Re: Coverity tool

2010-02-09 Thread Walter Bright
bearophile wrote: Regarding D code: - Use After Free: probably less common in D code, because dellocations are done by the GC. > - Buffer Overflows: less common in D code because of array bound tests at runtime, and because some string operations/functions are safer. @safe guarantees memory

Re: A special treat

2010-02-09 Thread Don
Walter Bright wrote: Steve Teale wrote: The inability to do this is a real show-stopper for D on Linux, and unless things have got better since I last tried, the same can be said for Windows DLLs. The dmd/samples/d/dserver.d is an example of a Windows DLL in D. It doesn't work on D2 because

Re: A special treat

2010-02-09 Thread Walter Bright
Steven Schveighoffer wrote: On Tue, 09 Feb 2010 15:58:37 -0500, Walter Bright wrote: Steve Teale wrote: The inability to do this is a real show-stopper for D on Linux, and unless things have got better since I last tried, the same can be said for Windows DLLs. The dmd/samples/d/dserver.d

Re: A special treat

2010-02-09 Thread Steven Schveighoffer
On Tue, 09 Feb 2010 15:58:37 -0500, Walter Bright wrote: Steve Teale wrote: The inability to do this is a real show-stopper for D on Linux, and unless things have got better since I last tried, the same can be said for Windows DLLs. The dmd/samples/d/dserver.d is an example of a Windows

Re: Coverity tool

2010-02-09 Thread bearophile
Walter Bright: >I just think that Coverity doesn't have much use for D code, because what it >checks for is already covered by the language.< I have taken a look at this report about bugs found by this tool in open source code: http://scan.coverity.com/report/Coverity_White_Paper-Scan_Open_Sour

Re: A special treat

2010-02-09 Thread Walter Bright
Steve Teale wrote: The inability to do this is a real show-stopper for D on Linux, and unless things have got better since I last tried, the same can be said for Windows DLLs. The dmd/samples/d/dserver.d is an example of a Windows DLL in D.

Re: Coverity tool

2010-02-09 Thread Ellery Newcomer
On 02/09/2010 02:18 PM, Walter Bright wrote: bearophile wrote: Walter Bright: From what I can infer from their various statements, the primary thing it does is pair functions that must be paired, like malloc/free, lock/unlock, fopen/fclose, etc. I have never used their program, and probably I

Re: A special treat

2010-02-09 Thread Justin Johansson
Andrei Alexandrescu wrote: Many (including myself) have expressed the real requirement for shared libraries. Sometimes the response is "oh who needs shared libraries anyways, there is so much memory in todays computers" and the other response is that "Windows DLLs suck, so we can't do it". I

Re: Coverity tool

2010-02-09 Thread Walter Bright
bearophile wrote: Walter Bright: From what I can infer from their various statements, the primary thing it does is pair functions that must be paired, like malloc/free, lock/unlock, fopen/fclose, etc. I have never used their program, and probably I will never buy it, but I have seen it used tw

Re: Scala design process vs D

2010-02-09 Thread Trass3r
You're more than welcome to come help out with the documentation. The stuff is all generated from templates. Where are these files?

Re: A special treat

2010-02-09 Thread Don
Steve Teale wrote: When D2 is 'frozen', as a special treat would it be possible for it to be able to generate object files that could be converted into shared libraries, and for Phobos to be a shared library to support same. I have tried every which way I can think of to create shared librarie

Re: A special treat

2010-02-09 Thread Steven Schveighoffer
On Tue, 09 Feb 2010 12:42:46 -0500, Andrei Alexandrescu wrote: Steven Schveighoffer wrote: On Tue, 09 Feb 2010 10:53:47 -0500, Steve Teale wrote: When D2 is 'frozen', as a special treat would it be possible for it to be able to generate object files that could be converted into shared

Re: Coverity tool

2010-02-09 Thread bearophile
Walter Bright: > From what I can infer from their various statements, the primary thing > it does is pair functions that must be paired, like malloc/free, > lock/unlock, fopen/fclose, etc. I have never used their program, and probably I will never buy it, but I have seen it used two times on t

Re: A special treat

2010-02-09 Thread Craig Black
"Andrei Alexandrescu" wrote in message news:hks6qm$26r...@digitalmars.com... Steven Schveighoffer wrote: On Tue, 09 Feb 2010 10:53:47 -0500, Steve Teale wrote: When D2 is 'frozen', as a special treat would it be possible for it to be able to generate object files that could be converted

Re: A special treat

2010-02-09 Thread Andrei Alexandrescu
Steven Schveighoffer wrote: On Tue, 09 Feb 2010 10:53:47 -0500, Steve Teale wrote: When D2 is 'frozen', as a special treat would it be possible for it to be able to generate object files that could be converted into shared libraries, and for Phobos to be a shared library to support same. I h

Re: A special treat

2010-02-09 Thread Steven Schveighoffer
On Tue, 09 Feb 2010 10:53:47 -0500, Steve Teale wrote: When D2 is 'frozen', as a special treat would it be possible for it to be able to generate object files that could be converted into shared libraries, and for Phobos to be a shared library to support same. I have tried every which way I

Re: A special treat

2010-02-09 Thread Steve Teale
O>> Please! >> Steve > > Sorry if I'm stating the obvious, but have you looked at DDL? > > http://www.dsource.org/projects/ddl/ > > Clemens D1/Tango/not maintained/awful or no documentation - what more can I say? Thanks Steve

Re: A special treat

2010-02-09 Thread Clemens
Steve Teale Wrote: > When D2 is 'frozen', as a special treat would it be possible for it to be > able to generate object files that could be converted into shared > libraries, and for Phobos to be a shared library to support same. > > I have tried every which way I can think of to create shared

Re: delegating constructors and "this = ..."

2010-02-09 Thread jpf
On 08.02.2010 20:45, BCS wrote: > Hello JPF, > >> Thanks for your help, I think I now understand what's going on. >> 'this' is a mutable local reference in the constructor but the >> constructor automatically returns the local 'this'. This explains why >> the first case works while the second does

A special treat

2010-02-09 Thread Steve Teale
When D2 is 'frozen', as a special treat would it be possible for it to be able to generate object files that could be converted into shared libraries, and for Phobos to be a shared library to support same. I have tried every which way I can think of to create shared libraries using D. The close

Re: Static initialization order

2010-02-09 Thread Justin Johansson
BCS wrote: Hello Justin, Yes, well, that unfortunately is what I'm doing in my C++ project .. putting implementation of all the static class declarations in one big file. could you do that same sort of things that you do with .h files? Sorry, I'm not sure I understand your question. For my

Re: Coverity tool

2010-02-09 Thread Walter Bright
Walter Bright wrote: Coverity's business model seems to be based on being very vague about what their software actually does, Found some stuff on the Cert web site: https://www.securecoding.cert.org/confluence/display/seccode/Coverity+Prevent

Re: Coverity tool

2010-02-09 Thread Walter Bright
bearophile wrote: Rarely I have found a so fun description of a software, how they can (barely?) make it a commercial product, the problems they find. The program is a bug finding tool, for C, C++, Java, C#: http://cacm.acm.org/magazines/2010/2/69354-a-few-billion-lines-of-code-later/fulltext