Re: stretto...@tutanota.com

2016-06-09 Thread Stretto via Digitalmars-d-learn
Ultimately what I want to do is access a member foo.Dongs[i]; Where Dongs is essentially a "view" in to the Bars array and only accesses types of type Dong. It seems one can't do both an override on a name("Dongs") and an index on the overridden name(`[i]`)? It is not appropriate to use fo

stretto...@tutanota.com

2016-06-09 Thread Stretto via Digitalmars-d-learn
I have some class like class bar { } class foo : bar { bar[] stuff; } and have another class class dong : bar { int x; } Now sometimes stuff will contain dong's, but I cannot access its members it without a cast. fooo.stuff[0].x // invalid because bar doesn't contain x; Hence, ((c

Re: interface and class inheritance

2013-11-17 Thread Stretto
On Thursday, 14 November 2013 at 21:20:57 UTC, Oleg B wrote: [code] import std.stdio; interface A { void funcA(); } class B { final void funcA() { writeln( "B.funcA()" ); } } class C: B, A { } void main() { auto c = new C; c.funcA(); } [code/] $ dmd -run interface.d interface.d(6): Er

Re: Intelligent Scope Hierarchy

2013-11-01 Thread Stretto
On Friday, 1 November 2013 at 08:59:36 UTC, Namespace wrote: On Friday, 1 November 2013 at 05:49:04 UTC, Stretto wrote: On Thursday, 31 October 2013 at 22:03:18 UTC, Namespace wrote: The 'it' property is only some 'singleton' approach. You can write: void f

Re: Intelligent Scope Hierarchy

2013-10-31 Thread Stretto
On Thursday, 31 October 2013 at 22:03:18 UTC, Namespace wrote: The 'it' property is only some 'singleton' approach. You can write: void foo() { auto buffer = Mallocator.allocate(42); /// ... many code } And at the end of the scope buffer is cleared because Mallocator's destructor call

Intelligent Scope Hierarchy

2013-10-31 Thread Stretto
Hi, I'm new to D and stumbled on the new allocators thread. In the help there is code like auto buffer = Mallocator.it.allocate(1024 * 1024 * 4); scope(exit) Mallocator.it.deallocate(buffer); which seems redundant and error prone. Would it not be possible for allocate to automatically