Re: Destroying structs without a typeinfo object

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 08:38:21 -0400, Benjamin Thaut wrote: Am 04.05.2012 14:18, schrieb Steven Schveighoffer: On Fri, 04 May 2012 02:45:03 -0400, Benjamin Thaut wrote: Hi, I'm currently doing some manual memory management and as the delete keyword is deperecated I want to replace it with

Re: Return by 'ref' problems...

2012-05-04 Thread Jakob Ovrum
On Friday, 4 May 2012 at 12:45:23 UTC, Timon Gehr wrote: This should work: const(Thing) function()ref blah2 = &func; Except that it does not, because 'ref' is not currently a valid function 'storage class'. This seems to be an issue that deserves a bug report. For ref functions, 'ref' is pa

Re: Return by 'ref' problems...

2012-05-04 Thread Timon Gehr
On 05/04/2012 10:38 AM, Manu wrote: So here's some problems. I use 'const ref' to pass structs to functions (note: because 'in ref' doesn't seem to work) And I often need to return structs by ref too, but I'm having problems: void test( const ref Thing x ) {} // this works fine. note, 'const re

Re: Destroying structs without a typeinfo object

2012-05-04 Thread Benjamin Thaut
Am 04.05.2012 14:18, schrieb Steven Schveighoffer: On Fri, 04 May 2012 02:45:03 -0400, Benjamin Thaut wrote: Hi, I'm currently doing some manual memory management and as the delete keyword is deperecated I want to replace it with a custom Delete template. I now need to destroy a array of stru

Re: Growing pains

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 05:00:10 -0400, Regan Heath wrote: Opera does this right too :) Yeah, I still have all my sent posts in opera... One thing that annoys me though, if a message doesn't get sent, it stays in your outbox. Then when you double-click on it to edit/resend, it's been refo

Re: Class methods in D?

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 01:13:07 -0400, Mehrdad wrote: Hmm... how exactly do you use RTInfo? (Is it usable yet? All I see is a void* and a dummy template.) You have to fill in object.di's RTInfo(T) to be whatever you want. As I said, it's very beta, intended as a hook to use for more precise

Re: Return by 'ref' problems...

2012-05-04 Thread Jakob Ovrum
On Friday, 4 May 2012 at 11:49:44 UTC, Jacob Carlborg wrote: On 2012-05-04 12:09, Manu wrote: Ah, of course! I didn't spot that >_< Thanks. I suppose technically, 'ref' can lead to the same ambiguity. This must be the core of the problem. ref needs to be supported with parentheses? I'm not

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 14:49, Jacob Carlborg wrote: > On 2012-05-04 12:09, Manu wrote: > > Ah, of course! I didn't spot that >_< >> Thanks. >> >> I suppose technically, 'ref' can lead to the same ambiguity. This must >> be the core of the problem. ref needs to be supported with parentheses? >> > > I'm no

Re: Destroying structs without a typeinfo object

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 02:45:03 -0400, Benjamin Thaut wrote: Hi, I'm currently doing some manual memory management and as the delete keyword is deperecated I want to replace it with a custom Delete template. I now need to destroy a array of structs, this however seems only be possible by

Re: Windows batch file to compile D code

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 12:37, Iain Staffell wrote: Thanks both for the suggestions. RDMD looks useful, but am I right thinking I can't run it from anywhere unless I'm able to mess with PATH variables? DVM will handle this for you. I can't figure out where to get started with DVM, so will give that a

Re: nginx reverse proxy for vibe tutorial

2012-05-04 Thread David
* using `try_files`, nginx complains that you can't use proxy_pass inside a named location (like `@vibe`), which means you can't use try_files to serve arbitrary static files, hence the massive list of extensions. why not doing: root /path/to/static location / { try_files $uri @app_proxy

Re: Return by 'ref' problems...

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 12:09, Manu wrote: Ah, of course! I didn't spot that >_< Thanks. I suppose technically, 'ref' can lead to the same ambiguity. This must be the core of the problem. ref needs to be supported with parentheses? I'm not sure, since you can't declare a variable as "ref" I think the

Re: When is casting const() away actually necessary? (Used to be: Re: Why D const is annoying)

2012-05-04 Thread Oleg Kuporosov
Hi folks, it was really good and productive discussion on const and immutability, special thanks for those (Jonatan,Steven,Cris,etc) who answered hard Mehrad's questions and clarified so important topics. Can I kindly ask you folks to update FAQ on the site to have ability for newcomers to

Re: Return by 'ref' problems...

2012-05-04 Thread bearophile
Jonathan M Davis: That's thanks to the nonsense that putting const on the left-hand side of a member function is legal, making it so that you _must_ use parens with const and return types for the const to apply to the return type rather than the function. In Phobos there is a closed enhancem

Re: Windows batch file to compile D code

2012-05-04 Thread Iain Staffell
On Thursday, 3 May 2012 at 16:29:48 UTC, Manu wrote: Are you a visual studio user? Tried VisualD? If not, tried Mono-D? EditPad is as far as I go! I tried using Code::Blocks about a year ago, but couldn't get it to play nicely with the compiler...

nginx reverse proxy for vibe tutorial

2012-05-04 Thread James Miller
I have spent some time setting up nginx as a reverse proxy for vibe, and I thought I might share some of my issues here for now, just in case it helps someone. I will assume that you are generally familiar with configuring nginx, where the files are, how server directives work etc. The basic

Re: Windows batch file to compile D code

2012-05-04 Thread Iain Staffell
On Thursday, 3 May 2012 at 18:55:17 UTC, simendsjo wrote: On Thu, 03 May 2012 15:29:07 +0200, David wrote: rdmd? http://dlang.org/rdmd.html And dvm: https://github.com/jacob-carlborg/dvm Thanks both for the suggestions. RDMD looks useful, but am I right thinking I can't run it from anywhe

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 11:46, Jonathan M Davis wrote: > typeof(foo) blah2 = &func; > I just spotted the problem: typeof(&foo) blah = &foo; Was missing the '&' before the type. This works... However, in my case, I don't have such a function defined to copy the type from, so it doesn't help me any :/

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 12:52, Jacob Carlborg wrote: > On 2012-05-04 10:38, Manu wrote: > >> This syntax complains, but it's precisely the same expression I use to > > pass an argument in to a function, and it's fine there: >> remedy\modules\hud.d(35):**Error: function remedy.hud.func without >> 'this' c

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
So, the only overhead in making a virtual call this way over calling the method directly is exactly 1 extra function call? On Fri, May 4, 2012 at 2:02 PM, jerro wrote: > On Friday, 4 May 2012 at 09:51:51 UTC, Gor Gyolchanyan wrote: >> >> Does this have an overhead over calling virtual method dire

Re: virtual method pointer

2012-05-04 Thread jerro
On Friday, 4 May 2012 at 09:51:51 UTC, Gor Gyolchanyan wrote: Does this have an overhead over calling virtual method directly? If you call the function directly, it probably gets inlined. If you call it through a function pointer, it does have some overhead over calling the virtual method direc

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 11:46, Jonathan M Davis wrote: > On Friday, May 04, 2012 11:38:32 Manu wrote: > > I try rearranging the syntax to make the first issue stop complaining: > > > > ref const(Thing) func2() { return gThing; } // this seems to work now, > but > > i don't like the inconsistency... > > Tha

Re: Return by 'ref' problems...

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 10:38, Manu wrote: So here's some problems. I use 'const ref' to pass structs to functions (note: because 'in ref' doesn't seem to work) And I often need to return structs by ref too, but I'm having problems: void test( const ref Thing x ) {} // this works fine. note, 'const ref'

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
Does this have an overhead over calling virtual method directly? On Fri, May 4, 2012 at 1:30 PM, jerro wrote: > On Thursday, 3 May 2012 at 18:47:11 UTC, Gor Gyolchanyan wrote: >> >> I need to get a pointer to a virtual method, which is in turn a >> function pointer, being set by virtual method bi

Re: virtual method pointer

2012-05-04 Thread jerro
On Thursday, 3 May 2012 at 18:47:11 UTC, Gor Gyolchanyan wrote: I need to get a pointer to a virtual method, which is in turn a function pointer, being set by virtual method binding. Can anyone, please, tell me how to get it? Taking the delegate of the method won't do, because I need it to behav

Re: Growing pains

2012-05-04 Thread Andrei Alexandrescu
On 5/4/12 2:26 AM, Jeff Nowakowski wrote: On 05/03/2012 10:50 AM, Andrei Alexandrescu wrote: Just letting you all know we're working on the frustrating and increasingly frequent "Load at xx.xx, try again later" errors when reading this forum through NNTP. They are caused by a significant growth

Re: Class methods in D?

2012-05-04 Thread Jacob Carlborg
On 2012-05-03 19:21, Mehrdad wrote: In Windows, you need to register a "window class" before you can actually create an instance of it. Mapping this idea to D (and most other languages, I admit) is hard. Microsoft's solution in C# is pretty ugly. BTW, what's wrong with using some existing GUI

Re: GSOC Linker project

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 01:57, H. S. Teoh wrote: To be frank, I question the wisdom of not just using ld on Posix systems... but OTOH, the world *needs* better linker technology than we currently have, so this projects like this one is a good thing. He can start with a version for Windows. If as much as

Re: Growing pains

2012-05-04 Thread Regan Heath
On Thu, 03 May 2012 23:25:26 +0100, H. S. Teoh wrote: On Thu, May 03, 2012 at 01:51:20PM -0700, Ali Çehreli wrote: On 05/03/2012 01:52 PM, deadalnix wrote: >Le 03/05/2012 16:50, Andrei Alexandrescu a écrit : >>Just letting you all know we're working on the frustrating and >>increasingly freq

Re: Return by 'ref' problems...

2012-05-04 Thread Jonathan M Davis
On Friday, May 04, 2012 11:38:32 Manu wrote: > I try rearranging the syntax to make the first issue stop complaining: > > ref const(Thing) func2() { return gThing; } // this seems to work now, but > i don't like the inconsistency... That's thanks to the nonsense that putting const on the left-han

Return by 'ref' problems...

2012-05-04 Thread Manu
So here's some problems. I use 'const ref' to pass structs to functions (note: because 'in ref' doesn't seem to work) And I often need to return structs by ref too, but I'm having problems: void test( const ref Thing x ) {} // this works fine. note, 'const ref' works fine here (in lieu of 'in ref

Re: How to modify an element in a range/collection using its member function?

2012-05-04 Thread Jens Mueller
Chris Cain wrote: > On Thursday, 3 May 2012 at 10:03:55 UTC, Jens Mueller wrote: > >What is a good solution when using member functions on a > >range's/container's element? > > > >Note, the problem only applies when storing structs because > >classes > >behave like references. > > I think in this

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
Thanks, I'll look into it. On Fri, May 4, 2012 at 11:25 AM, Jacob Carlborg wrote: > On 2012-05-03 20:46, Gor Gyolchanyan wrote: >> >> I need to get a pointer to a virtual method, which is in turn a >> function pointer, being set by virtual method binding. >> Can anyone, please, tell me how to get

Re: Does D have too many features?

2012-05-04 Thread Jonathan M Davis
On Friday, May 04, 2012 09:38:24 Jacob Carlborg wrote: > On 2012-05-03 22:36, Jonathan M Davis wrote: > > On Thursday, May 03, 2012 15:30:40 Don Clugston wrote: > >> What is this D3 thing > >> As far as I can tell, 'D3' was invented by newcomers to the forums. > > > > I think that what it com

Re: Does D have too many features?

2012-05-04 Thread Jacob Carlborg
On 2012-05-03 22:36, Jonathan M Davis wrote: On Thursday, May 03, 2012 15:30:40 Don Clugston wrote: What is this D3 thing As far as I can tell, 'D3' was invented by newcomers to the forums. I think that what it comes down to is that there are a variety of people who want features added or

Re: virtual method pointer

2012-05-04 Thread Jacob Carlborg
On 2012-05-03 20:46, Gor Gyolchanyan wrote: I need to get a pointer to a virtual method, which is in turn a function pointer, being set by virtual method binding. Can anyone, please, tell me how to get it? Taking the delegate of the method won't do, because I need it to behave exactly as a virtua

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
Cool! Thanks! So all I need to do is remember the indices of functions in the vtable and extract them manually every time like this, right? On Fri, May 4, 2012 at 5:31 AM, Mehrdad wrote: > class Foo > { >        void test() { } > } > > void main(string[] args) > { >        auto f = new Foo(); >  

Re: Does D have too many features?

2012-05-04 Thread Iain Buclaw
On 4 May 2012 01:40, Alex Rønne Petersen wrote: > On 04-05-2012 02:13, Iain Buclaw wrote: >> >> On 3 May 2012 16:13, Don Clugston  wrote: >>> >>> On 03/05/12 16:13, Andrei Alexandrescu wrote: >>> On 5/3/12 9:55 AM, Don Clugston wrote: > > > On 28/04/12 20:47, Walter Bright wr

<    1   2