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

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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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: 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: 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: 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 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: 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: 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: 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: 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

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 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...

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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: Destroying structs without a typeinfo object

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 09:14:11 -0400, Steven Schveighoffer wrote: I remember that __dtor does the wrong thing, and I advocated it should do the same thing as calling xdtor, but it didn't go anywhere. See this bug report: http://d.puremagic.com/issues/show_bug.cgi?id=5667 -Steve

allMembers

2012-05-04 Thread Manu
So I do a lot of module scanning via allMembers, and I'm consistently running into an awkward problem: module test.blah; static this() { foreach(m; __traits(allMembers, test.module)) { // m is a string, the only way I know to address the thing m references is: mixin(m), and this can't be

Re: GSOC Linker project

2012-05-04 Thread Steven Schveighoffer
On Thu, 03 May 2012 19:47:24 -0400, Trass3r wrote: I'm interested in starting a project to make a linker besides optlink for dmd on windows. Imho changing dmd to use COFF (incl. 64 support) instead of that crappy OMF would be more beneficial than yet another linker. +1 -Steve

mixin templates and classes

2012-05-04 Thread Denis Shelomovskij
IMHO this should compile: --- mixin template T() { final void f() { } } class A { mixin T ta; } class B : A { mixin T tb; } --- these asserts should pass: --- mixin template T(string s) { string f() { return s; } } class A { mixin T!"T1" ta1; mixin T!"T2" ta2; mixin T!"T"; }

Re: Return by 'ref' problems...

2012-05-04 Thread H. S. Teoh
On Fri, May 04, 2012 at 01:46:21AM -0700, 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 incons

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 16:53, H. S. Teoh wrote: > On Fri, May 04, 2012 at 01:46:21AM -0700, 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

Re: allMembers

2012-05-04 Thread H. S. Teoh
On Fri, May 04, 2012 at 03:34:00PM +0200, Adam D. Ruppe wrote: > __traits(getMember, test.module, m); > > should work. Though you should probably test for non-data members before attempting to use getMember (try __traits(compiles, __traits(getMember, ...))). T -- Democracy: The triumph of pop

Re: allMembers

2012-05-04 Thread Manu
On 4 May 2012 16:34, Adam D. Ruppe wrote: > __traits(getMember, test.module, m); > > should work. > Tried that: static if( is( __traits( getMember, mixin( moduleName ), m ) == interface ) ) { pragma( msg, "Is an interface: " ~ m ); }

Re: allMembers

2012-05-04 Thread Manu
On 4 May 2012 17:01, Manu wrote: > On 4 May 2012 16:34, Adam D. Ruppe wrote: > >> __traits(getMember, test.module, m); >> >> should work. >> > > Tried that: > > static if( is( __traits( getMember, mixin( moduleName ), m ) == interface > ) ) > { > pragma( msg, "Is an interface: " ~ m ); > } >

Re: allMembers

2012-05-04 Thread Manu
On 4 May 2012 17:01, H. S. Teoh wrote: > On Fri, May 04, 2012 at 03:34:00PM +0200, Adam D. Ruppe wrote: > > __traits(getMember, test.module, m); > > > > should work. > > Though you should probably test for non-data members before attempting > to use getMember (try __traits(compiles, __traits(getM

Re: virtual method pointer

2012-05-04 Thread jerro
On Friday, 4 May 2012 at 10:05:54 UTC, Gor Gyolchanyan wrote: So, the only overhead in making a virtual call this way over calling the method directly is exactly 1 extra function call? I guess so. You are calling a function that does a virtual call and doesn't do anything else, so what other

Re: allMembers

2012-05-04 Thread H. S. Teoh
On Fri, May 04, 2012 at 05:03:36PM +0300, Manu wrote: > On 4 May 2012 17:01, Manu wrote: > > > On 4 May 2012 16:34, Adam D. Ruppe wrote: > > > >> __traits(getMember, test.module, m); > >> > >> should work. > >> > > > > Tried that: > > > > static if( is( __traits( getMember, mixin( moduleName ),

Re: allMembers

2012-05-04 Thread Manu
On 4 May 2012 17:09, H. S. Teoh wrote: > On Fri, May 04, 2012 at 05:03:36PM +0300, Manu wrote: > > On 4 May 2012 17:01, Manu wrote: > > > > > On 4 May 2012 16:34, Adam D. Ruppe wrote: > > > > > >> __traits(getMember, test.module, m); > > >> > > >> should work. > > >> > > > > > > Tried that: > >

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
Great! Thanks! After I'm done with this, I'll propose adding it to Phobos. A genuine dynamic dispatch mechanism would be very useful. On Fri, May 4, 2012 at 6:04 PM, jerro wrote: > On Friday, 4 May 2012 at 10:05:54 UTC, Gor Gyolchanyan wrote: >> >> So, the only overhead in making a virtual call t

Re: virtual method pointer

2012-05-04 Thread Mehrdad
Did you see my solution? I think it's what you're looking for... On Friday, 4 May 2012 at 10:05:54 UTC, Gor Gyolchanyan wrote: 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

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
Yes! Your solution looks exactly like what I wanted. The reason why I considered additional alternatives is because your solutions looks very fast (YES!!!), but not very portable and safe, so after testing, if it turns out to be inconsistent, I'll have to use something else. On Fri, May 4, 2012 at

Re: Return by 'ref' problems...

2012-05-04 Thread H. S. Teoh
On Fri, May 04, 2012 at 04:57:30PM +0300, Manu wrote: > On 4 May 2012 16:53, H. S. Teoh wrote: [...] > > Yeah, I've recently started building the habit of always using > > parentheses with const applied to a type, in order to make it less > > confusing with const as applied to a function. Even tho

Re: virtual method pointer

2012-05-04 Thread Mehrdad
Ah okay. Yeah it's not 'safe' at all... but I think the '6' comes from the number of members that Foo has. If you figure out how many methods there are in the v-table, then that should get you the index (though don't quote me on this... you should look at the compiler source code if you want to

True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Denis Shelomovskij
This idea is too obvious and I suppose I'm the only one not knowing it, but I have never seen it's implementation. Why? The idea: 1. `Object` class has hidden `isAlive` field which is true since construction and up to finalization. 2. Every method asserts that the object is alive first. 3. The

Re: Class methods in D?

2012-05-04 Thread Mehrdad
Oh okay, I see. Let me try it. :) @Everyone: Haha thanks for pointing me to the existing libraries. :) I'm doing this more for learning than anything else, so I'm trying to solve these problems myself instead of just using another library. And it seems to be going well: class Window {

Re: Return by 'ref' problems...

2012-05-04 Thread Timon Gehr
On 05/04/2012 03:00 PM, Jakob Ovrum wrote: 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 bu

Re: Return by 'ref' problems...

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 10:19:08 -0400, H. S. Teoh wrote: Argh... this is really annoying. So I tried all sorts of combinations of function pointer syntax in order to get the correct type for a ref function that returns const(T), but couldn't. So I decided to let the language tell me itself what

Re: virtual method pointer

2012-05-04 Thread Gor Gyolchanyan
I'm not going to cherry-pick methods in any case. I'll have all methods analyzed at compile time, by iterating over the overloads of each method and have them searched in the vtable to get their indices at launch time. It'll be easy to construct a dynamic virtual method call. On Fri, May 4, 2012 a

Re: Return by 'ref' problems...

2012-05-04 Thread Jakob Ovrum
On Friday, 4 May 2012 at 14:34:20 UTC, Timon Gehr wrote: It is an attribute: int x; ref { int foo(){ return x; } int bar(){ return x; } } ref: int qux(){ return x; } static assert(typeof(&qux).stringof == "int function() ref"); Thanks, this is news to me! I never noticed that ref was ac

Re: Return by 'ref' problems...

2012-05-04 Thread Timon Gehr
On 05/04/2012 04:53 PM, Jakob Ovrum wrote: On Friday, 4 May 2012 at 14:34:20 UTC, Timon Gehr wrote: It is an attribute: int x; ref { int foo(){ return x; } int bar(){ return x; } } ref: int qux(){ return x; } static assert(typeof(&qux).stringof == "int function() ref"); Thanks, thi

Re: Return by 'ref' problems...

2012-05-04 Thread Jakob Ovrum
On Friday, 4 May 2012 at 14:57:14 UTC, Timon Gehr wrote: What would be the meaning of void foo(ref void function() fn) { } ? Parameter storage classes can only go before the type, while function attributes can also go after the parameter list (of the function pointer or delegate for this c

Re: Growing pains

2012-05-04 Thread Paulo Pinto
Am 03.05.2012 22:51, schrieb Ali Çehreli: 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 frequent "Load at xx.xx, try again later" errors when reading this forum through NNTP

Re: Destroying structs without a typeinfo object

2012-05-04 Thread Benjamin Thaut
Am 04.05.2012 15:14, schrieb 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

Re: Destroying structs without a typeinfo object

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 11:20:41 -0400, Benjamin Thaut wrote: Thanks, but thats exactly what I'm currently doing. This still is a indirect function call, and I hoped that there is a way to directly call the destructor. Then no, there isn't a better way. If you look at that bug report, you

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 18:07, Jakob Ovrum wrote: > On Friday, 4 May 2012 at 14:57:14 UTC, Timon Gehr wrote: > >> >> What would be the meaning of >> >> void foo(ref void function() fn) { } >> >> ? >> > > Parameter storage classes can only go before the type, while function > attributes can also go after th

Re: Return by 'ref' problems...

2012-05-04 Thread Jakob Ovrum
On Friday, 4 May 2012 at 15:49:03 UTC, Manu wrote: It's very counter intuitive to mark the _function_ ref, rather than it's return type. It is a function attribute, so it makes perfect sense. The rest is an issue of documentation/education. I agree it may not be optimally intuitive, but I d

Re: Return by 'ref' problems...

2012-05-04 Thread Manu
On 4 May 2012 18:55, Jakob Ovrum wrote: > On Friday, 4 May 2012 at 15:49:03 UTC, Manu wrote: > >> It's very counter intuitive to mark the _function_ ref, rather than it's >> return type. >> > > It is a function attribute, so it makes perfect sense. The rest is an > issue of documentation/educatio

Re: GSOC Linker project

2012-05-04 Thread foobar
On Thursday, 3 May 2012 at 23:47:26 UTC, Trass3r wrote: I'm interested in starting a project to make a linker besides optlink for dmd on windows. Imho changing dmd to use COFF (incl. 64 support) instead of that crappy OMF would be more beneficial than yet another linker. My vision is to cr

Re: Class methods in D?

2012-05-04 Thread Simon
On 04/05/2012 13:27, Steven Schveighoffer wrote: 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 bet

Re: Growing pains

2012-05-04 Thread Ali Çehreli
On 05/04/2012 02:27 AM, Andrei Alexandrescu wrote: > FWIW it seemed to be just a configuration issue. Perhaps not solved yet? I just hit the same problem about fifteen minutes ago. Ali

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Jonathan M Davis
On Friday, May 04, 2012 18:28:51 Denis Shelomovskij wrote: > This idea is too obvious and I suppose I'm the only one not knowing it, > but I have never seen it's implementation. Why? > > The idea: > 1. `Object` class has hidden `isAlive` field which is true since > construction and up to finalizat

Re: Class methods in D?

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 13:08:44 -0400, Simon wrote: On 04/05/2012 13:27, Steven Schveighoffer wrote: 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 RTInf

Re: GSOC Linker project

2012-05-04 Thread simendsjo
On Fri, 04 May 2012 18:57:44 +0200, foobar wrote: On Thursday, 3 May 2012 at 23:47:26 UTC, Trass3r wrote: I'm interested in starting a project to make a linker besides optlink for dmd on windows. Imho changing dmd to use COFF (incl. 64 support) instead of that crappy OMF would be more ben

Re: GSOC Linker project

2012-05-04 Thread Andrej Mitrovic
On 5/4/12, foobar wrote: > How about augmenting the object format so that libraries would be > self contained and would not require additional .di files? Is > this possible optlink by e.g. adding special sections that would > be otherwise ignored? How would you use a library you don't even have t

Re: GSOC Linker project

2012-05-04 Thread Andrej Mitrovic
On 5/4/12, Trass3r wrote: >> I'm interested in starting a project to make a linker besides optlink >> for dmd on windows. > > Imho changing dmd to use COFF (incl. 64 support) instead of that crappy > OMF would be more beneficial than yet another linker. Hear hear. But I wouldn't mind seeing a li

Re: GSOC Linker project

2012-05-04 Thread foobar
On Friday, 4 May 2012 at 17:52:54 UTC, simendsjo wrote: On Fri, 04 May 2012 18:57:44 +0200, foobar wrote: On Thursday, 3 May 2012 at 23:47:26 UTC, Trass3r wrote: I'm interested in starting a project to make a linker besides optlink for dmd on windows. Imho changing dmd to use COFF (incl. 64

Re: GSOC Linker project

2012-05-04 Thread foobar
On Friday, 4 May 2012 at 17:54:47 UTC, Andrej Mitrovic wrote: On 5/4/12, foobar wrote: How about augmenting the object format so that libraries would be self contained and would not require additional .di files? Is this possible optlink by e.g. adding special sections that would be otherwise

Re: GSOC Linker project

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 13:54:38 -0400, Andrej Mitrovic wrote: On 5/4/12, foobar wrote: How about augmenting the object format so that libraries would be self contained and would not require additional .di files? Is this possible optlink by e.g. adding special sections that would be otherwise i

Re: GSOC Linker project

2012-05-04 Thread Andrej Mitrovic
On 5/4/12, foobar wrote: > The di files are mostly meant to be machine read (e.g. the > compiler) and this belongs as part of the library file in order > to provide ease of use and maintain the relationship between the > binary code and it's interface. > > maintaining two sets of files that could

Re: GSOC Linker project

2012-05-04 Thread Andrej Mitrovic
On 5/4/12, Steven Schveighoffer wrote: > Ever heard of Java? Ever heard of not requiring a bring-your-quadcore-to-its-knees IDE?

Re: GSOC Linker project

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 14:31:24 -0400, Andrej Mitrovic wrote: On 5/4/12, Steven Schveighoffer wrote: Ever heard of Java? Ever heard of not requiring a bring-your-quadcore-to-its-knees IDE? This is a totally false comparison :) Java's storage of its interface in its object files has noth

Re: GSOC Linker project

2012-05-04 Thread Andrej Mitrovic
On 5/4/12, Steven Schveighoffer wrote: > What I'm saying is, it's completely possible to store the API in binary > format *in* the object files, and use documentation generators to document Yes but then you need to *modify* existing tools in order to add a new feature that extracts information fr

Re: GSOC Linker project

2012-05-04 Thread foobar
On Friday, 4 May 2012 at 18:30:32 UTC, Andrej Mitrovic wrote: On 5/4/12, foobar wrote: The di files are mostly meant to be machine read (e.g. the compiler) and this belongs as part of the library file in order to provide ease of use and maintain the relationship between the binary code and it

Re: Return by 'ref' problems...

2012-05-04 Thread Artur Skawina
On 05/04/12 15:57, Manu wrote: > Yeah I really hate this too. I'd like to see const(T) strictly enforced, > considering the potential for ambiguity in other situations. > > But I'm still stuck! :( > How can I do what I need to do? If 'auto' is not an option: alias ref const(S) function() FT;

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Simen Kjaeraas
On Fri, 04 May 2012 19:29:11 +0200, Jonathan M Davis wrote: On Friday, May 04, 2012 18:28:51 Denis Shelomovskij wrote: This idea is too obvious and I suppose I'm the only one not knowing it, but I have never seen it's implementation. Why? The idea: 1. `Object` class has hidden `isAlive` fie

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Sean Kelly
On May 4, 2012, at 7:28 AM, Denis Shelomovskij wrote: > This idea is too obvious and I suppose I'm the only one not knowing it, but I > have never seen it's implementation. Why? > > The idea: > 1. `Object` class has hidden `isAlive` field which is true since construction > and up to finalizatio

Re: GSOC Linker project

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 14:48:04 -0400, Andrej Mitrovic wrote: On 5/4/12, Steven Schveighoffer wrote: What I'm saying is, it's completely possible to store the API in binary format *in* the object files, and use documentation generators to document Yes but then you need to *modify* existing

Re: GSOC Linker project

2012-05-04 Thread Andrej Mitrovic
On 5/4/12, Steven Schveighoffer wrote: > Current tools: read .di files and extract API > new tools: read .dobj files and extract API. > > I'm not really seeing the difficulty here... I thought he meant libraries that are only distributed in binary form. So no .di files anywhere. Maybe I misunder

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 14:50:06 -0400, Simen Kjaeraas wrote: I believe the idea was that it'd blow up if you use it unwisely. clear might do that, but if you're unlucky, it'll 'work' just fine, giving you problems later. clear zeros out the vtable, so it's highly unlikely it "just works".

Re: GSOC Linker project

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 15:07:43 -0400, Andrej Mitrovic wrote: On 5/4/12, Steven Schveighoffer wrote: Current tools: read .di files and extract API new tools: read .dobj files and extract API. I'm not really seeing the difficulty here... I thought he meant libraries that are only distribute

Re: GSOC Linker project

2012-05-04 Thread Andrew Wiley
On Fri, May 4, 2012 at 1:46 PM, foobar wrote: > On Friday, 4 May 2012 at 18:30:32 UTC, Andrej Mitrovic wrote: > >> On 5/4/12, foobar wrote: >> >>> The di files are mostly meant to be machine read (e.g. the >>> compiler) and this belongs as part of the library file in order >>> to provide ease of

Re: Return by 'ref' problems...

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 14:27, Manu wrote: You can declare a variable as ref in the parameter list, that's where the ambiguity could arise, same with const. Yes, but I thought this was a variable of some kind and not a parameter. -- /Jacob Carlborg

Re: Return by 'ref' problems...

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 15:57, Manu wrote: But I'm still stuck! :( How can I do what I need to do? Hmm, I think this starts to look like a voldemort type :) . A type which isn't possible to declare. -- /Jacob Carlborg

Re: Return by 'ref' problems...

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 16:19, H. S. Teoh wrote: typeof(&func) fp =&func; And lo and behold, it works!! So it's very stupid, but if you at least have an exemplary function that you'd like to make a function pointer out of, you can use this workaround to name its type. Yeah, I recommend filing a

Re: Return by 'ref' problems...

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 16:19, H. S. Teoh wrote: Argh... this is really annoying. So I tried all sorts of combinations of function pointer syntax in order to get the correct type for a ref function that returns const(T), but couldn't. So I decided to let the language tell me itself what the type is:

Re: Class methods in D?

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 16:31, Mehrdad wrote: Oh okay, I see. Let me try it. :) @Everyone: Haha thanks for pointing me to the existing libraries. :) I'm doing this more for learning than anything else, so I'm trying to solve these problems myself instead of just using another library. And it seems to

Re: GSOC Linker project

2012-05-04 Thread Jacob Carlborg
On 2012-05-04 18:57, foobar wrote: How about augmenting the object format so that libraries would be self contained and would not require additional .di files? Is this possible optlink by e.g. adding special sections that would be otherwise ignored? That would be nice. I guess that would mean

  1   2   >