Re: Template Inheritance

2012-02-18 Thread %u
I think I got it! This seems to work: class Derived { //Pulls in all the template forms in the base class template get(args ...) { alias Base.get!args get; } //Create new versions of get() here. }

Re: Template Inheritance

2012-02-18 Thread %u
Thanks! I guess I'll just have to live with redefining the functions, do some sort of interface/mixin thing, or change the class interface. It makes sense that template functions aren't virtual (how are you supposed to deal with vtables?), but I wish that at least an alias declaration could work.

Re: Template Inheritance

2012-02-18 Thread %u
Correction: redefining in the *subclass*. Silly me.

Re: Template Inheritance

2012-02-18 Thread %u
In the interim, I'm just redefining the template in the base class, but that's a really annoying hack to have to perform every single time I have to make a new form of the template.

Template Inheritance

2012-02-18 Thread %u
I've been working on porting an old D library to D2, and I'm running into a nasty issue with templates and inheritance. I've got a base class like this: class Reader { void get(T)(ref T[] buffer); } and a subclass like this: class SubReader { void get()(SomeClass param); } The problem i

Re: floating-WTF - Compiler-BUG with 64bit

2012-01-24 Thread %u
Shouldn't this go into 'digitalmars.D' ?

Re: extends and implements

2011-11-07 Thread %u
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Mon, 07 Nov 2011 13:22:07 -0500, %u wrote: > In order for such a humongously code-breaking change to occur, there would > have to be dire reasons why this was necessary. Because you liked Java is > not a

extends and implements

2011-11-07 Thread %u
Hello. I know D isn't Java, but one trivial thing I liked about Java is the introduction of 'extends' and 'implements' as keywords as ways to clarify the class relationships when defining a class. You know: class Subclass extends SuperClass implements AnInterface { ... } Will they ever add this

gtkD problems and general gui question.

2011-10-18 Thread %u
Hello. I downloaded gtkD MS Windows installer, and I tried to compile one of the examples shown on the gtkD website: http://www.dsource.org/projects/gtkd The example is below along with the problem: import gtk.MainWindow; import gtk.Label; import gtk.Main; void main(string[] args) { Ma

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > simendsjo: > > Shouldn't the original way work too? > I don't remember. > > Another point: I recommend compiling with debug symbols as it gives you > > a nice stacktrace. > I think debug symbols should be present on default, to produce

Re: problems with DPL example.

2011-10-10 Thread %u
Thanks. It works, but I get something weird in the output. I get the problem if I run it in a dos prompt or in a cygwin prompt: Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. D>echo hello | wordcount2.exe 0 hello std.stdio.StdioExceptio

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from simendsjo (simend...@gmail.com)'s article > Seems some functionality was moved in 2.052. From std.string documentation: > "IMPORTANT NOTE: Beginning with version 2.052, the following symbols > have been generalized beyond strings and moved to different modules." > And > "split

Re: How convice people that D it's wonderfull in a hour ?

2011-10-10 Thread %u
== Quote from Zardoz (luis.panad...@gmail.com)'s article > Recently I've been asked if I could give a speech about D in my university. It > will be of one hour of long. > I not respond yet, but I think that I will do it. Actually I have the problem > that I don't know well how explain well too many

problems with DPL example.

2011-10-10 Thread %u
Hello. I'm having problems compiling the following: // From chapter 1 of D Programming Language. // import std.stdio, std.string; void main() { uint[string] dictionary; foreach( line; stdin.byLine()) { // Break sentence into words // Add each word in the sentence to the vocabulary

Re: how do I use newsgroup server?

2011-09-30 Thread %u
== Quote from Nick Sabalausky (a@a.a)'s article > > I guess I don't know how to setup my outlook client to use the news > > link? When I click the news link. Nothing happens. > I don't have access to a Win7 machine ATM, but on both XP and Vista, you can > do: > Tools -> Accounts. There will be a

Re: how do I use newsgroup server?

2011-09-30 Thread %u
== Quote from Nick Sabalausky (a@a.a)'s article > "%u" wrote in message news:j655f0$fm8$1...@digitalmars.com... > > Hello. > > > > I go to digitalmars to read digitalmars.D.learn newsgroup, but I > > have to click the http link. The http interface is

OT: how do I use newsgroup server?

2011-09-30 Thread %u
Hello. I go to digitalmars to read digitalmars.D.learn newsgroup, but I have to click the http link. The http interface is kind of awkward. I'd like to try the newsgroup link. But, I don't know how to use it. How do I? Is there a client I can download and use for free that you recommend? I d

newbie question

2011-09-19 Thread %u
does D compatibility with C restrict D from evolving ? and if D drop this will that prevent complexity?

Re: quickSort

2011-09-13 Thread %u
i have qustion why filter can't return int[] and if lambda return the last Expression without return keyword it would much cleaner

pattern matching

2011-09-06 Thread %u
template factorial(int n) { const factorial = n * factorial!(n-1); } template factorial(int n : 1) { const factorial = 1; } i think this pattern matching or like it, can i do the same thing with regular function int factorial(int n) { return n* factorial(n-1); return 1 ; } int factorial(int n

Re: gdc setup without gcc

2011-08-31 Thread %u
I have 2 issue: 1- i can't install the package, there is problem I don't know what is it? 2-it is not updated.

gdc setup without gcc

2011-08-31 Thread %u
is there a way to install gdc without gcc because I already have gcc install in archlunix?

changing in two arrays

2011-06-26 Thread %u
hi I create two arrays and I want the change in one of them effects the other one. i try int[] array1 = [1, 2, 3, 4, 5]; int[] array2; array2 = array1; // without .dup assert(array1 == array2); assert(array1 is array2); // here i am confused because 'is' mean thay have the same address or what?

Re: nested comments

2011-05-30 Thread %u
I understand it thanks

Re: nested comments

2011-05-30 Thread %u
commenting out code?? example please

nested comments

2011-05-30 Thread %u
what is the purpose of nested comments ?

object.function()

2011-05-13 Thread %u
I have a question, can I write all functions like this object.function() instead of functin(object) ? or that form for some function or cases.

Re: int or size_t ?

2011-05-07 Thread %u
size_t val1 = int.max+1; int val2 = int.max+1; writeln(val1); // 2147483648 writeln(val2); // -2147483648 very clear example thanks you both

int or size_t ?

2011-05-07 Thread %u
In Patterns of Human Error, the slide 31 point that you should replce int with size_t why that consider an error ?

Re: multiple return

2011-04-20 Thread %u
thanks you all, it works. last thing, I have this Tuple!(int,int,int)(1, 2, 3) how can I use the return values individual? to be more clear if I rturn tuple(a, b, c) can I write in the code void main() { //call the function here writeln(a); }

multiple return

2011-04-19 Thread %u
I have function which have more than one return, and the code compile and run but it gives rong result -I guess-, so i use tuple but the compiler can't return tuple. how can I return values? why I can't return tuple?

pointers and structures

2011-04-17 Thread %u
what is the equivalent for this code in D? #include main() { struct S { int i; }; struct S s, *s_ptr; s_ptr = &s; s_ptr->i = 9; printf("%d\n", s_ptr->i); }

auto arr = new int[10];

2011-04-16 Thread %u
is there any different b/w: auto arr = new int[10]; and int[10] arr; ?

Re: dmd & gdc in archlinux

2011-03-08 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > On Monday, March 07, 2011 12:10:27 %u wrote: > > == Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > > > > > and add /path/to/unzipped/dmd2/linux/bin to your path. > > > > ho

Re: dmd & gdc in archlinux

2011-03-07 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > and add /path/to/unzipped/dmd2/linux/bin to your path. how can i add path ?

Re: Writing an integer to a file

2011-03-07 Thread %u
this is part of the code: void WritePushPop(cmd command, string segment, int index) { string temp = "TextFile.Asm"; AsmFile = new File(temp, FileMode.OutNew ); string x = toString(index); AsmFile.writeString(

Re: dmd & gdc in archlinux

2011-03-06 Thread %u
== Quote from %u (asm...@hotmail.com)'s article > i can't install it and i use this command > yaourt -R gdc i mean yaourt -S gdc

Re: dmd & gdc in archlinux

2011-03-06 Thread %u
in dmd: this the error massage object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = /usr/include/d import path[1] = /usr/include/d/druntime/import in gdc: i can't install it and i use this command yaourt -R gdc

dmd & gdc in archlinux

2011-03-06 Thread %u
i can't install dmd or gdc in arch linux from AUR i don't way?

Re: C++ to D: Help please

2011-02-23 Thread %u
bearophile, You do have a point there, and I actually expected that response. I would have posted my attempt at implementation, but am unable to transfer info between the computer I'm typing this message on and the one I'm programming on at the moment. I have no problems converting small problems

C++ to D: Help please

2011-02-23 Thread %u
I requested some assistance with operator overlaoding yesterday and I really appreciate the assistance provided. However, trying to incorporate the example just confused me a little more, it does not meld well with the code I translated from the tutorial I am reading. I am hoping that one of you ex

Re: "operator" overloading?

2011-02-23 Thread %u
Thaks to everyone for your assistance.

"operator" overloading?

2011-02-23 Thread %u
Hi everyone, Was hoping someone could help me make sense of this bit of C++ code: class canvas { operator HDC() { return _hdc; } protected: canvas(HDC hdc): _hdc(hdc) {} HDC _hdc; } >From what I understand, HDC is an alias for HANDLE in Windows. So they are overloading canvas such th

Re: Context-Free Grammars? What about arrays?

2011-02-16 Thread %u
> ...*Then* it would no longer be context-free because the parser would have to rely on the semantics of 'U' to determine how to parse it. Ahh that makes sense. Thank you for the great explanation! :)

Re: Inheritance problem

2011-02-11 Thread %u
== Auszug aus Andrej Mitrovic (andrej.mitrov...@gmail.com)'s Artikel > On 2/11/11, bearophile wrote: > > Steven Schveighoffer: > > > >> Any code can access any members defined in the current module, regardless > >> > >> of access attributes > > > > I am not sure if Walter understands how much this

Re: Inheritance problem

2011-02-11 Thread %u
== Auszug aus bearophile (bearophileh...@lycos.com)'s Artikel > Steven Schveighoffer: > > Any code can access any members defined in the current module, regardless > > of access attributes > I am not sure if Walter understands how much this rule makes it hard for people not already used to protecte

Re: Inheritance problem

2011-02-11 Thread %u
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Fri, 11 Feb 2011 16:14:31 -0500, %u wrote: > > == Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > > > > Thanks, but what about the following: > > > >

Re: Inheritance problem

2011-02-11 Thread %u
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel > On Fri, 11 Feb 2011 15:40:18 -0500, %u wrote: > > Hello, > > > > I've a problem with my class inheritance. I have class called Texture > > which implements the interface IDrawable and the

Inheritance problem

2011-02-11 Thread %u
Hello, I've a problem with my class inheritance. I have class called Texture which implements the interface IDrawable and the abstract class APickable. The Texture-class contains 3 members which looks like this: GLuint pTextureID; Size pSize1, pSize2; Finally... my Texture-class looks like: cl

Inserting nodes into a tree

2011-02-11 Thread %u
Please pardon my complete lack of knowledge. Please provide some suggestions/pointers so that I can improve myself. Given a table containing three values (ie, myName, myId, parentId), how does one insert those values into a tree such that the parent/child relationship defined in the table is maint

Re: Context-Free Grammars? What about arrays?

2011-02-11 Thread %u
Sorry, please ignore the very last line: Temp!(2) b; //Why does this break? I totally wasn't thinking about the fact that T is a tuple in "int[T] arr;". (I would intuitively think that it should still work, given that a tuple is just a bunch of types, but I can see why it wouldn't.) Howev

Re: Context-Free Grammars? What about arrays?

2011-02-11 Thread %u
> That will always parse to an associative array. Then in the semantic pass, if > U is a constant expression that turns out to be an integer it is reinterpreted as a static array. Ah, interesting. But that describes the implementation (i.e. how the compiler copes with the ambiguity) and n

Context-Free Grammars? What about arrays?

2011-02-11 Thread %u
Hi, I think I'm having a little trouble understanding what's meant by context-free grammar. I've read that D is context-free, but is it really? What about an expression like: int[U] s; ? You can't tell -- without looking at the context -- whether U is a data type or a nu

core languga

2011-02-09 Thread %u
Hi excuse my ignorance what does that term mean? and what the different b/w learning D & pobos

Re: Ranges

2011-02-08 Thread %u
> Related discussion: > http://www.digitalmars.com/d/archives/digitalmars/D/getNext_113217.html Oh sorry; thank you for the link!

Ranges

2011-02-07 Thread %u
I've learned that an InputRange needs three methods to enumerate a collection: void popFront() @property T front() @property bool empty() but is that really necessary? Why not just have: bool next(out T value); ? Wouldn't this be much cleaner? Even the .NET implementation of IEnumerator

Re: Why non-@property functions don't need parentheses

2011-02-07 Thread %u
> It will be fixed at some point, but it hasn't been yet. Oh cool, all right; thanks!

Why non-@property functions don't need parentheses

2011-02-06 Thread %u
Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? Thanks!

volatile deprecated, yet still in Phobos?

2011-01-31 Thread %u
Hi, I've tried to compile programs and Phobos without deprecated features on, and yet I've come across a problem: Volatile statements are deprecated. So, for example, in thread.switchOut(), these statements are invalid: volatile tobj.m_lock = true; fiber_switchContext( oldp, newp ); Wha

"__gshared static" versus "static __gshared"

2011-01-29 Thread %u
Is this a bug? __gshared static i; makes i be thread-local, while static __gshared i; makes it be shared.

Re: D1: out of memory

2011-01-24 Thread %u
== Quote from Robert Clipsham (rob...@octarineparrot.com)'s article > CTFE and templates will use up the most memory - particularly if you use > a lot of strings, as the memory allocated is never freed. You can work > around it be compiling files one at a time or a few at a time, so > instead of: >

Re: D1: out of memory

2011-01-24 Thread %u
Er, bit exaggerated.. 450 to below 300 pls :)

D1: out of memory

2011-01-24 Thread %u
How do I get dmd's memory usage a few hundred MBs down? I keep having to close everything in order not to get an out of memory error while compiling (-w -full). I'd like to get it from 700-800 to below 400 :) Any way to inspect which part is the biggest drain?

Re: Naming Conventions & Style Guide?

2011-01-23 Thread %u
> I don't know what that abbreviation means. Haha I kind of made that up... just meant "My Mileage *Will* Vary" :) Huh, I never noticed the keyword conflict; that's totally legitimate, although personally I'd prefer PascalCased. But I don't like the "related to the language" idea; it shouldn't b

Re: Naming Conventions & Style Guide?

2011-01-22 Thread %u
> Hmm.. I thought naming enums with capital letters was a standard thing in D land. I prefer them that way since they're constants, and since I almost always use a tag for an enum I never mistake it for anything else. YMMV. Huh, I guess now I see why they are the way they are. :) At first I wrappe

Naming Conventions & Style Guide?

2011-01-22 Thread %u
Is there any particular reason that Phobos uses ALL_CAPS (such as FunctionAttributes.NOTHROW) and PascalCase (such as Endian.BigEndian) for enums, and yet the D Style Guide recommends lowerCamelCase?

Re: Exactly Replicating a Function's Signature?

2011-01-19 Thread %u
> ref(const(immutable(string)[])) ? > That's crazy! Did you mean ref(const(immutable(char)[]))?? :] Haha... well it was just an idea on how to add the functionality, and like I mentioned, even if it was fine for 'ref' and 'lazy', it wouldn't make any sense for 'out' anyway, so I'd say screw my ide

Re: Exactly Replicating a Function's Signature?

2011-01-19 Thread %u
> The ugly solution would be to do this: > void test (ref int a) { } > void main () { writeln(typeof(&test).stringof); } > Which will print: "void function(ref int a)" and then parse out what you need. If you're referring to using mixin() to parse the signature, I've already thought of that, but

Re: Exactly Replicating a Function's Signature?

2011-01-19 Thread %u
> Is this what you're looking for?: No. :) (Though you already found this out at the end!) I was looking for some way to keep the storage classes and any other (meta)data about the parameters that may be added in the future to the library. I have a feeling this might be a very big change in how DM

Re: Exactly Replicating a Function's Signature?

2011-01-19 Thread %u
> In theory this has to be enough: typeof(F) F2; But in practice, I want to change the body of my function, or possibly add new parameters in the beginning or the end. Does this let me do either of these? Thank you!

Exactly Replicating a Function's Signature?

2011-01-18 Thread %u
If I have an alias F that represents a function, is there any way for me to create a function func() whose signature is exactly the same as that of F? This includes parameter types, return types, and any/all storage modifiers (e.g. const, lazy, scope, etc.). Without this capability, it's impossib

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-18 Thread %u
> That would be bug 3516, wouldn't it? Huh... yes, it indeed would. Thanks for the link, I couldn't think of the right keywords to search for. :)

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-17 Thread %u
> I find it very hard to believe that struct dtors are never called. Sorry, that part was my bad -- last time I checked, they didn't get called, but maybe my example was too complicated, since they did get called for a *simple* example. However, here's a situation in which no postblit or destruct

Re: __traits(getMember, ...) on instance member

2011-01-15 Thread %u
Sorry, I just noticed a typo. The line saying pragma(msg, __traits(getMember, S, m)); should've said: pragma(msg, __traits(getMember, S, "m"));

__traits(getMember, ...) on instance member

2011-01-15 Thread %u
Hi, Something has been confusing me, regarding passing around aliases of instance members. If I can say: struct S { int m; } pragma(msg, (S).m); How come I can't say: struct S { int m; } pragma(msg, __traits(getMember, S, m)); ? What's the difference, and what does each one mean? (I'

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-15 Thread %u
> Tracking memory in a modern OS is not easy, and this is probably why no one wanted to make a statement on what was really happening. The issue is that the memory *is* leaking -- it's because the struct destructor is simply not getting called. If I call free() manually, the memory usage decrease

(coff)-Implib lib from dll

2011-01-15 Thread %u
Hey guys, I'm trying to connect to my mysql-server on windows. I'm using the mysql binding from http://www.steinmole.de/d/ because as I know the DDBI project doesn't support D2. I followed the instructions on the site and first created the lib file with implib with the following command: "implib

Re: toDelegate() for D1

2011-01-13 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > I only need something to make a void deleg() from a void func(). > This works for me: > ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( F > fn ) { > return ( Par

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-13 Thread %u
== Quote from Don (nos...@nospam.com)'s article > > Yay for first time compiling dmd :) > Sorry you had to do that! Had to learn that once anyway :) Maybe I'll even be able to take a stab at fixing bugs someday..

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-13 Thread %u
== Quote from Don (nos...@nospam.com)'s article > It's in a switch statement somewhere. > It sounds as though this is a bug which involves multiple files, so > it'll be difficult to reduce it. > If you're able to compile DMD, change this line in statement.c line 2620: > Statement *SwitchStatement::

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-12 Thread %u
Sorry to bump this up, but is RefCounted(T) really leaking, or am I missing something? I would like to use this in my program, and I'm curious as to why no one responded, since if it's actually leaking, it would be an important issue. Thanks!

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-12 Thread %u
== Quote from Don (nos...@nospam.com)'s article > %u wrote: > > Should I post it as a bug, even though I have no code to accompany it? > > I have no clue as to where to start my directed search for a minimal case. > Can you post the entire source code? > It's import

Re: toDelegate() for D1

2011-01-12 Thread %u
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > %u wrote: > > I only need something to make a void deleg() from a void func(). > This works for me: > ReturnType!( F ) delegate( ParameterTypeTuple!( F ) ) toDelegate( F )( F > fn ) { > return ( Par

Re: Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-12 Thread %u
Should I post it as a bug, even though I have no code to accompany it? I have no clue as to where to start my directed search for a minimal case.

Re: interface function overloading

2011-01-12 Thread %u
== Quote from Stanislav Blinov (bli...@loniir.ru)'s article > In C++ I sometimes have similar problems, especially with multiple > inheritance. Though, as Jonathan mentioned, those problems are even more > annoying because of hijacking: you don't always immediately notice them. > Long ago I've deci

Re: toDelegate() for D1

2011-01-12 Thread %u
I only need something to make a void deleg() from a void func().

Assertion failure: '!cases' on line 2620 in file 'statement.c'

2011-01-12 Thread %u
Assertion failure: '!cases' on line 2620 in file 'statement.c' This is what I got from trying to build my project(30+ modules) without bud.

toDelegate() for D1

2011-01-12 Thread %u
is it available?

Generic method that takes in either delegate or function

2011-01-12 Thread %u
Hi, Is there any way to specify a parameter as "something that can be called with parameter types A, B, C and that returns a value of type D", without caring whether it's a delegate, a function, or an object that overloads opCall? (This might require the use of templates, but I still can't figure

Re: interface function overloading

2011-01-09 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article > %u: > > func(cast(I2)(new C())); > That code smells a bit (http://en.wikipedia.org/wiki/Code_smell ). > Bye, > bearophile Extract the construction and you get: module main; interface I1{} interface

Re: interface function overloading

2011-01-08 Thread %u
== Quote from Jonathan M Davis (jmdavisp...@gmx.com)'s article > On Saturday 08 January 2011 22:01:11 %u wrote: > > Isn't it possible to have a hierarchy in interface definitions such that it > > is possible to overload according to best interface match? > > &g

interface function overloading

2011-01-08 Thread %u
Isn't it possible to have a hierarchy in interface definitions such that it is possible to overload according to best interface match? This now won't compile due to multiple matches. module main; interface I1{} interface I2 : I1{} class C : I2{ this(){} } void func(I1 i){} void func(I2

Re: std.container.Array/RefCounted(T) leaking memory?

2011-01-08 Thread %u
> What method are you using to test the memory? > I'm puzzled that you've put a comment there rather than the code you're > actually using. I'm not using code, I'm checking the working set of my process in Task Manager, and through every iteration, it adds 128 MB. > If you run this code twice,

std.container.Array/RefCounted(T) leaking memory?

2011-01-07 Thread %u
Hi, This code seems to leak memory, as the memory isn't reclaimed: //Test memory here: low { auto b = Array!(bool)(); b.length = 1024 * 1024 * 128 * 8; //Test memory here: high } //Test memory here: high Am I missing something about how Array(T) (and RefCounted) works, or

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> First, you should understand that the GC does not know what data is in a > memory block. That is exactly why I was wondering how it figures things out. :) > Data *allocated* as a void[] (which I highly recommend *not* doing) will be conservatively marked as containing pointers. Ah, all right

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> None what so ever. Huh.. then what about what is said in this link? http://d.puremagic.com/issues/show_bug.cgi?id=5326#c1 I was told that void[] could contain references, but that ubyte[] would not, and that the GC would need to scan the former but not the latter. Is that wrong? Thank you!

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> Kinda sorta. I haven't had any problems from that. If you allocate very large blocks in the garbage collector you may face trouble :-) Haha okay, thanks. :) (This makes me shiver quite a bit...) > You have to add it to the garbage collector's list of roots But if I need to do that, then what

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> It assumes everything on the stack is pointers, at the moment, I believe Uh-oh... not the answer I wanted to hear, but I was half-expecting this. So doesn't that mean that, at the moment, D will leak memory? > If it's not on the garbage collected heap, it won't scan it unless you tell it to. B

Re: How the GC distinguishes code from data

2011-01-05 Thread %u
> If you have allocated a large uint[], most likely =C3=ACt will be flagged NO_SCAN, meaning it has no pointers in it, and the GC will ignore it. Ah, but the trouble is, no one said that this array has to be in the GC heap! I could easily have a void[] and a uint[] that both point to non-GC manag

How the GC distinguishes code from data

2011-01-05 Thread %u
Hi, There's a question that's been lurking in the back of my mind ever since I learned about D: How does the GC distinguish code from data when determining the objects to collect? (E.g. void[] from uint[], size_t from void*, etc.?) If I have a large uint[], it's practically guaranteed to have da

  1   2   >