Re: Using attributes inside template instantiation

2014-06-26 Thread Uranuz via Digitalmars-d-learn
But if I write @(hello) struct Hello {} so all of the variables that have type Hello will have attribute @(hello) like come type qualifier because attribute is a part of declaration of Hello. Do I understand correctly?

import except one?

2014-06-26 Thread Puming via Digitalmars-d-learn
Hi, I'm using scriptlike, which imports everything from std.process for convienience, but I also need to import another module, which contains a class `Config`, it conflicts with std.process.Config. I don't actually need std.process.Config, but I need many other symbols in scriptlike and

Re: import except one?

2014-06-26 Thread bearophile via Digitalmars-d-learn
Puming: I'm using scriptlike, which imports everything from std.process for convienience, but I also need to import another module, which contains a class `Config`, it conflicts with std.process.Config. I don't actually need std.process.Config, but I need many other symbols in scriptlike and

Re: [OT]I throw in the towel

2014-06-26 Thread Chris via Digitalmars-d-learn
On Thursday, 26 June 2014 at 08:36:15 UTC, Chris wrote: On Wednesday, 25 June 2014 at 09:29:35 UTC, Orfeo wrote: I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb (https://github.com/pszturmaj/ddb) The application should run on

Re: [OT]I throw in the towel

2014-06-26 Thread Chris via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 09:29:35 UTC, Orfeo wrote: I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb (https://github.com/pszturmaj/ddb) The application should run on WinXp or Win7. After a week of work I throw in the towel ...

Re: [OT]I throw in the towel

2014-06-26 Thread Chris via Digitalmars-d-learn
On Thursday, 26 June 2014 at 08:39:46 UTC, Chris wrote: On Thursday, 26 June 2014 at 08:36:15 UTC, Chris wrote: On Wednesday, 25 June 2014 at 09:29:35 UTC, Orfeo wrote: I wanted to create a simple application to display and edit data from postgresql database using GtkD and ddb

Re: DDoc and private members / mixins / UDAs

2014-06-26 Thread Stefan Frijters via Digitalmars-d-learn
On Thursday, 26 June 2014 at 02:33:43 UTC, Mathias LANG wrote: On Wednesday, 25 June 2014 at 18:49:27 UTC, Stefan Frijters wrote: Let me preface this by admitting that I'm not sure I'm using the DDoc functionality properly at all, so let me know if my questions are bogus. Is it possible to:

Re: DDoc and private members / mixins / UDAs

2014-06-26 Thread bearophile via Digitalmars-d-learn
Stefan Frijters: I found a pull request to add __traits(documentation, ...)[1] which would also allow me to solve my problem as a workaround, does anyone know if this is still moving forward? You can state in that GitHub thread that you could use that feature. There are many stalled nice

close program by code

2014-06-26 Thread pgtkda via Digitalmars-d-learn
How can i close my application by code?

Re: [OT]I throw in the towel

2014-06-26 Thread seany via Digitalmars-d-learn
+ 1 for own GUI + graphics module for D

Re: Assosiative array pop

2014-06-26 Thread seany via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 14:17:50 UTC, Meta wrote: If you want something like a hash table that preserves insertion order, you could try using an array of tuples instead. Then to pop the first element, just do 'arr = arr[1..$]'. Thank you, this is _exactly_ what I was looking for!

Re: Assosiative array pop

2014-06-26 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 14:17:50 UTC, Meta wrote: Then to pop the first element, just do 'arr = arr[1..$]'. Or import std.array to get the range primitives for slices: import std.array; void main() { auto arr = [1, 2, 3, 4]; arr.popFront(); assert(arr.front == 2); }

Re: close program by code

2014-06-26 Thread FreeSlave via Digitalmars-d-learn
On Thursday, 26 June 2014 at 09:05:23 UTC, pgtkda wrote: How can i close my application by code? Do you mean exit status? Just call exit function from C library. import std.c.stdlib; void main() { exit(0); }

Re: close program by code

2014-06-26 Thread pgtkda via Digitalmars-d-learn
On Thursday, 26 June 2014 at 09:58:50 UTC, FreeSlave wrote: On Thursday, 26 June 2014 at 09:05:23 UTC, pgtkda wrote: How can i close my application by code? Do you mean exit status? Just call exit function from C library. import std.c.stdlib; void main() { exit(0); } wow, thank you

Re: new and GC.malloc fail, core.stdc.malloc works

2014-06-26 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 25 June 2014 at 14:44:22 UTC, John Colvin wrote: On Tuesday, 24 June 2014 at 10:16:38 UTC, bearophile wrote: John Colvin: I'm getting OutOfMemoryErrors on some machines when calling GC.malloc (or new) for anything large (more than about 1GB), where core.stdc.malloc works fine.

Re: close program by code

2014-06-26 Thread John Colvin via Digitalmars-d-learn
On Thursday, 26 June 2014 at 09:58:50 UTC, FreeSlave wrote: On Thursday, 26 June 2014 at 09:05:23 UTC, pgtkda wrote: How can i close my application by code? Do you mean exit status? Just call exit function from C library. import std.c.stdlib; void main() { exit(0); } Will destructors

Unqualified __FUNCTION__

2014-06-26 Thread Nordlöw
Is there an unqualified version of __FUNCTION__ that returns just treeContentId instead of fs.Dir.treeContentId ?

Re: close program by code

2014-06-26 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 26 June 2014 at 10:40:00 UTC, John Colvin wrote: On Thursday, 26 June 2014 at 09:58:50 UTC, FreeSlave wrote: On Thursday, 26 June 2014 at 09:05:23 UTC, pgtkda wrote: How can i close my application by code? Do you mean exit status? Just call exit function from C library.

Re: Unqualified __FUNCTION__

2014-06-26 Thread bearophile via Digitalmars-d-learn
Nordlöw: Is there an unqualified version of __FUNCTION__ that returns just treeContentId instead of fs.Dir.treeContentId ? I suggest to use the string functions to strip the part you need. Bye, bearophile

Re: Returning fixed size arrays

2014-06-26 Thread bearophile via Digitalmars-d-learn
John Colvin: isn't this exactly what the System V ABI specifies anyway? Large aggregate returns are allocated on the calling stack, passed by hidden pointer. So do you know why D is not using that design? Bye, bearophile

Re: close program by code

2014-06-26 Thread Chris Nicholson-Sauls via Digitalmars-d-learn
On Thursday, 26 June 2014 at 11:07:37 UTC, Rene Zwanenburg wrote: They won't. Same for module destructors. If you need those to work, another option is to throw some custom Exception type which is only caught in main. I really wish this wasn't the answer, but for some programs I've had to

Re: Returning fixed size arrays

2014-06-26 Thread John Colvin via Digitalmars-d-learn
On Thursday, 26 June 2014 at 12:06:34 UTC, bearophile wrote: John Colvin: isn't this exactly what the System V ABI specifies anyway? Large aggregate returns are allocated on the calling stack, passed by hidden pointer. So do you know why D is not using that design? Bye, bearophile It is,

Re: Returning fixed size arrays

2014-06-26 Thread bearophile via Digitalmars-d-learn
John Colvin: It is, As far as I know, D is using that as an optimization, not as an ABI default that must happen at all optimization levels. but a copy is made after the function returns anyway, for reasons unknown to me. For some reason the optimizer can't elide it (ldc2 -O5 -release,

Re: close program by code

2014-06-26 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jun 26, 2014 at 01:23:17PM +, Chris Nicholson-Sauls via Digitalmars-d-learn wrote: On Thursday, 26 June 2014 at 11:07:37 UTC, Rene Zwanenburg wrote: They won't. Same for module destructors. If you need those to work, another option is to throw some custom Exception type which

SList: How do I use linearRemove?

2014-06-26 Thread Lemonfiend via Digitalmars-d-learn
--- module main; void main() { struct Tree { int apples; } import std.container; SList!Tree list; Tree tree = Tree(5); list.insert(tree); //list.linearRemove(tree); // -- Error. What is the correct way? } ---

Re: close program by code

2014-06-26 Thread FreeSlave via Digitalmars-d-learn
On Thursday, 26 June 2014 at 11:07:37 UTC, Rene Zwanenburg wrote: On Thursday, 26 June 2014 at 10:40:00 UTC, John Colvin wrote: On Thursday, 26 June 2014 at 09:58:50 UTC, FreeSlave wrote: On Thursday, 26 June 2014 at 09:05:23 UTC, pgtkda wrote: How can i close my application by code? Do you

Re: SList: How do I use linearRemove?

2014-06-26 Thread bearophile via Digitalmars-d-learn
Lemonfiend: //list.linearRemove(tree); // -- Error. What is the correct way? } --- linearRemove is linear, so I think it accepts a range. Perhaps the once range is enough. Bye, bearophile

Re: SList: How do I use linearRemove?

2014-06-26 Thread Lemonfiend via Digitalmars-d-learn
linearRemove is linear, so I think it accepts a range. Perhaps the once range is enough. I cannot find once in the docs. Did you mean std.range.only? Error: function std.container.SList!(Tree).SList.linearRemove (Range r) is not callable using argument types (OnlyResult!(Tree, 1u))

Re: import except one?

2014-06-26 Thread sigod via Digitalmars-d-learn
``` import std.process : Config_ = Config; ```

Re: import except one?

2014-06-26 Thread sigod via Digitalmars-d-learn
Sorry, wrong one. There seems no solution for this. So, you must use fully qualified name.

Re: SList: How do I use linearRemove?

2014-06-26 Thread sigod via Digitalmars-d-learn
Take a look at unittests in [std.container.slist][0]: ``` unittest { auto s = SList!int(1, 2, 3, 4, 5); auto r = s[]; popFrontN(r, 3); auto r1 = s.linearRemove(r); assert(s == SList!int(1, 2, 3)); assert(r1.empty); } unittest { auto s = SList!int(1, 2, 3, 4, 5, 6, 7,

Re: Assosiative array pop

2014-06-26 Thread Meta via Digitalmars-d-learn
On Thursday, 26 June 2014 at 09:21:28 UTC, seany wrote: On Wednesday, 25 June 2014 at 14:17:50 UTC, Meta wrote: If you want something like a hash table that preserves insertion order, you could try using an array of tuples instead. Then to pop the first element, just do 'arr = arr[1..$]'.

Re: import except one?

2014-06-26 Thread sigod via Digitalmars-d-learn
Dirty solution: ``` import scriptlike; import your_module; import your_module : Config; ``` So, `Config` from your module will override one from scriptlike.

Re: Is their a way for a Child process to modify its Parent's environment?

2014-06-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tue, 24 Jun 2014 21:53:51 -0400, WhatMeWorry kc_hea...@yahoo.com wrote: I open a command line window, and run the following 6 line program void main() { string envPath = environment[PATH]; writeln(PATH is: , envPath); envPath ~= r;F:\dmd2\windows\bin; environment[PATH]

Re: Using attributes inside template instantiation

2014-06-26 Thread Meta via Digitalmars-d-learn
On Thursday, 26 June 2014 at 07:11:03 UTC, Uranuz wrote: But if I write @(hello) struct Hello {} so all of the variables that have type Hello will have attribute @(hello) like come type qualifier because attribute is a part of declaration of Hello. Do I understand correctly? No, it is only

httpS post fail at tango

2014-06-26 Thread JJDuck via Digitalmars-d-learn
I use Tango's example from http://www.dsource.org/projects/tango/docs/stable/ // open a web-page for posting (see HttpGet for simple reading) auto post = new HttpPost (http://yourhost/yourpath;); // send, retrieve and display response Cout (cast(char[]) post.write(posted data, text/plain));

Re: SList: How do I use linearRemove?

2014-06-26 Thread Lemonfiend via Digitalmars-d-learn
unittest { auto s = SList!int(1, 2, 3, 4, 5); auto r = s[]; popFrontN(r, 3); auto r1 = s.linearRemove(r); assert(s == SList!int(1, 2, 3)); assert(r1.empty); } This works: auto s = SList!int(1, 2, 3, 4, 5); auto r = s[]; popFrontN(r, 1); auto r1 = s.linearRemove(r); This

Re: httpS post fail at tango

2014-06-26 Thread JJDuck via Digitalmars-d-learn
On Thursday, 26 June 2014 at 16:33:57 UTC, JJDuck wrote: I tried to use phobos , but there is no such function exists for posting to https too

Getting libcurl for 64 bit Windows

2014-06-26 Thread Mark Isaacson via Digitalmars-d-learn
I am attempting to make use of std.net.curl and having trouble acquiring libcurl for 64 bit Windows. I need to be able to link with the MSVC linker (which happens to be the default when compiling using dmd with -m64). I've looked on the libcurl website and not found any downloads that look

Re: Getting libcurl for 64 bit Windows

2014-06-26 Thread Mark Isaacson via Digitalmars-d-learn
Managed to build it successfully I think, but have actually returned to the problem that initially caused me to want to try and build the library in the first place: If I try to build a simple program: import std.stdio; import std.net.curl; void main() { writeln(Hello world); } The program

Re: Getting libcurl for 64 bit Windows

2014-06-26 Thread Andrei Alexandrescu via Digitalmars-d-learn
On 6/26/14, 11:11 AM, Mark Isaacson wrote: Managed to build it successfully I think, but have actually returned to the problem that initially caused me to want to try and build the library in the first place: If I try to build a simple program: import std.stdio; import std.net.curl; void

Re: SList: How do I use linearRemove?

2014-06-26 Thread sigod via Digitalmars-d-learn
First case is a bug. I'll make pull request. Not sure about second.

Re: Getting libcurl for 64 bit Windows

2014-06-26 Thread Mark Isaacson via Digitalmars-d-learn
Resolved the issue.

Re: Getting libcurl for 64 bit Windows

2014-06-26 Thread Brad Roberts via Digitalmars-d-learn
The one that the win64 auto-tester uses is here: http://downloads.dlang.org/other/ curl-7.28.1-devel-rainer.win64.zip There's a newer one available there, but I can't vouch for it. On 6/26/14, 11:49 AM, Andrei Alexandrescu via Digitalmars-d-learn wrote: On 6/26/14, 11:11 AM, Mark

Re: import except one?

2014-06-26 Thread Puming via Digitalmars-d-learn
On Thursday, 26 June 2014 at 16:02:15 UTC, sigod wrote: Dirty solution: ``` import scriptlike; import your_module; import your_module : Config; ``` So, `Config` from your module will override one from scriptlike. I'm currenly renaming my own symbol: ```d import scriptlike; import config :

Re: import except one?

2014-06-26 Thread Puming via Digitalmars-d-learn
On Thursday, 26 June 2014 at 08:02:24 UTC, bearophile wrote: Puming: I'm using scriptlike, which imports everything from std.process for convienience, but I also need to import another module, which contains a class `Config`, it conflicts with std.process.Config. I don't actually need