Re: Mago Debugger

2010-08-23 Thread Rainer Schuetze
This is really impressive work. I gave it a try, compilation worked fine with a few hickups (mainly due to taking some random (almost compatible) stdint.h/inttypes.h and placing it into mago/include, so a few projects needed to have an additional include search path). Still, I think it is a

Re: Mago Debugger

2010-08-23 Thread Aldo Nunez
I attached a log for a debug session of a sample D debuggee. You can use that as a reference for seeing where LaunchDebugTargets is supposed to end up in the debug engine. With respect to loading an executable as a project and having a few problems... Were you using Windows XP? I saw those

Re: MatD - Matlab external interface bindings for D

2010-08-23 Thread eles
Hi, Here are two .bat files that help converting an entire folder of .lib files in omf format. A subfolder omf will be created in the current folder. coffimplib needs to be in the current folder, too. The batch file convert_all.bat is destined to be run in the C:

Re: Mago Debugger

2010-08-23 Thread Trass3r
Still, I think it is a bit troublesome for people to build MaGo from source if they are not used to work with the Visual Studio Extensibility, so you should consider providing some precompiled binaries. votes++;

Re: MatD - Matlab external interface bindings for D

2010-08-23 Thread eles
Hello, Here is (attachement) a translation of file mwdebug.h (matd.c.mwdebug). There is a line commented out, specifically: //extern FILE* matGetFp_d(MATFile* ph, const(char)* file, int linenum); since I don't know how to replace the C FILE structure. In principle, module matd.c.mwdebug

Re: MatD - Matlab external interface bindings for D

2010-08-23 Thread Trass3r
Here is (attachement) a translation of file mwdebug.h (matd.c.mwdebug). Thanks for your work but unfortunately I already converted mwdebug.h in the first place. The reason why it isn't committed yet is these functions aren't provided by Matlab's dlls. mwdebug.cpp contains the

Re: MatD - Matlab external interface bindings for D

2010-08-23 Thread Trass3r
I don't know if there is a way to handle all this without string mixins. i.e. something along the lines of mixin(foo( ... /** * Get pointer to dimension array */ const(mwSize)* mxGetDimensions(const(mxArray)* pa); ... )); and foo replaces the function defs with func(...){return

Re: Mago Debugger

2010-08-23 Thread Rainer Schuetze
Aldo Nunez wrote: I attached a log for a debug session of a sample D debuggee. You can use that as a reference for seeing where LaunchDebugTargets is supposed to end up in the debug engine. Thanks. That helped me finding that Visual D used quotes on the executable name. Without these, it

Re: Why C++ compiles slowly

2010-08-23 Thread Steven Schveighoffer
On Wed, 18 Aug 2010 21:05:34 -0400, Walter Bright newshou...@digitalmars.com wrote: http://www.drdobbs.com/blog/archives/2010/08/c_compilation_s.html I'll be doing a followup on why D compiles fast. Very interesting stuff. I'd like to have an article describing how to diagnose slow D

Re: Immutability and strings

2010-08-23 Thread Steven Schveighoffer
On Wed, 18 Aug 2010 22:11:35 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Here's something from TDPL, page 292: string process(string input) { return input; }; string s1 = blah; string s2 = process(s1); assert(s1 == blah); // never fails I've added the return in process(), it

Re: Why foreach(c; someString) must yield dchar

2010-08-23 Thread Steven Schveighoffer
On Wed, 18 Aug 2010 23:11:26 -0400, Rainer Deyke rain...@eldwood.com wrote: On 8/18/2010 20:37, dsimcha wrote: I've been hacking in Phobos and parallelfuture and I've come to the conclusion that having typeof(c) in the expression foreach(c; string.init) not be a dchar is simply

Re: Why foreach(c; someString) must yield dchar

2010-08-23 Thread Steven Schveighoffer
On Thu, 19 Aug 2010 10:34:01 -0400, dsimcha dsim...@yahoo.com wrote: == Quote from Kagamin (s...@here.lot)'s article dsimcha Wrote: Hmm, lately I've been focusing my hacking efforts on debugging/polishing/removing annoying inconsistencies in Phobos. Maybe std.string should be my next

Re: How does D handle null pointers?

2010-08-23 Thread Steven Schveighoffer
On Fri, 20 Aug 2010 18:25:15 -0400, Adam Ruppe destructiona...@gmail.com wrote: This is brought up somewhat often on this group. Problem with throwing an exception in a segfault is that it is undefined behavior in POSIX. So? Are we worried about damaging our well-running program after it

Re: How does D handle null pointers?

2010-08-23 Thread Steven Schveighoffer
On Fri, 20 Aug 2010 22:07:03 -0400, Adam B cru...@gmail.com wrote: Walter has refused to put in null checks on the theory that the OS does it for you - hence the segfault. Of course, then the only way to get a stacktrace is to either have a segfault handler which prints one or to look at a

Re: Yet another Gregorian.d contribution

2010-08-23 Thread Yao G.
I forgot to add DayClock to get the local and UTC date: http://ideone.com/SkKkP (line 805) -- Yao G.

Re: How does D handle null pointers?

2010-08-23 Thread Sean Kelly
Steven Schveighoffer schvei...@yahoo.com wrote: On Fri, 20 Aug 2010 22:07:03 -0400, Adam B cru...@gmail.com wrote: Walter has refused to put in null checks on the theory that the OS does it for you - hence the segfault. Of course, then the only way to get a stacktrace is to either

Re: Why C++ compiles slowly

2010-08-23 Thread Walter Bright
Steven Schveighoffer wrote: On Wed, 18 Aug 2010 21:05:34 -0400, Walter Bright newshou...@digitalmars.com wrote: http://www.drdobbs.com/blog/archives/2010/08/c_compilation_s.html I'll be doing a followup on why D compiles fast. Very interesting stuff. I'd like to have an article describing

Re: Why C++ compiles slowly

2010-08-23 Thread Steven Schveighoffer
On Mon, 23 Aug 2010 12:44:50 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: On Wed, 18 Aug 2010 21:05:34 -0400, Walter Bright newshou...@digitalmars.com wrote: http://www.drdobbs.com/blog/archives/2010/08/c_compilation_s.html I'll be doing a followup

D1: accepts-invalid?

2010-08-23 Thread klickverbot
Hello all, currently, DMD accepts the following code, but the resulting binary bus-errors at runtime: --- import std.stdio; void foo( string str ) () { writefln( str ); } void bar( string text ) { foo!( text ); } void main() { bar( asdf ); } --- Shouldn't this be a

Re: Why C++ compiles slowly

2010-08-23 Thread Walter Bright
Steven Schveighoffer wrote: I get a long list of functions proceeding at a reasonable rate. I've done that in the past, I feel it's some sort of inner loop problem. Essentially, something takes way longer to compile than it should, but way longer on the order of .05 seconds instead of .005

Re: Why C++ compiles slowly

2010-08-23 Thread Steven Schveighoffer
On Mon, 23 Aug 2010 13:41:07 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: I get a long list of functions proceeding at a reasonable rate. I've done that in the past, I feel it's some sort of inner loop problem. Essentially, something takes way

Re: Why C++ compiles slowly

2010-08-23 Thread Walter Bright
Steven Schveighoffer wrote: On Mon, 23 Aug 2010 13:41:07 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: I get a long list of functions proceeding at a reasonable rate. I've done that in the past, I feel it's some sort of inner loop problem. Essentially,

Re: D1: accepts-invalid?

2010-08-23 Thread Don
klickverbot wrote: Hello all, currently, DMD accepts the following code, but the resulting binary bus-errors at runtime: --- import std.stdio; void foo( string str ) () { writefln( str ); } void bar( string text ) { foo!( text ); } void main() { bar( asdf ); } ---

Re: accepts-invalid?

2010-08-23 Thread Nick Sabalausky
klickverbot s...@klickverbot.at wrote in message news:i4ualh$1qh...@digitalmars.com... Hello all, currently, DMD accepts the following code, but the resulting binary bus-errors at runtime: --- import std.stdio; void foo( string str ) () { writefln( str ); } void bar( string text

Re: Windows command line and execv

2010-08-23 Thread Andrei Alexandrescu
On 8/23/10 5:14 CDT, Steven Schveighoffer wrote: On Fri, 20 Aug 2010 02:48:51 -0400, Nick Sabalausky a...@a.a wrote: Nick Sabalausky a...@a.a wrote in message news:i4kv18$14q...@digitalmars.com... Is execv known to trick the windows command-line into giving control back to the user? Ok

Re: accepts-invalid?

2010-08-23 Thread Steven Schveighoffer
On Mon, 23 Aug 2010 15:29:32 -0400, Nick Sabalausky a...@a.a wrote: klickverbot s...@klickverbot.at wrote in message news:i4ualh$1qh...@digitalmars.com... Hello all, currently, DMD accepts the following code, but the resulting binary bus-errors at runtime: --- import std.stdio; void foo(

Re: How does D handle null pointers?

2010-08-23 Thread Adam B
Sweet! Thanks, Sean. I was fully expecting this to be one of those threads where a lot of noise gets made but, in the end, nobody can agree on a solution. Printing a stack trace is a big step in the right direction. Ok I can do this.

Re: On C/C++ undefined behaviours

2010-08-23 Thread Nick Sabalausky
retard r...@tard.com.invalid wrote in message news:i4s1ft$2fe...@digitalmars.com... Sun, 22 Aug 2010 15:50:10 -0400, Nick Sabalausky wrote: retard r...@tard.com.invalid wrote in message news:i4rqp4$1eg...@digitalmars.com... Sun, 22 Aug 2010 17:50:06 +0200, Andrej Mitrovic wrote: Quake 2 is

Re: On C/C++ undefined behaviours

2010-08-23 Thread Nick Sabalausky
Jonathan M Davis jmdavisp...@gmail.com wrote in message news:mailman.467.1282518397.13841.digitalmar...@puremagic.com... On Sunday 22 August 2010 14:04:24 Walter Bright wrote: Walter Bright wrote: This also means if you merely translate a program from Java to D, don't expect it to

Re: Version bug?

2010-08-23 Thread Adam D. Ruppe
On Sun, Aug 22, 2010 at 10:23:33PM -0700, Walter Bright wrote: The compiler is exhibiting correct behavior. I think there should be an extra note in there: version specifications only apply to the module in which they appear. can be tested by the importer with static if. These declarations can

Re: accepts-invalid?

2010-08-23 Thread Nick Sabalausky
Steven Schveighoffer schvei...@yahoo.com wrote in message news:op.vhwolemleav...@localhost.localdomain... On Mon, 23 Aug 2010 15:29:32 -0400, Nick Sabalausky a...@a.a wrote: klickverbot s...@klickverbot.at wrote in message news:i4ualh$1qh...@digitalmars.com... Hello all, currently, DMD

Re: Why C++ compiles slowly

2010-08-23 Thread Steven Schveighoffer
On Mon, 23 Aug 2010 14:11:52 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: On Mon, 23 Aug 2010 13:41:07 -0400, Walter Bright newshou...@digitalmars.com wrote: Steven Schveighoffer wrote: I get a long list of functions proceeding at a reasonable rate.

contracts for external functions?

2010-08-23 Thread Trass3r
The Matlab C headers provide some kind of hand-crafted contracts by defining extra functions with suffix _d that check all the arguments and then detouring the calls to the original functions via the preprocessor (#define foo foo_d) Of course I could do it the same way, but wouldn't it be

Re: How does D handle null pointers?

2010-08-23 Thread bearophile
Adam B: char[] foo() { if (some condition) return yada; else return null; //compiler makes note that foo() might return null } void bar() { char[] s = foo(); printf(s); //compiler issues warning because 's' has not been

Re: contracts for external functions?

2010-08-23 Thread Trass3r
extern(C) int foo(int i) in { assert(i 7); } out (result) { assert(result 1); } A nice idea to remember (regardless the syntax used to do it). At least that's the interface contracts syntax (wonder why there's no ';')

Re: std.socket is horrible.

2010-08-23 Thread Pedro Rodrigues
Yes, that would most certainly help a lot. cemiller ch...@dprogramming.com wrote in message news:op.vhu594gqycw...@christop... Would the problems be resolved with the following changes? Add a Socket class constructor: this(socket_t sock, AddressFamily af) { assert(sock != socket_t.init);

Re: On C/C++ undefined behaviours

2010-08-23 Thread Walter Bright
Nick Sabalausky wrote: Yea, I agree. Back in my C/C++ days, I actively avoided doing any string processing whenever I could, just because it was such a PITA. I've done an awful lot of C/C++ programming that involved handling strings. It was always a lot of tedious work, and I was always

Re: On C/C++ undefined behaviours

2010-08-23 Thread Andrej Mitrovic
OT: I guess that's one of the reasons why I was so appalled when I was reading C++ Primer many years ago. The author spent almost the entire book explaining the difference between C and C++, and half of his book with a guide on how to create your own string processing functions in C++. On the

Re: Algorithms opApply

2010-08-23 Thread dsimcha
== Quote from bearophile (bearophileh...@lycos.com)'s article The gentle and a-lot-working David Simcha has converted one of my bug reports into an enhancement request: http://d.puremagic.com/issues/show_bug.cgi?id=4264 Currently (SVN) only array() is able to digest iterables that define

Re: safeD formal semantics

2010-08-23 Thread bearophile
BCS: How much of safeD is formalizable? Is there anything in it that is hoplessly impractical to create formal semantics for? And it needs something like this too ^_^ http://pascal-central.com/images/pascalposter.jpg Bye, bearophile

Re: safeD formal semantics

2010-08-23 Thread BCS
Hello bearophile, BCS: How much of safeD is formalizable? Is there anything in it that is hoplessly impractical to create formal semantics for? And it needs something like this too ^_^ http://pascal-central.com/images/pascalposter.jpg And that's just the grammer. BTW, at one point I

Re: Can't get D calling C to build.

2010-08-23 Thread Kagamin
Bob Cowdery Wrote: Thanks, that's an honest opinion. The first project I have in mind is a personal one but it's quite large. My hope would be to move a lot of the C code into D eventually. I don't think I would risk it on a commercial project until the toolchain is sorted and its a bit more

Re: How do you call GetVersionEx (Windows)?

2010-08-23 Thread Stanislav Blinov
22.08.2010 23:36, Andrej Mitrovic wrote: There's an example of a module constructor in TDPL. I don't think it's supossed to compile as it is, but I wanted to try it out anyway. I need a way to call the windows c function GetVersionEx. A grep through the source files doesn't find it (except

Re: How do you call GetVersionEx (Windows)?

2010-08-23 Thread Stanislav Blinov
Oops, sorry, Thunderbird inserted second lpVersionInfo as a hyperlink :)

Re: template deduction

2010-08-23 Thread Mafi
Am 22.08.2010 21:45, schrieb bearophile: (...) import std.stdio: writeln; import std.typecons: Tuple, tuple; import std.traits: ReturnType, ParameterTypeTuple; struct Memoize(alias F) { ReturnType!F opCall(ParameterTypeTuple!F args) { alias ReturnType!F ResultType; static

Ways to initialize static arrays

2010-08-23 Thread Stanislav Blinov
Hello, I was wondering if anyone has suggestions on performing arbitrary initialization of static arrays, size of which is arbitrary at compile time. Consider this: template StaticArray(T,int N,T v) if (N 0) { static if (N == 1) { enum T[N] StaticArray = cast(T[N])[v];

Re: Ways to initialize static arrays

2010-08-23 Thread bearophile
Stanislav Blinov: I was wondering if anyone has suggestions on performing arbitrary initialization of static arrays, size of which is arbitrary at compile time. Please explain your purposes a bit better. Bye, bearophile

Re: Ways to initialize static arrays

2010-08-23 Thread Stanislav Blinov
23.08.2010 16:31, bearophile wrote: Stanislav Blinov: I was wondering if anyone has suggestions on performing arbitrary initialization of static arrays, size of which is arbitrary at compile time. Please explain your purposes a bit better. I have a struct template (let's call it S) that

Re: typeid() after const/immutable qualifiers

2010-08-23 Thread Steven Schveighoffer
On Thu, 19 Aug 2010 12:47:45 -0400, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Btw, should I skip trying to use inout at all for now? I've read some posts saying that it's awfully broken, and the example of inout in TDPL doesn't work.. Yes. I have expressed the cases that inout

Re: unittest questions

2010-08-23 Thread Steven Schveighoffer
On Thu, 19 Aug 2010 14:08:33 -0400, Johannes Pfau s...@example.com wrote: Hi, I wrote some unittests using the built-in d unittest and a came across 2 problems: 1) I have some code that accepts both delegates and functions. How can a unittest explicitly check the function part? Whenever I add

Re: Can't get D calling C to build.

2010-08-23 Thread Bob Cowdery
On 22/08/2010 22:16, Bob Cowdery wrote: On 22/08/2010 20:57, bearophile wrote: Bob Cowdery: Well, the link still works but the download is 0 bytes so I guess its not available. Thanks for the thought. That links works for me :-) Be happy, bye, bearophile Works if I paste it but not

Re: Can't get D calling C to build.

2010-08-23 Thread Bob Cowdery
On 23/08/2010 20:24, Bob Cowdery wrote: On 22/08/2010 22:16, Bob Cowdery wrote: On 22/08/2010 20:57, bearophile wrote: Bob Cowdery: Well, the link still works but the download is 0 bytes so I guess its not available. Thanks for the thought. That links works for me :-) Be happy, bye,

Re: Can't get D calling C to build.

2010-08-23 Thread Andrej Mitrovic
I haven't read the specifics of your problem yet, but have you tried using the newer TDM port of MinGW? The MinGW binaries are still using an older port of GCC, but the TDM version is much newer, so it might be worth trying it out. Get it from here: http://tdm-gcc.tdragon.net/ Hope that

Re: Can't get D calling C to build.

2010-08-23 Thread bearophile
I like this, and I love the way you install it, this is the way a compiler has to be installed: http://nuwen.net/mingw.html Uhm... The last version (6.6 that is gcc 4.5.1) seems to produce very large binaries, and the precedent version seems not available. Not good for you. Bye and sorry,

Re: How do you call GetVersionEx (Windows)?

2010-08-23 Thread Andrej Mitrovic
I think it might be this one: http://hp.vector.co.jp/authors/VA028375/d/windows.h.html But those are old as well. Not a big deal, c linkage seems really easy from D. I don't think I'll have any problems using MSDN samples with a few aliases sprinkled here and there. :) Yao G. Wrote: I

Re: How do you call GetVersionEx (Windows)?

2010-08-23 Thread Yao G.
Relevant links: http://dsource.org/projects/bindings/wiki/WindowsApi http://dsource.org/projects/bindings/browser/trunk/win32 -- Yao G.

Re: How do you call GetVersionEx (Windows)?

2010-08-23 Thread Andrej Mitrovic
Very cool! Thanks, Yao. Yao G. Wrote: snip

Re: How do you call GetVersionEx (Windows)?

2010-08-23 Thread Yao G.
For my projects, I rolled my own headers. They are based (like the ones on dsource) on the MinGW32 project. But mine target Windows 2000 as minimal O.S. and use exclusively UTF-32 (the ASCI versions are not defined). Also, Replace UTF-32 with UTF-16 :D -- Using Opera's revolutionary

BitArray contracts

2010-08-23 Thread bearophile
This a part of std.bitmanip.BitArray: void init(void[] v, size_t numbits) in { assert(numbits = v.length * 8); assert((v.length 3) == 0); } body { ptr = cast(uint*)v.ptr; len = numbits; } But it seems this program works with no

[Issue 1001] print stack trace (in debug mode) when program die

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1001 faithful aercjk...@yahoo.com changed: What|Removed |Added CC||aercjk...@yahoo.com ---

[Issue 4716] std.stdio.input() or similar

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4716 --- Comment #1 from bearophile_h...@eml.cc 2010-08-23 05:14:22 PDT --- Improved code. Both IsType() and IsString() may be useful to add to std.traits, if something similar is not already present. import std.string: chomp; import std.stdio:

[Issue 1001] print stack trace (in debug mode) when program die

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=1001 Johannes Pfau johannesp...@gmail.com changed: What|Removed |Added CC|

[Issue 3516] Destructor not called on temporaries

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3516 SHOO zan77...@nifty.com changed: What|Removed |Added Priority|P2 |P3 CC|

[Issue 4717] New: std.bitmanip.BitArray changes

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4717 Summary: std.bitmanip.BitArray changes Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component:

[Issue 4717] std.bitmanip.BitArray changes

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4717 --- Comment #1 from bearophile_h...@eml.cc 2010-08-23 17:38:53 PDT --- As alternative flipAll() may be named flip() (with no arguments). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving

[Issue 4718] New: Few Phobos modules renames

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4718 Summary: Few Phobos modules renames Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos

[Issue 4718] Few Phobos modules renames

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4718 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added CC|

[Issue 4718] Few Phobos modules renames

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4718 --- Comment #2 from bearophile_h...@eml.cc 2010-08-23 18:10:39 PDT --- Although I agree, this would invalidate pretty much all of the examples in TDPL I think Andrei agrees with me about this change. I think Walter doesn't agree. I have

[Issue 4718] Few Phobos modules renames

2010-08-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4718 Masahiro Nakagawa repeate...@gmail.com changed: What|Removed |Added CC|