Re: avgtime - Small D util for your everyday benchmarking needs

2012-03-24 Thread Marco Leise
Am Fri, 23 Mar 2012 09:02:01 +0100 schrieb Juan Manuel Cabo juanmanuel.c...@gmail.com: On Friday, 23 March 2012 at 05:16:20 UTC, Andrei Alexandrescu wrote: [.] (man, the gaussian curve is everywhere, it never ceases to perplex me). I'm actually surprised. I'm working on

Re: avgtime - Small D util for your everyday benchmarking needs

2012-03-24 Thread Andrei Alexandrescu
On 3/23/12 5:42 PM, Manfred Nowak wrote: Andrei Alexandrescu wrote: In the limit, taking the minimum over infinitely many measurements of X would yield T. True, if the thoretical variance of the distribution of T is close to zero. But horrible wrong, if T depends on an algorithm that is fast

Re: GSoC: Linear Algebra and the SciD library

2012-03-24 Thread dsimcha
Cullen, I think the ideas page sums it up pretty well. Matrix factorizations, sparse matrices and general polish and bug fixing are the main goals I had in mind, though we're definitely open to any other ideas you may have. As someone with a strong math background, you could add a lot of

D web apps: cgi.d now supports scgi

2012-03-24 Thread Adam D. Ruppe
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff some docs: http://arsdnet.net/web.d/cgi.html http://arsdnet.net/web.d/cgi.d.html The file cgi.d in there is my base library for web apps. Previously, it spoke regular CGI, FastCGI (with help from a C lib) and

When do you use templates instead of CTFE?

2012-03-24 Thread Dan
Since there is CTFE, I keep running into, do I really need this as a template parameter? Why not put this in a constructor. And so on...

Re: virtual-by-default rant

2012-03-24 Thread Manu
On 23 March 2012 21:11, Adam D. Ruppe destructiona...@gmail.com wrote: Something that *might* help is to do unit tests. Yeah, that's kinda ass, but it would catch a stray virtual early. They're not necessarily 'stray' virtuals, they're inappropriate ones There's a time and place for virtuals,

Re: New hash

2012-03-24 Thread bearophile
H. S. Teoh: Someday, we have to revisit this whole const thing and how to make it work nicely with containers... I found that it is causing 40% of my troubles with the AA implementation. :-( This is a very good idea, but I see two problems in it: - Do you know someone intelligent enough to

Re: Implicit conversions for AA keys

2012-03-24 Thread Timon Gehr
On 03/24/2012 01:20 AM, H. S. Teoh wrote: On Fri, Mar 23, 2012 at 10:53:10PM +0100, Timon Gehr wrote: On 03/23/2012 10:07 PM, Timon Gehr wrote: I see. An alternative solution (one that does not make AAs depend on Phobos and is more slick) would be to use the const qualified key type for

Re: Implicit conversions for AA keys

2012-03-24 Thread Timon Gehr
On 03/24/2012 12:34 PM, Timon Gehr wrote: else static if(is(T _ == shared(U),U)) alias const(getConstQual!U) r; should be else static if(is(T _ == shared(U),U)) alias shared(const(getConstQual!U)) r; But it does not matter for the AA implementation because it only uses getConstQual with

Re: When do you use templates instead of CTFE?

2012-03-24 Thread Timon Gehr
On 03/24/2012 07:42 AM, Dan wrote: Since there is CTFE, I keep running into, do I really need this as a template parameter? Why not put this in a constructor. And so on... You use templates in combination with CTFE if - You have to perform computations on types. - You want template

Re: New hash

2012-03-24 Thread Timon Gehr
On 03/24/2012 03:39 AM, H. S. Teoh wrote: On Sat, Mar 24, 2012 at 02:39:35AM +0100, Andrej Mitrovic wrote: I thought I'd open this topic for discussion of issues with the new hash implementation. [...] Another issue: AA!(string,int[]) aa; auto x = aa.get(abc, []); This fails

Re: Implicit conversions for AA keys

2012-03-24 Thread Timon Gehr
On 03/24/2012 12:34 PM, Timon Gehr wrote: static if(is(typeof(getConstQual!Key.init.idup):Key)){ Better: static if(is(typeof(getConstQual!Key.init.idup):Key) !is(getConstQual!Key: Key)){

Re: Proposal: __traits(code, ...) and/or .codeof

2012-03-24 Thread deadalnix
Le 22/03/2012 19:06, Felix Hufnagel a écrit : in addition to .codeof, let's think about .astof returning an abstract syntax tree. WAY better !

Re: Proposal: __traits(code, ...) and/or .codeof

2012-03-24 Thread deadalnix
Le 22/03/2012 17:00, F i L a écrit : So the discussions about Attributes and Aspect Oriented Programming (AOP) got me thinking... Basically AOP requires injecting code fragments together in a comprehensible way. Similarly, Attributes that go beyond @note (such as @GC.NoScan) need similar

GSoC: interested in participating

2012-03-24 Thread Kiith-Sa
Hi. I'm currently studying at University of Pavol Jozef Šafárik in Košice, Slovakia and I'd like to participate in this year's GSoC. I'm especially interested in D as I'm currently using it for my projects (I'm the author of D:YAML - YAML parser/emitter library for D

Re: New hash

2012-03-24 Thread Andrei Alexandrescu
On 3/23/12 10:47 PM, Andrej Mitrovic wrote: On 3/24/12, Andrej Mitrovicandrej.mitrov...@gmail.com wrote: snip I've managed to test the hashes on a small-sized closed-source project (9K lines) which used hashes a lot. I've found no issues so far (no memory corruption or anything). Performance

Re: New hash

2012-03-24 Thread H. S. Teoh
On Sat, Mar 24, 2012 at 06:50:12AM +0100, Andrej Mitrovic wrote: On 3/24/12, H. S. Teoh hst...@quickfur.ath.cx wrote: [...] However, one case remains unsolved: either I can't find the right way to express this, or the new AA template needs fixing: AA!(string[const AA!(int[int])])

Re: New hash

2012-03-24 Thread H. S. Teoh
On Sat, Mar 24, 2012 at 07:49:13AM -0600, Andrei Alexandrescu wrote: On 3/23/12 10:47 PM, Andrej Mitrovic wrote: On 3/24/12, Andrej Mitrovicandrej.mitrov...@gmail.com wrote: snip I've managed to test the hashes on a small-sized closed-source project (9K lines) which used hashes a lot. I've

Re: virtual-by-default rant

2012-03-24 Thread Artur Skawina
On 03/23/12 20:11, Adam D. Ruppe wrote: http://dlang.org/traits.html#getVirtualFunctions if the name isn't on a list of approved virtuals, static assert fail. And you could probably do it in a clean and unintrusive way, by, for example, extending Object, or doing it on a per-module basis.

Re: Implicit conversions for AA keys

2012-03-24 Thread H. S. Teoh
On Sat, Mar 24, 2012 at 12:34:56PM +0100, Timon Gehr wrote: On 03/24/2012 01:20 AM, H. S. Teoh wrote: [...] Hmm. I decided that perhaps the full-fledged std.conv.to is a bit of an overkill, so I revised the AA code to compromise between needing std.conv.to and still deliver what Andrei wants.

Re: virtual-by-default rant

2012-03-24 Thread Adam D. Ruppe
On Saturday, 24 March 2012 at 14:43:21 UTC, Artur Skawina wrote: It needs at least the class or method marked as 'final' to do the right thing. Indeed, that's what I'm after. I'm making another post with an implementation in reply to manu in a minute.

Re: virtual-by-default rant

2012-03-24 Thread Adam D. Ruppe
On Saturday, 24 March 2012 at 10:56:27 UTC, Manu wrote: My objection to virtual-by-default, but, acknowledging that can't be changed, insistence on a virtual keyword is this. I like the idea of a virtual keyword btw. Adding a system like you describe to validate virtuals is not a complexity

Re: Implicit conversions for AA keys

2012-03-24 Thread H. S. Teoh
On Sat, Mar 24, 2012 at 12:34:56PM +0100, Timon Gehr wrote: [...] This solution creates unnecessary template bloat for every implicit conversion, duplicates compiler logic, and I think it does not work correctly because of other issues. I have refined my proof of concept. [...] OK, I've

Re: virtual-by-default rant

2012-03-24 Thread F i L
I think a better system would be to explicitly mark functions are virtual, and then use unittesting to catch virtual functions that don't need to be.

Re: virtual-by-default rant

2012-03-24 Thread Artur Skawina
On 03/24/12 16:16, Adam D. Ruppe wrote: On Saturday, 24 March 2012 at 10:56:27 UTC, Manu wrote: My objection to virtual-by-default, but, acknowledging that can't be changed, insistence on a virtual keyword is this. I like the idea of a virtual keyword btw. Adding a system like you

Re: virtual-by-default rant

2012-03-24 Thread Ary Manzana
On 3/24/12 3:03 AM, Manu wrote: On 23 March 2012 17:24, Ary Manzana a...@esperanto.org.ar mailto:a...@esperanto.org.ar wrote: On 3/18/12 9:23 AM, Manu wrote: The virtual model broken. I've complained about it lots, and people always say stfu, use 'final:' at the top of your

Re: virtual-by-default rant

2012-03-24 Thread Adam D. Ruppe
On Saturday, 24 March 2012 at 16:27:41 UTC, Artur Skawina wrote: The question is -- are there false positives? Yes, almost certainly. This only looks at the function definition; it is run well before the optimizer.

Instantiate the template class method

2012-03-24 Thread Igor Stepanov
Hi! I engaged in addition to dmd with runtime reflection and there was a problem: If we have any template class, the real instantiated only those methods that are used. And to сonstruct the runtime reflection, I need to instantiate the other methods. And here is a question: how to do it. I write

Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
I've been upgrading to a Windows 64 bit box. Running the D test suite, I ran into a very strange problem. Here's the program: --- extern(C) int printf(const char*, ...); int main() { byte[3] a; byte[3] b; byte[3] c; a[] = b[] + c[];

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 11:55 AM, Walter Bright wrote: I'm mystified. Does anyone have any ideas? If I add a del test.exe to the cc.bat file: ..\dmd test test del test.exe ..\dmd test --- It now fails with GetLastError() of 5, meaning Access is denied. The cc.bat

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Xinok
On Saturday, 24 March 2012 at 19:08:00 UTC, Walter Bright wrote: On 3/24/2012 11:55 AM, Walter Bright wrote: I'm mystified. Does anyone have any ideas? If I add a del test.exe to the cc.bat file: ..\dmd test test del test.exe ..\dmd test --- It now fails

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Brad Roberts
On 3/24/2012 12:07 PM, Walter Bright wrote: On 3/24/2012 11:55 AM, Walter Bright wrote: I'm mystified. Does anyone have any ideas? If I add a del test.exe to the cc.bat file: ..\dmd test test del test.exe ..\dmd test --- It now fails with

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 12:18 PM, Xinok wrote: If you have an antivirus, try disabling it before compiling. I have a brand new vanilla install of Windows 7 home premium.

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 12:19 PM, Brad Roberts wrote: I saw this sort of behavior in the auto-tester (was win7 at the time, At least I'm not losing my mind :-) now it's running on a windows server 2008 box) during the various combinations of compilation options until I switched to adding a counter and

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Nick Sabalausky
Walter Bright newshou...@digitalmars.com wrote in message news:jkl5ab$1ocp$1...@digitalmars.com... I've been upgrading to a Windows 64 bit box. Running the D test suite, I ran into a very strange problem. Here's the program: --- extern(C) int printf(const char*,

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 12:31 PM, Nick Sabalausky wrote: Windows is known to enjoy holding locks on files just for the fuck of it. See if the behavior changes if you add some delay just before the last line. Or, if you adjust it so that compiling test.d takes longer. I tried those. No dice.

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Nick Sabalausky
Nick Sabalausky a@a.a wrote in message news:jkl7fd$1rqs$1...@digitalmars.com... Windows is known to enjoy holding locks on files just for the fuck of it. See if the behavior changes if you add some delay just before the last line. Or, if you adjust it so that compiling test.d takes longer.

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Nick Sabalausky
Nick Sabalausky a@a.a wrote in message news:jkl816$1t08$1...@digitalmars.com... Nick Sabalausky a@a.a wrote in message news:jkl7fd$1rqs$1...@digitalmars.com... Windows is known to enjoy holding locks on files just for the fuck of it. See if the behavior changes if you add some delay just

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 12:36 PM, Walter Bright wrote: On 3/24/2012 12:31 PM, Nick Sabalausky wrote: Windows is known to enjoy holding locks on files just for the fuck of it. See if the behavior changes if you add some delay just before the last line. Or, if you adjust it so that compiling test.d takes

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 12:48 PM, Walter Bright wrote: On 3/24/2012 12:36 PM, Walter Bright wrote: On 3/24/2012 12:31 PM, Nick Sabalausky wrote: Windows is known to enjoy holding locks on files just for the fuck of it. See if the behavior changes if you add some delay just before the last line. Or, if

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Martin Nowak
On Sat, 24 Mar 2012 20:48:47 +0100, Walter Bright newshou...@digitalmars.com wrote: On 3/24/2012 12:36 PM, Walter Bright wrote: On 3/24/2012 12:31 PM, Nick Sabalausky wrote: Windows is known to enjoy holding locks on files just for the fuck of it. See if the behavior changes if you add

BufferedInputRange revisited

2012-03-24 Thread Martin Nowak
While working on text processing again I made another attempt at writing an InputRange buffer. Instead of complex reference counting, that would be needed to define save it only 'fixes' foreach, i.e. one can use foreach to peek at the input range without actually consuming input.

Re: New hash

2012-03-24 Thread Andrej Mitrovic
On 3/24/12, H. S. Teoh hst...@quickfur.ath.cx wrote: But this can't be the source of the problem, because, if anything, the hash function I substituted (which is the same as that for char[] and string currently) should be *faster*. I'll try and make a test-case to get to the bottom of this.

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 12:40 PM, Nick Sabalausky wrote: If it still fails with the delay, you can probably find out (for whatever help it might be) what process is holding the file open by adding a pause right after running test. Then before Press[ing] a key as it suggests, run SysInternal's Process

What about Uri class?

2012-03-24 Thread Andrea Fontana
What about a Uri class to build/split uri in components? Reading RFC, there's a regex to split uri: string url = http://example.com/path/subpath/?query=valquery2=val#frag;; enum ctr = ctRegex!(r^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?); auto m =

Re: Using D for Soft Synth development

2012-03-24 Thread Norbert Nemec
On 24.03.2012 17:18, Timo Westkämper timo.westkam...@gmail.com wrote: I am trying to get started with D programming. My target is to write LV2 plugins (http://lv2plug.in/trac/) with it, but it seems there aren't any ready made bindings. Do you know of anyone else who would have gone into this

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Andrej Mitrovic
On 3/24/12, Walter Bright newshou...@digitalmars.com wrote: Running the D test suite, I ran into a very strange problem. I can reproduce the problem on Win7 x64. It doesn't seem to have anything to do with DMD. This is my cc.bat: dmd -c test.obj link test.obj test link test.obj But it's not

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Nick Sabalausky
Walter Bright newshou...@digitalmars.com wrote in message news:jklc1h$25l6$1...@digitalmars.com... Also, looking at the process list when doing a PAUSE shows no new processes, but it still fails. No, no, first download this, it's like Task Manager on steriods:

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 2:08 PM, Andrej Mitrovic wrote: But it's not Optlink's fault either. Unilink has the same issue: I did initially suspect Optlink. It's good to know that that is not the problem.

Re: What about Uri class?

2012-03-24 Thread Nick Sabalausky
Andrea Fontana nos...@example.com wrote in message news:ojmxjzkuimgrtpved...@forum.dlang.org... What about a Uri class to build/split uri in components? Reading RFC, there's a regex to split uri: string url = http://example.com/path/subpath/?query=valquery2=val#frag;;

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Andrej Mitrovic
On 3/24/12, Walter Bright newshou...@digitalmars.com wrote: On 3/24/2012 2:08 PM, Andrej Mitrovic wrote: But it's not Optlink's fault either. Unilink has the same issue: I did initially suspect Optlink. It's good to know that that is not the problem. In the meantime if you're just building

Re: Implicit conversions for AA keys

2012-03-24 Thread Timon Gehr
On 03/24/2012 05:14 PM, H. S. Teoh wrote: On Sat, Mar 24, 2012 at 12:34:56PM +0100, Timon Gehr wrote: [...] This solution creates unnecessary template bloat for every implicit conversion, duplicates compiler logic, and I think it does not work correctly because of other issues. I have refined

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 2:39 PM, Andrej Mitrovic wrote: On 3/24/12, Walter Brightnewshou...@digitalmars.com wrote: On 3/24/2012 2:08 PM, Andrej Mitrovic wrote: But it's not Optlink's fault either. Unilink has the same issue: I did initially suspect Optlink. It's good to know that that is not the

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Andrej Mitrovic
On 3/24/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: It could be a Win7 x64 bug. If you'll give me 20 minutes I'll get a hold of an x86 Win7 installation and see if I can reproduce the bug there. I can't reproduce this on Win7 x86. I've tried numerous times but it never failed. It

Re: Array ops give sharing violation under Windows 7 64 bit?

2012-03-24 Thread Walter Bright
On 3/24/2012 2:55 PM, Andrej Mitrovic wrote: On 3/24/12, Andrej Mitrovicandrej.mitrov...@gmail.com wrote: It could be a Win7 x64 bug. If you'll give me 20 minutes I'll get a hold of an x86 Win7 installation and see if I can reproduce the bug there. I can't reproduce this on Win7 x86. I've

Regex performance

2012-03-24 Thread Andrei Alexandrescu
This might be worth looking into. Dmitry? http://jblewitt.com/blog/?p=462 Andrei

Re: Using D for Soft Synth development

2012-03-24 Thread Andrej Mitrovic
On 3/24/12, Norbert Nemec norb...@nemec-online.de wrote: Apart from this, it should just be setting up the bindings, pretty much like any other D project using an existing C library. Yeah. From what I can tell all you have to do is translate the lv2.h header to a D file (maybe try HTOD), and

Re: Regex performance

2012-03-24 Thread Kapps
On Saturday, 24 March 2012 at 23:06:54 UTC, Andrei Alexandrescu wrote: This might be worth looking into. Dmitry? http://jblewitt.com/blog/?p=462 Andrei A difference of that amount is likely expecting something like regex(Blah) to not have to create a new regex struct each time, something

Re: Regex performance

2012-03-24 Thread Nick Sabalausky
Nick Sabalausky a@a.a wrote in message news:jklomm$2seb$1...@digitalmars.com... Yea, I agree that's what it sounds like. I tried to post a response, but I'm just getting this result (and yes, this is with JS enabled): Asirra validation failed!

Re: Regex performance

2012-03-24 Thread Nick Sabalausky
Kapps opantm2+s...@gmail.com wrote in message news:yudtvjsuhhimrhqai...@forum.dlang.org... On Saturday, 24 March 2012 at 23:06:54 UTC, Andrei Alexandrescu wrote: This might be worth looking into. Dmitry? http://jblewitt.com/blog/?p=462 Andrei A difference of that amount is likely

Re: Regarding implementing a stable sort for Phobos

2012-03-24 Thread Xinok
On Thursday, 15 March 2012 at 20:20:59 UTC, Xinok wrote: Third update: http://www.mediafire.com/?9jx07estd58wh2p + Added in-place sorting; Set template argument inPlace to true + Fixed CTFE compatibility issues + Vastly improved unittest + CTFE unittest will no longer stop compilation upon

in / out for C++ programmers

2012-03-24 Thread Dan
When would you use in / out parameters instead of ref const keywords? Thanks.

Re: in / out for C++ programmers

2012-03-24 Thread Jonathan M Davis
On Saturday, March 24, 2012 07:28:08 Dan wrote: When would you use in / out parameters instead of ref const keywords? out sets the variable to its init value, so you don't run into issues with the behavior of the function changing based on the value of the variable that you passed in. out is

Re: in / out for C++ programmers

2012-03-24 Thread Ali Çehreli
On 03/23/2012 11:28 PM, Dan wrote: When would you use in / out parameters instead of ref const keywords? I am just about finished translating a chapter exactly on that topic. I've just realized that I have some questions myself. :) 'out' is the equivalent of a reference in C++, with

Re: in / out for C++ programmers

2012-03-24 Thread Jonathan M Davis
On Friday, March 23, 2012 23:37:27 Ali Çehreli wrote: 'in' is the same as 'const scope'. const part is easy to understand but I don't know what 'scope' does. I could not understand what the spec means with references in the parameter cannot be escaped (e.g. assigned to a global variable) for

Re: in / out for C++ programmers

2012-03-24 Thread Ali Çehreli
On 03/23/2012 11:50 PM, Jonathan M Davis wrote: On Friday, March 23, 2012 23:37:27 Ali Çehreli wrote: 'in' is the same as 'const scope'. const part is easy to understand but I don't know what 'scope' does. I could not understand what the spec means with references in the parameter cannot be

Re: in / out for C++ programmers

2012-03-24 Thread Jonathan M Davis
On Saturday, March 24, 2012 00:02:58 Ali Çehreli wrote: On 03/23/2012 11:50 PM, Jonathan M Davis wrote: On Friday, March 23, 2012 23:37:27 Ali Çehreli wrote: 'in' is the same as 'const scope'. const part is easy to understand but I don't know what 'scope' does. I could not understand

Re: in / out for C++ programmers

2012-03-24 Thread Jonathan M Davis
Apparently, scope parameters aren't currently checked at all, so they're _very_ buggy: http://d.puremagic.com/issues/show_bug.cgi?id=6931 - Jonathan M Davis

Re: in / out for C++ programmers

2012-03-24 Thread Ali Çehreli
On 03/23/2012 11:50 PM, Jonathan M Davis wrote: I believe that scope is used primarily with delegates however (particularly, since you often _want_ to be able to return a slice of an array passed to a function). It guarantees that the the delegate's context won't escape the function and

Re: string[] to char**

2012-03-24 Thread simendsjo
On Fri, 23 Mar 2012 19:23:07 +0100, Ali Çehreli acehr...@yahoo.com wrote: On 03/23/2012 08:48 AM, simendsjo wrote: What's the best way to convert char** from string[]? In C, char** communicates transfer of ownership. Is that what you are trying to do? Are you going to pass a slice to a C

Re: string[] to char**

2012-03-24 Thread simendsjo
On Fri, 23 Mar 2012 17:09:18 +0100, bearophile bearophileh...@lycos.com wrote: On Friday, 23 March 2012 at 15:48:12 UTC, simendsjo wrote: What's the best way to convert char** from string[]? This is one way to do it: import std.algorithm, std.array, std.string, core.stdc.stdio; void

Re: string[] to char**

2012-03-24 Thread simendsjo
On Fri, 23 Mar 2012 22:42:08 +0100, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 3/23/12, bearophile bearophileh...@lycos.com wrote: This is one way to do it: immutable(char)** p = array(map!toStringz(data)).ptr; This is asked so frequently that I think we could consider

Re: string[] to char**

2012-03-24 Thread simendsjo
On Sat, 24 Mar 2012 11:41:48 +0100, simendsjo simend...@gmail.com wrote: On Fri, 23 Mar 2012 17:09:18 +0100, bearophile bearophileh...@lycos.com wrote: On Friday, 23 March 2012 at 15:48:12 UTC, simendsjo wrote: What's the best way to convert char** from string[]? This is one way to do

Re: string[] to char**

2012-03-24 Thread bearophile
simendsjo: Oh, I didn't find toStringz, so I turned it into: It's in std.string. auto c_strings = strings.map!(toUTFz!(char*)).array().ptr; That's wrong syntax, that 2.059head doesn't enforce yet, map needs an ending (). Bye, bearophile

Re: Template constraint and specializations

2012-03-24 Thread Philippe Sigaud
On Fri, Mar 23, 2012 at 23:19, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: Yes but check the isA template. It seems there's something causing a nested variadic template to fail. This won't work in a template constraint (it returns false): But if you change Args... to Args then it

Re: Referencing an overloaded function

2012-03-24 Thread Philippe Sigaud
On Sat, Mar 24, 2012 at 13:13, John nos...@unavailable.com wrote: Is there any way to refer to a specific function overload? You can use __traits(getOverloads, aggregate, member) to get all overloads of member aggregate.member. Where an aggregate is a class, a struct or a module. module

Newbie prolem building with SCons

2012-03-24 Thread zhaopuming
Hi: I found that SCons now supports D, but when I tried to build a helloworld program, error occurred: undefined reference to `clock_gettime'. It seemed that adding -lrt after -lphobos2 would do the job, so I tried to add this in SConstruct: env = Environment() env.Append(LIBS = 'rt')

Re: Referencing an overloaded function

2012-03-24 Thread Mantis
24.03.2012 14:13, John написал: Is there any way to refer to a specific function overload? For example: import std.stdio; import std.traits; void foo() {} void foo(int x) {} void main() { writeln(foo.mangleof); writeln(ParameterTypeTuple!(foo).stringof); } Both of these statements

Re: Referencing an overloaded function

2012-03-24 Thread John
On Saturday, 24 March 2012 at 13:59:30 UTC, Philippe Sigaud wrote: module pack.mod; // needs to be XXX.YYY for __traits to work void foo() {} void foo(int x) {} template Alias(A...) { alias A Alias;} void main() { // The Alias!( ) trick is needed to work around a limitation in alias X Y

Re: Referencing an overloaded function

2012-03-24 Thread Artur Skawina
On 03/24/12 15:39, Mantis wrote: 24.03.2012 14:13, John написал: Is there any way to refer to a specific function overload? For example: import std.stdio; import std.traits; void foo() {} void foo(int x) {} void main() { writeln(foo.mangleof);

Making sense of ranges

2012-03-24 Thread Stewart Gordon
The documentation for std.range states http://dlang.org/phobos/std_range.html This module defines the notion of range (by the membership tests isInputRange, isForwardRange, isBidirectionalRange, isRandomAccessRange), range capability tests (such as hasLength or hasSlicing), and a few useful

Re: Referencing an overloaded function

2012-03-24 Thread Artur Skawina
On 03/24/12 18:07, Artur Skawina wrote: On 03/24/12 15:39, Mantis wrote: Will not hold for return types other than void, there may be some generic workaround (of course, you can pass return type as tempate parameter). Something like auto getOverload(alias func, A...)(A a) {

Re: Making sense of ranges

2012-03-24 Thread Ali Çehreli
On 03/24/2012 11:19 AM, Stewart Gordon wrote: The documentation for std.range states http://dlang.org/phobos/std_range.html This module defines the notion of range (by the membership tests isInputRange, isForwardRange, isBidirectionalRange, isRandomAccessRange), range capability tests (such

Re: Making sense of ranges

2012-03-24 Thread Dmitry Olshansky
On 24.03.2012 22:19, Stewart Gordon wrote: The documentation for std.range states http://dlang.org/phobos/std_range.html This module defines the notion of range (by the membership tests isInputRange, isForwardRange, isBidirectionalRange, isRandomAccessRange), range capability tests (such as

Re: Referencing an overloaded function

2012-03-24 Thread Timon Gehr
On 03/24/2012 09:07 PM, Philippe Sigaud wrote: On Sat, Mar 24, 2012 at 18:07, Artur Skawinaart.08...@gmail.com wrote: foreach (f; __traits(getOverloads, __traits(parent, main), foo)) { Hey, this ^^ it's a way to get the current module, right? Nice trick, I didn't

Re: Making sense of ranges

2012-03-24 Thread Stewart Gordon
On 24/03/2012 18:57, Ali Çehreli wrote: snip Iterating an output range is also by popFront(). So what it says is, put this element to the output range and advance the range. There is a gotcha about this when the output range is a slice: Whatever is just put into the range is popped right away!

Re: Making sense of ranges

2012-03-24 Thread Timon Gehr
On 03/25/2012 12:07 AM, Stewart Gordon wrote: On 24/03/2012 18:57, Ali Çehreli wrote: snip Iterating an output range is also by popFront(). So what it says is, put this element to the output range and advance the range. There is a gotcha about this when the output range is a slice: Whatever is

Re: Making sense of ranges

2012-03-24 Thread Jonathan M Davis
On Saturday, March 24, 2012 23:07:01 Stewart Gordon wrote: Something else I'm finding puzzling is moveFront, moveAt and moveBack. Is D trying to be C++11 or something? Move semantics don't seem to me to be useful in a language with GC. The GC doesn't have anything do with it. If you're

Re: Referencing an overloaded function

2012-03-24 Thread Artur Skawina
On 03/24/12 23:10, Timon Gehr wrote: On 03/24/2012 09:07 PM, Philippe Sigaud wrote: On Sat, Mar 24, 2012 at 18:07, Artur Skawinaart.08...@gmail.com wrote: foreach (f; __traits(getOverloads, __traits(parent, main), foo)) { Hey, this ^^ it's a way to get the current

Re: Making sense of ranges

2012-03-24 Thread Ali Çehreli
On 03/24/2012 04:07 PM, Stewart Gordon wrote: On 24/03/2012 18:57, Ali Çehreli wrote: snip Iterating an output range is also by popFront(). So what it says is, put this element to the output range and advance the range. There is a gotcha about this when the output range is a slice: Whatever is

Re: Referencing an overloaded function

2012-03-24 Thread Timon Gehr
On 03/25/2012 12:34 AM, Artur Skawina wrote: On 03/24/12 23:10, Timon Gehr wrote: On 03/24/2012 09:07 PM, Philippe Sigaud wrote: On Sat, Mar 24, 2012 at 18:07, Artur Skawinaart.08...@gmail.com wrote: foreach (f; __traits(getOverloads, __traits(parent, main), foo)) { Hey, this

Re: Making sense of ranges

2012-03-24 Thread Jonathan M Davis
On Saturday, March 24, 2012 18:14:46 Ali Çehreli wrote: I looked for rationale on Andrei's article. There is this bit about STL forward iterators: quote Input and forward iterators are syntactically identical but subtly different semantically—copying a forward iterator saves iteration

[Issue 7751] [ICE] From auto and forward reference

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7751 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||ice, pull

[Issue 7754] static this() in template is stripped during header gen

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7754 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull --- Comment #1

[Issue 7611] static this() in template is not executed in .lib

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7611 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 7754] static this() in template is stripped during header gen

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7754 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added CC|

[Issue 7722] Refuse normal functions to be used as properties

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7722 --- Comment #6 from Kenji Hara k.hara...@gmail.com 2012-03-24 00:24:18 PDT --- Reposted same pull: https://github.com/D-Programming-Language/dmd/pull/830 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ---

[Issue 7743] Parsing problem with nothrow delegate

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7743 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull

[Issue 7608] __traits(allMembers) is broken

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7608 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||pull, wrong-code ---

[Issue 7731] Assertion failure: 't' on line 7911 in file 'mtype.c'

2012-03-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=7731 Kenji Hara k.hara...@gmail.com changed: What|Removed |Added Keywords||ice, pull

  1   2   >