Re: Adding libraries to an executable

2013-09-13 Thread Jonathan M Davis
On Friday, September 13, 2013 21:54:39 Anton Alexeev wrote: > So, nobody can give an easy answer how to statically link the > libraries with the executable and I have yo use Bin2D? If you give the exact file name for the static library (e.g. /path/to/libcurl.a), then it should link against the st

Re: Exception chaining

2013-09-13 Thread Sean Kelly
On Sep 13, 2013, at 2:14 PM, monarch_dodra wrote: > In one of my exception handling blocks, I call some code that could *also*, > potentially throw (it's actually a loop, where each iteration can throw, but > I have to do them *all*, meaning I need to handle *several* extra > exceptions). I'm

Re: Get constructor for a class

2013-09-13 Thread Namespace
On Friday, 13 September 2013 at 22:10:02 UTC, simendsjo wrote: On Friday, 13 September 2013 at 15:27:42 UTC, Namespace wrote: On Friday, 13 September 2013 at 15:16:36 UTC, H. S. Teoh wrote: On Fri, Sep 13, 2013 at 04:16:30PM +0200, simendsjo wrote: On Friday, 13 September 2013 at 14:02:15 UTC,

Re: Get constructor for a class

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 15:27:42 UTC, Namespace wrote: On Friday, 13 September 2013 at 15:16:36 UTC, H. S. Teoh wrote: On Fri, Sep 13, 2013 at 04:16:30PM +0200, simendsjo wrote: On Friday, 13 September 2013 at 14:02:15 UTC, Gary Willoughby wrote: [...] (...) The syntax for is() is o

Re: Adding libraries to an executable

2013-09-13 Thread FreeSlave
On Friday, 13 September 2013 at 19:54:41 UTC, Anton Alexeev wrote: So, nobody can give an easy answer how to statically link the libraries with the executable and I have yo use Bin2D? Did you try to use -static option of compiler? It forces to link application with static libraries instead of

Exception chaining

2013-09-13 Thread monarch_dodra
In one of my exception handling blocks, I call some code that could *also*, potentially throw (it's actually a loop, where each iteration can throw, but I have to do them *all*, meaning I need to handle *several* extra exceptions). I'm wondering what the "correct" way of handling both exception

Re: Odd compiler complaints with import declarations

2013-09-13 Thread Adam D. Ruppe
On Friday, 13 September 2013 at 20:21:31 UTC, Orfeo wrote: OK, but I could not use the module declaration, in this case the module has the same file name...or not? Yeah, it will have the file name, but not the directory name. That's why it called it "module gadget" instead of "module acme.gad

Re: Communication between Java and D application

2013-09-13 Thread Jonathan M Davis
On Friday, September 13, 2013 22:04:24 Anton Alexeev wrote: > I have a method in a D program which I want to call from a Java > program. What is the best way to do this? Usually, to have two languages talk to each other, you have to have a C layer in between. So, AFAIK, that's what you have to do

Re: Odd compiler complaints with import declarations

2013-09-13 Thread Adam D. Ruppe
On Friday, 13 September 2013 at 19:54:30 UTC, Orfeo wrote: "The name must include the relative path computed from the directory" That statement isn't really true. The module name is what thef ile has in the contents: module foo.test; near the top of the file gives it the name of foo.test. T

Re: Odd compiler complaints with import declarations

2013-09-13 Thread Orfeo
On Friday, 13 September 2013 at 19:57:06 UTC, Andrej Mitrovic wrote: Add the module declaration "module acme.gadget;" at the top of this file and it should work. Thanks Andrej... So, it works also if I add :// main.d :import path.to.nonexistent.location.app; and // gadget.d : module path.to.n

Communication between Java and D application

2013-09-13 Thread Anton Alexeev
I have a method in a D program which I want to call from a Java program. What is the best way to do this?

Re: Odd compiler complaints with import declarations

2013-09-13 Thread Orfeo
On Friday, 13 September 2013 at 20:02:24 UTC, Adam D. Ruppe wrote: On Friday, 13 September 2013 at 19:54:30 UTC, Orfeo wrote: "The name must include the relative path computed from the directory" That statement isn't really true. The module name is what thef ile has in the contents: module

Re: Odd compiler complaints with import declarations

2013-09-13 Thread Andrej Mitrovic
On Friday, 13 September 2013 at 19:54:30 UTC, Orfeo wrote: // in gadget.d : import std.stdio; : import acme.goodies.io.string; : public void wun() { } Add the module declaration "module acme.gadget;" at the top of this file and it should work.

Odd compiler complaints with import declarations

2013-09-13 Thread Orfeo
I have this directory hierarchy (from TDPL pag 339): . ├── acme │   ├── gadget.d │   └── goodies │   └── io │   ├── io.d │   └── string.d └── main.d // in main.d : import std.stdio; : : import acme.gadget; : void main(string[] args) { :wun(); : } // in gadget.d : import

Re: Adding libraries to an executable

2013-09-13 Thread Anton Alexeev
So, nobody can give an easy answer how to statically link the libraries with the executable and I have yo use Bin2D?

Re: GC.collect bug ?

2013-09-13 Thread evilrat
On Friday, 13 September 2013 at 15:24:17 UTC, Temtaime wrote: Hello for all ! I need to call all objects destructors in one place. It's guaranted, that there is no objects instances. I tried use GC.collect but it's produces strange results. import std.stdio; import core.memory; class A {

Re: GC.collect bug ?

2013-09-13 Thread Namespace
Another use case of delete, which is unfortunately deprecated. ;) import std.stdio; import core.memory; class A { ~this() { writeln(`dtor`); }; }; void main() { auto a = new A; delete a; writeln(`after dtor`); } Ooutput: dtor after dtor

Re: Get constructor for a class

2013-09-13 Thread Namespace
On Friday, 13 September 2013 at 15:16:36 UTC, H. S. Teoh wrote: On Fri, Sep 13, 2013 at 04:16:30PM +0200, simendsjo wrote: On Friday, 13 September 2013 at 14:02:15 UTC, Gary Willoughby wrote: [...] >A lot of the traits stuff is very confusing, i think a lot of >it >is still being finalised an

Re: Get constructor for a class

2013-09-13 Thread H. S. Teoh
On Fri, Sep 13, 2013 at 04:16:30PM +0200, simendsjo wrote: > On Friday, 13 September 2013 at 14:02:15 UTC, Gary Willoughby wrote: [...] > >A lot of the traits stuff is very confusing, i think a lot of it > >is still being finalised and in development. I'm working on a > >project using a lot of trai

Re: What is the preferred method for testing the existence of a key in an associative array?

2013-09-13 Thread Gary Willoughby
On Friday, 13 September 2013 at 14:06:50 UTC, Adam D. Ruppe wrote: I use the in operator: Aha! ta.

GC.collect bug ?

2013-09-13 Thread Temtaime
Hello for all ! I need to call all objects destructors in one place. It's guaranted, that there is no objects instances. I tried use GC.collect but it's produces strange results. import std.stdio; import core.memory; class A { ~this() { writeln(`dtor`); }; }; void main() { aut

Re: Linking Trouble (Linux)

2013-09-13 Thread Craig Dillabaugh
On Thursday, 12 September 2013 at 20:47:46 UTC, Craig Dillabaugh wrote: clip For anyone who runs into a similar problem using DUB the following package.json files solves the problem: { "name": "vibe", "description": "My first vibe project.", "homepage": "http://example.o

Re: What is the preferred method for testing the existence of a key in an associative array?

2013-09-13 Thread Orvid King
On Friday, 13 September 2013 at 14:03:48 UTC, Gary Willoughby wrote: What is the preferred method for testing the existence of a key in an associative array? Well, I usually do it as: int[string] someCache; int getValue(string key) { if (auto val = key in someCache) return *val;

Re: Get constructor for a class

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 14:02:15 UTC, Gary Willoughby wrote: On Friday, 13 September 2013 at 13:31:34 UTC, simendsjo wrote: On Friday, 13 September 2013 at 13:16:12 UTC, Gary Willoughby wrote: On Friday, 13 September 2013 at 09:12:53 UTC, simendsjo wrote: allMembers returns "this", but

Re: DMD crashes without giving any info

2013-09-13 Thread simendsjo
Added a bug report: http://d.puremagic.com/issues/show_bug.cgi?id=11023

Re: What is the preferred method for testing the existence of a key in an associative array?

2013-09-13 Thread Adam D. Ruppe
On Friday, 13 September 2013 at 14:03:48 UTC, Gary Willoughby wrote: What is the preferred method for testing the existence of a key in an associative array? I use the in operator: if(key in aa) { there } if(key !in aa) { not there} You can also fetch the pointer right there too: if(auto

Re: Get constructor for a class

2013-09-13 Thread Gary Willoughby
On Friday, 13 September 2013 at 13:31:34 UTC, simendsjo wrote: On Friday, 13 September 2013 at 13:16:12 UTC, Gary Willoughby wrote: On Friday, 13 September 2013 at 09:12:53 UTC, simendsjo wrote: allMembers returns "this", but trying to get "this" or "__ctor" using getMember fails. Is there any

What is the preferred method for testing the existence of a key in an associative array?

2013-09-13 Thread Gary Willoughby
What is the preferred method for testing the existence of a key in an associative array?

Re: DMD crashes without giving any info

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 12:45:06 UTC, nazriel wrote: On Friday, 13 September 2013 at 12:41:44 UTC, simendsjo wrote: (...) Is there any way to get more verbose info from dmd? Run it via GDB, OllyDBG, [putyourfavouritedebugerhere] The error is Access Violation when reading 0004. I

Re: [OT] Job postings

2013-09-13 Thread Joseph Rushton Wakeling
On 13/09/13 15:37, Dicebot wrote: I don't think it is really appropriate for positions unrelated with D (or language design). It is not bad on its own but where are we going to draw the line? In general, random ads is not something I'd like to see in newsgroup :) This was also my concern, which

Re: [OT] Job postings

2013-09-13 Thread Dicebot
On Friday, 13 September 2013 at 13:20:57 UTC, Joseph Rushton Wakeling wrote: Hello all, OT question -- is there an etiquette/standard accepted practice for posting news of job openings to the D community? I wouldn't normally do this, but in this case it's on behalf of friends for whom I have

Re: Get constructor for a class

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 13:16:12 UTC, Gary Willoughby wrote: On Friday, 13 September 2013 at 09:12:53 UTC, simendsjo wrote: allMembers returns "this", but trying to get "this" or "__ctor" using getMember fails. Is there any way to get this method? foreach (func; __traits(getOverloads,

[OT] Job postings

2013-09-13 Thread Joseph Rushton Wakeling
Hello all, OT question -- is there an etiquette/standard accepted practice for posting news of job openings to the D community? I wouldn't normally do this, but in this case it's on behalf of friends for whom I have a very great deal of respect and who I think would be very exciting to work f

Re: Get constructor for a class

2013-09-13 Thread Gary Willoughby
On Friday, 13 September 2013 at 09:12:53 UTC, simendsjo wrote: allMembers returns "this", but trying to get "this" or "__ctor" using getMember fails. Is there any way to get this method? foreach (func; __traits(getOverloads, T, "__ctor")) { ... }

Re: DMD crashes without giving any info

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 12:53:17 UTC, bearophile wrote: simendsjo: What should I do when DMD keeps crashing and doesn't give me any output? I suggest to look for stack overflows in the program (and/or increase the stack space). Since some time it has stopped giving a "stack overflow

Re: DMD crashes without giving any info

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 12:45:06 UTC, nazriel wrote: On Friday, 13 September 2013 at 12:41:44 UTC, simendsjo wrote: What should I do when DMD keeps crashing and doesn't give me any output? I'm using dmd 2.063.2 on win8. This is all that -v gives me before crashing.. binaryC:\dmd\w

Re: DMD crashes without giving any info

2013-09-13 Thread bearophile
simendsjo: What should I do when DMD keeps crashing and doesn't give me any output? I suggest to look for stack overflows in the program (and/or increase the stack space). Since some time it has stopped giving a "stack overflow" message. Bye, bearophile

Re: DMD crashes without giving any info

2013-09-13 Thread nazriel
On Friday, 13 September 2013 at 12:41:44 UTC, simendsjo wrote: What should I do when DMD keeps crashing and doesn't give me any output? I'm using dmd 2.063.2 on win8. This is all that -v gives me before crashing.. binaryC:\dmd\windows\bin\dmd.exe version v2.063.2 configC:\dmd\windows

DMD crashes without giving any info

2013-09-13 Thread simendsjo
What should I do when DMD keeps crashing and doesn't give me any output? I'm using dmd 2.063.2 on win8. This is all that -v gives me before crashing.. binaryC:\dmd\windows\bin\dmd.exe version v2.063.2 configC:\dmd\windows\bin\sc.ini parse app I've tried compiling just object file

Get constructor for a class

2013-09-13 Thread simendsjo
allMembers returns "this", but trying to get "this" or "__ctor" using getMember fails. Is there any way to get this method?

Re: What does __parameters return?

2013-09-13 Thread simendsjo
On Friday, 13 September 2013 at 07:42:48 UTC, Jacob Carlborg wrote: On 2013-09-13 08:33, simendsjo wrote: Didn't know you could call __traits(identifier for the __parameter values. __parameters is practically undocumented, and doesn't even have an example. It's documented here: http://dlan

Re: What does __parameters return?

2013-09-13 Thread Jacob Carlborg
On 2013-09-13 08:33, simendsjo wrote: Didn't know you could call __traits(identifier for the __parameter values. __parameters is practically undocumented, and doesn't even have an example. It's documented here: http://dlang.org/expression.html#IsExpression Scroll down to the table, next to f