Re: hasDataMember and mixin inconsistency

2013-01-29 Thread Olivier Grant
On Monday, 28 January 2013 at 20:21:19 UTC, Philippe Sigaud wrote: Just testing whether t.M can be assigned to something (ie, is it a value?) I use '_' as a variable name to indicate I don't care for it's precise name/value. It's just a placeholder. Ok, I must be missing something, why "t.D"

Re: Strange behaviour with mmfile

2013-01-29 Thread bioinfornatics
On Tuesday, 29 January 2013 at 06:37:11 UTC, H. S. Teoh wrote: On Tue, Jan 29, 2013 at 05:46:49AM +0100, nazriel wrote: On Tuesday, 29 January 2013 at 00:49:07 UTC, bioinfornatics wrote: >I missed to show the code > >$ cat test_mmap.d >import std.stdio; >import std.mmfile; > >void main(string[]

how can D program find it's own executable name on windows ?

2013-01-29 Thread rsk82
Are there any build in function or must I resort to winapi ?

Garbage collector doesn't collect?

2013-01-29 Thread n00b
If I do the following... : foreach(string foo ; bigFilesList) { string file = cast(string)std.file.read(foo); } ...I run out of memory because the garbage collector apparently does not free previously loaded files, even though there isn't any reference left to them. ( I'm using D2.59,

Re: how can D program find it's own executable name on windows ?

2013-01-29 Thread monarch_dodra
On Tuesday, 29 January 2013 at 15:33:29 UTC, rsk82 wrote: Are there any build in function or must I resort to winapi ? args[0]? // import std.stdio; void main(string[] args) { stdout.writeln(args[0]); } //

Re: how can D program find it's own executable name on windows ?

2013-01-29 Thread n00b
Le 29/01/2013 10:33, rsk82 a écrit : Are there any build in function or must I resort to winapi ? int main(string[] argv) { writeln(argv[0] ~ " is what you are looking for"); } ^^

Re: how can D program find it's own executable name on windows ?

2013-01-29 Thread rsk82
On Tuesday, 29 January 2013 at 15:46:40 UTC, monarch_dodra wrote: stdout.writeln(args[0]); It doesn't work while I have WinMain function that then calls myWinMain, as it is winsamp.d Error: undefined identifier args, did you mean struct CArgs?

Re: Garbage collector doesn't collect?

2013-01-29 Thread monarch_dodra
On Tuesday, 29 January 2013 at 15:43:00 UTC, n00b wrote: If I do the following... : foreach(string foo ; bigFilesList) { string file = cast(string)std.file.read(foo); } ...I run out of memory because the garbage collector apparently does not free previously loaded files, even though th

Re: how can D program find it's own executable name on windows ?

2013-01-29 Thread Regan Heath
On Tue, 29 Jan 2013 15:51:08 -, rsk82 wrote: On Tuesday, 29 January 2013 at 15:46:40 UTC, monarch_dodra wrote: stdout.writeln(args[0]); It doesn't work while I have WinMain function that then calls myWinMain, as it is winsamp.d Error: undefined identifier args, did you mean struc

Re: Returning dynamic array from the function

2013-01-29 Thread timewulf
On Wednesday, 17 October 2012 at 20:38:03 UTC, bearophile wrote: Jonathan M Davis: there's no way for the compiler to always catch it for you.< I think there are type systems able to always catch this kind of bug (conservative region analysis, it means that if it can't demonstrate the memor

Re: gtkD problem

2013-01-29 Thread SaltySugar
On Tuesday, 29 January 2013 at 05:49:37 UTC, SaltySugar wrote: On Monday, 28 January 2013 at 21:50:24 UTC, Mike Wey wrote: On Monday, 28 January 2013 at 19:20:00 UTC, Mike Wey wrote: There seems to be a small bug in the code so that it fails is the GTK_BASEPATH doesn't end with a backslash, you

Re: How to stop the Threadmill

2013-01-29 Thread Steven Schveighoffer
On Mon, 28 Jan 2013 05:18:26 -0500, Chris wrote: I am sure this has been asked before, but I couldn't find a solution or a hint via Google: I use a separate thread to play a sound file. Everything works fine, except that I cannot tell the thread to stop what it is doing. It refuses to rece

gtk on the other machine

2013-01-29 Thread SaltySugar
I have to run my program on the other computer. How to compile my program to do that?

Re: wxD problem

2013-01-29 Thread Anders F Björklund
SaltySugar wrote: Can someone help me? I compiled WxWidgets succesfully but when I try to compile wxD it shows me an error: dmc -D__DMD__ -mn -g -o+none -D -D__WXDEBUG__ -IC:\Program Files\WxWidgets\ include -IC:\Program Files\WxWidgets\lib\dmc_lib\mswd -w- -I. -WA -DNOPCH -HP90 -Ar -Ae -c -

Re: Tutorial on how to build DMD/druntime/phobos and docs from source?

2013-01-29 Thread Philippe Sigaud
On Mon, Jan 28, 2013 at 10:14 PM, H. S. Teoh wrote: > On Mon, Jan 28, 2013 at 09:24:46PM +0100, Philippe Sigaud wrote: >> >> Besides the wiki, see: >> >> https://xtzgzorex.wordpress.com/2011/07/31/d-building-dmd-and-phobos-on-linux/ >> > >> > Would you kindly add this info to the wiki? :-) >> >> W

Adding more information to exceptions

2013-01-29 Thread Vladimir Panteleev
Let's say I have some code that parses some text file: int[] numbers; foreach (lineNumber, line; lines) numbers ~= to!int(line); I would like to add some information to any exceptions thrown inside the loop's body (e.g. whatever std.conv.to may throw), in our case the line number. Previou

Re: Adding more information to exceptions

2013-01-29 Thread Andrej Mitrovic
On 1/29/13, Vladimir Panteleev wrote: > foreach (lineNumber, line; lines) > try >numbers ~= to!int(line); > catch (Exception e) >throw new Exception(format("Error on line %d: %s", > lineNumber, e.msg)); > > Of course, this has the problem that all information (except the >

Re: gtk on the other machine

2013-01-29 Thread Mike Wey
On 01/29/2013 08:24 PM, SaltySugar wrote: I have to run my program on the other computer. How to compile my program to do that? Install the Gtk+ runtime on the other machine, other than that just copying the executable should work. I'm assuming both machines run windows, based on you previou

Re: Adding more information to exceptions

2013-01-29 Thread Ali Çehreli
On 01/29/2013 12:32 PM, Vladimir Panteleev wrote: > I would like to add some information to any exceptions thrown inside the > loop's body (e.g. whatever std.conv.to may throw), in our case the line > number. Here is a RAII idea that takes advantage of exception chaining without directly using

Performance problem with std.math.abs

2013-01-29 Thread bearophile
I have found a performance problem on abs() that I don't understand: http://codepad.org/guZyeFOK In that little program core.stdc.stdlib.abs leads to a much faster (11 or 12 times faster with DMD on Windows32, compiling with -O -release -inline -noboundscheck) program compared to using std.m

Re: Is there a string remove method, that takes an index

2013-01-29 Thread Ali Çehreli
On 01/29/2013 05:37 PM, Damian wrote: > public string remove(string str, size_t start, size_t n) { } > > I need something like this, similar to .Net, does Phobos have this? > I have looked at removechars in std.string and this is not suitable for me. > Do I need to roll my own? Yes but it's ext

Why is the 'protected' attribute considered useless?

2013-01-29 Thread Chad Joan
I've read more than once now that 'protected' is considered useless in D. Why is this?

Re: try to compile githubs dmd-master zip with vstudio 2010

2013-01-29 Thread dennis luehring
Am 27.01.2013 15:08, schrieb Namespace: You mean the Visual Studio solution? I tried it also, but for me only the solution above works fine. I asked for that problem here: http://forum.dlang.org/thread/rzvaprvvgdtwrnoto...@forum.dlang.org?page=2#post-ehulzblzddasvyxncvdb:40forum.dlang.org can

Re: Why is the 'protected' attribute considered useless?

2013-01-29 Thread Jonathan M Davis
On Tuesday, January 29, 2013 22:38:39 Chad Joan wrote: > I've read more than once now that 'protected' is considered useless in > D. Why is this? I've heard some people say it (though not many), but I have no idea why anyone would think that. You need protected if you ever want to override inter

Understanding the GC

2013-01-29 Thread Jeremy DeHaan
I've been reading TDPL book and was also reading some posts on these forums about the GC, but I wanted to clarify a few things to make sure I am understanding correctly. From what I understand, when an object is recovered by the GC, the destructor may or may not be called. Why is that? Is it f

Re: how can D program find it's own executable name on windows ?

2013-01-29 Thread Mike Parker
On Tuesday, 29 January 2013 at 15:51:09 UTC, rsk82 wrote: On Tuesday, 29 January 2013 at 15:46:40 UTC, monarch_dodra wrote: stdout.writeln(args[0]); It doesn't work while I have WinMain function that then calls myWinMain, as it is winsamp.d Error: undefined identifier args, did you mean