Re: switch off GC?

2009-02-04 Thread Weed
bearophile пишет: > Weed, some built-ins and significant part of the standard lib (and other libs > you can find around) assume the presence of a GC. Right. For example, return from function of a dynamic array will not work correctly without GC - there will be a memory leak. > S

switch off GC?

2009-02-03 Thread Weed
It is possible to disable GC? That it has not been included in result binary for an increasing performance of ref operations and reduction of the size of the binary I have not found the answer in google.

swtch off GC?

2009-02-03 Thread Weed
It is possible to disable GC? That it has not been included in result binary for an increasing performance of pointers operation and reduction of the sizes of the binary I have not found the answer in google.

Re: trouble with dmd + obj2asm under linux

2008-12-29 Thread Weed
Daniel Keep пишет: > > > Weed wrote: >> [snip] > > If I had to guess, I'd say it's because you compiled without symbols. > Try this: > > $ dmd -g demo.d Has varied nothing. Names of functions and were earlier in a binary file, they are en

trouble with dmd + obj2asm under linux

2008-12-28 Thread Weed
I wrote and compile program: $ dmd demo.d And I need disassembly it: $ obj2asm ./demo ./demo.d -cdemo.cod And I see asm file "demo.cod" without names of functions: == .init segment assume CS:.init pushEBP mov EBP,ESP

Re: compile time method check

2008-12-27 Thread Weed
Bill Baxter пишет: > 2008/12/27 Weed : >> Simen Kjaeraas пишет: >>> On Fri, 26 Dec 2008 20:15:30 +0100, Weed wrote: >>> >>>> Can I at compile time check whether there is a facility method >>>> (toString(), for example)? >>>> >

How I can determine this is class or struct at compile time?

2008-12-26 Thread Weed
subj

Re: compile time method check

2008-12-26 Thread Weed
Simen Kjaeraas пишет: > On Fri, 26 Dec 2008 20:15:30 +0100, Weed wrote: > >> Can I at compile time check whether there is a facility method >> (toString(), for example)? >> >> Today I wrote: >> >> static if ( __traits(isArithmeti

compile time method check

2008-12-26 Thread Weed
Can I at compile time check whether there is a facility method (toString(), for example)? Today I wrote: static if ( __traits(isArithmetic, Element) ) { ret ~= toString(this[i,j]) ~ "\t"; } else { ret ~= this[i,j].toString ~

Re: struct inheritance need?

2008-12-25 Thread Weed
Kagamin пишет: > Weed Wrote: > >> If you do not want to initialize repeatedly matrix inside the sub, which >> often cause each other, must be static matrices or declared as global >> (in relation to these procedures). You agree with that? > > What's pr

Re: struct inheritance need?

2008-12-25 Thread Weed
Kagamin пишет: Weed Wrote: If you do not want to initialize repeatedly matrix inside the sub, which often cause each other, must be static matrices or declared as global (in relation to these procedures). You agree with that? What's problem? If you want static or global variables, you

Re: struct inheritance need?

2008-12-24 Thread Weed
Kagamin пишет: Weed Wrote: too cannot be initialized in a compile time. Sure it can't. Does it cause that big problems? Sometimes it is the only way to avoid a large number of global ad In D module variables can be protected by access modifiers and become module-local. Module fu

Re: struct inheritance need?

2008-12-24 Thread Weed
Weed пишет: Kagamin пишет: Weed Wrote: I'd prefer run-time checks, though templates can be used for sure. This problem would help solve the availability of inheritance for structs or compile-time creation of class instances. And I see no problem. Absence of compile-time object cre

Re: struct inheritance need?

2008-12-24 Thread Weed
Kagamin пишет: Weed Wrote: It is not necessary to suggest to wrap up "pixel" in a class - then it too cannot be initialized in a compile time. Sure it can't. Does it cause that big problems? Sometimes it is the only way to avoid a large number of global ad In D module v

Re: struct inheritance need?

2008-12-23 Thread Weed
Kagamin пишет: Weed Wrote: The problem is not in use templates. Templates are implementing some of the functionality of 2 types of structures matrices (normal and dynamic). But the structures do not inherit, then to add functionality matrix to other entities ( "pixel", "im

Re: struct inheritance need?

2008-12-23 Thread Weed
Kagamin пишет: Weed Wrote: I'd prefer run-time checks, though templates can be used for sure. This problem would help solve the availability of inheritance for structs or compile-time creation of class instances. And I see no problem. Absence of compile-time object creation doesn'

Re: struct inheritance need?

2008-12-22 Thread Weed
Kagamin пишет: Weed Wrote: that is, suppose that after some action should get a matrix matrix3x1 Well... if you want to template every piece of your code, this can cause disaster, so I think, this is not very good design. For example, multiplication method will be duplicated N*N*N times for

Re: struct inheritance need?

2008-12-21 Thread Weed
Weed пишет: Kagamin пишет: Weed Wrote: Sure he wants. From my point of view, this technique is supposed to be a means to solve some problem rather than problem itself. But this problem was not put. please read it thread: http://www.digitalmars.com/webnews/newsgroups.php?art_group

Re: struct inheritance need?

2008-12-21 Thread Weed
Kagamin пишет: Weed Wrote: Sure he wants. From my point of view, this technique is supposed to be a means to solve some problem rather than problem itself. But this problem was not put. please read it thread: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D

Re: struct inheritance need?

2008-12-21 Thread Weed
Kagamin пишет: Derek Parnell Wrote: I think he wants to have some objects constructed at compile-time. Sure he wants. From my point of view, this technique is supposed to be a means to solve some problem rather than problem itself. But this problem was not put. please read it thread: http:

Re: struct inheritance need?

2008-12-21 Thread Weed
Kagamin пишет: Derek Parnell Wrote: I think he wants to have some objects constructed at compile-time. Sure he wants. From my point of view, this technique is supposed to be a means to solve some problem rather than problem itself. But this problem was not put. Please read even this editi

Re: struct inheritance need?

2008-12-18 Thread Weed
Weed wants the ability to have the compiler build class objects at compile-time such that when a program first starts running, the objects are already fully formed in RAM just waiting to be used. It is exactly

Re: struct inheritance need?

2008-12-18 Thread Weed
Kagamin пишет: Weed Wrote: Kagamin пишет: Weed Wrote: Global variables are static members of module, wich is similar to class and also has static constructor. So what? So your problem is solved. If everything was so simple! :) Once again: the static constructor of class NOT constructs

Re: struct inheritance need?

2008-12-18 Thread Weed
Weed пишет: Kagamin пишет: Weed Wrote: Global variables are static members of module, wich is similar to class and also has static constructor. So what? So your problem is solved. If everything was so simple! :) Once again: the static constructor of class NOT constructs an object. He

Re: struct inheritance need?

2008-12-18 Thread Weed
Kagamin пишет: Weed Wrote: Global variables are static members of module, wich is similar to class and also has static constructor. So what? So your problem is solved. If everything was so simple! :) Once again: the static constructor of class NOT constructs an object. He just fills the

Re: struct inheritance need?

2008-12-18 Thread Weed
Kagamin пишет: Weed Wrote: There does not need a static initialization of static members of the class. There must be able to create objects of classes at compile time. Well, these objects should be placed in some static variables, right? Yes Static variables are initialized with static

Re: struct inheritance need?

2008-12-17 Thread Weed
Janderson пишет: Weed wrote: Janderson пишет: Weed wrote: I should explain why it's important for me: For example, I am making a matrix object(s) It should be: - any size - with ability of making matrix instance of a given size in compile time. - ability of creating matrix instan

Re: struct inheritance need?

2008-12-17 Thread Weed
Weed пишет: Christopher Wright пишет: Weed wrote: If I create struct MatrixStruct for compile-time matrix and class MatrixClass for all other I will not be able to create a function of interaction between these objects through the templates because some of them will be announced before the

Re: struct inheritance need?

2008-12-17 Thread Weed
Christopher Wright пишет: Weed wrote: If I create struct MatrixStruct for compile-time matrix and class MatrixClass for all other I will not be able to create a function of interaction between these objects through the templates because some of them will be announced before the other and it

Re: struct inheritance need?

2008-12-17 Thread Weed
Christopher Wright пишет: Weed wrote: If I create struct MatrixStruct for compile-time matrix and class MatrixClass for all other I will not be able to create a function of interaction between these objects through the templates because some of them will be announced before the other and it

Re: struct inheritance need?

2008-12-17 Thread Weed
Janderson пишет: Weed wrote: I should explain why it's important for me: For example, I am making a matrix object(s) It should be: - any size - with ability of making matrix instance of a given size in compile time. - ability of creating matrix instance in runtime. I have decided to ma

Re: struct inheritance need?

2008-12-17 Thread Weed
Weed пишет: Kagamin пишет: Weed Wrote: I agree. In my case I chose to structure rather than a class because it can be initialized at compile time. But now I thing must be allowed to deploy class in the default data segment. And add the possibility of creating a object of class at compile

Re: struct inheritance need?

2008-12-17 Thread Weed
Kagamin пишет: Weed Wrote: I agree. In my case I chose to structure rather than a class because it can be initialized at compile time. But now I thing must be allowed to deploy class in the default data segment. And add the possibility of creating a object of class at compile time. If

Re: struct inheritance need?

2008-12-16 Thread Weed
Yigal Chripun пишет: If I understand you correctly - I think you confuse here two separate and orthogonal issues. 1) struct vs. class 2) memory allocation What D tries to do is to provide types with value semantics via structs and types with reference semantics _and_polymorphism_ via classe

Re: struct inheritance need?

2008-12-16 Thread Weed
bearophile пишет: > Weed: >> Planned in the future to implement inheritance of structs or the static creation of classes? > > Inheritance of structs: I think it's not planned. Structs in D are meant to be used for different things than classes. > Yet, as time passes s

Re: distinguish between classes and structures

2008-12-16 Thread Weed
Kagamin пишет: Weed Wrote: it is impossible to create the struct of the object which will be arbitrary size (raised by a user) + to be able to set compile-time + should work with the structures of its type. this is mathematical matrix, for example Matix? Easy. class Matrix //can inherit

Re: struct inheritance need?

2008-12-16 Thread Weed
Weed пишет: I should explain why it's important for me: For example, I am making a matrix object(s) It should be: - any size - with ability of making matrix instance of a given size in compile time. - ability of creating matrix instance in runtime. I have decided to make it struct beca

Re: struct inheritance need?

2008-12-16 Thread Weed
Bill Baxter пишет: 2008/12/16 Weed : I should explain why it's important for me: For example, I am making a matrix object(s) It should be: - any size - with ability of making matrix instance of a given size in compile time. - ability of creating matrix instance in runtime. I have decid

Re: struct inheritance need?

2008-12-16 Thread Weed
Bill Baxter пишет: 2008/12/16 Weed : I should explain why it's important for me: For example, I am making a matrix object(s) It should be: - any size - with ability of making matrix instance of a given size in compile time. - ability of creating matrix instance in runtime. I have decid

struct inheritance need?

2008-12-16 Thread Weed
I should explain why it's important for me: For example, I am making a matrix object(s) It should be: - any size - with ability of making matrix instance of a given size in compile time. - ability of creating matrix instance in runtime. I have decided to make it struct because I need to create

Re: distinguish between classes and structures

2008-12-16 Thread Weed
Bill Baxter пишет: 2008/12/16 Weed : Frits van Bommel пишет: Weed wrote: In C++, we had the problem - "slicing" objects. In D this problem is solved inability to inherit from structs. Without inheritance of structs many things are not possible, compared with C++. Why, instead of th

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Bill Baxter пишет: 2008/12/16 Weed : Frits van Bommel пишет: Weed wrote: In C++, we had the problem - "slicing" objects. In D this problem is solved inability to inherit from structs. Without inheritance of structs many things are not possible, compared with C++. Why, instead of th

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Bill Baxter пишет: 2008/12/16 Weed : Frits van Bommel пишет: Weed wrote: In C++, we had the problem - "slicing" objects. In D this problem is solved inability to inherit from structs. Without inheritance of structs many things are not possible, compared with C++. Why, instead of th

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Frits van Bommel пишет: Weed wrote: In C++, we had the problem - "slicing" objects. In D this problem is solved inability to inherit from structs. Without inheritance of structs many things are not possible, compared with C++. Why, instead of the complete inability to inherit, just d

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Kagamin пишет: Weed Wrote: Without inheritance of structs many things are not possible, compared with C++. for example? it is impossible to create the struct of the object which will be arbitrary size (raised by a user) + to be able to set compile-time + should work with the

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Frits van Bommel пишет: Weed wrote: In C++, we had the problem - "slicing" objects. In D this problem is solved inability to inherit from structs. Without inheritance of structs many things are not possible, compared with C++. Why, instead of the complete inability to inherit, just d

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Weed пишет: Why, instead of the complete inability to inherit, just do not make impossible to up casting struct type by value. It's a question: Why, instead of the complete inability to inherit, just do not make impossible to up casting struct type by value?

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Bill Baxter пишет: 2008/12/15 Weed : Bill Baxter пишет: On Mon, Dec 15, 2008 at 3:35 PM, Weed wrote: Who can provide a link to an explanation about why in D has taken to distinguish between classes and structures? (Sorry for my bad English) The main justification is eliminating the

Re: distinguish between classes and structures

2008-12-15 Thread Weed
Weed пишет: Bill Baxter пишет: On Mon, Dec 15, 2008 at 3:35 PM, Weed wrote: Who can provide a link to an explanation about why in D has taken to distinguish between classes and structures? (Sorry for my bad English) The main justification is eliminating the slicing problem. http

Re: distinguish between classes and structures

2008-12-14 Thread Weed
Bill Baxter пишет: On Mon, Dec 15, 2008 at 3:35 PM, Weed wrote: Who can provide a link to an explanation about why in D has taken to distinguish between classes and structures? (Sorry for my bad English) The main justification is eliminating the slicing problem. http

distinguish between classes and structures

2008-12-14 Thread Weed
Who can provide a link to an explanation about why in D has taken to distinguish between classes and structures? (Sorry for my bad English)

Why I can't use array in compile-time struct creation?

2008-12-13 Thread Weed
It is forbidden by specification, but an interesting reason. for example: struct S { static S opCall() { S res; int a,b,c,d; int[10] data; // If I comment out this line compilation goes smoothly return res; } } void main() { static S s = S(); }

Re: Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Weed
Bill Baxter пишет: Ref return values are a very new feature in D2. I suspect its just a bug that they don't work on inner functions yet. --bb message implies that the authors are aware of this limitation? report they do not need? No, a report is probably needed. There are lots of bugs with

Re: Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Weed
Bill Baxter пишет: On Sat, Dec 13, 2008 at 5:45 AM, Weed wrote: void main() { int i; ref int func() { return i; } func() = 4; } lval.d(5): found 'ref' instead of statement lval.d(10): no identifier for declarator func lval.d(11): unrecognized declaration but

Why is my code does not compile? (dmd 2.021 linux)

2008-12-12 Thread Weed
void main() { int i; ref int func() { return i; } func() = 4; } lval.d(5): found 'ref' instead of statement lval.d(10): no identifier for declarator func lval.d(11): unrecognized declaration but code like this compiles: ref int func() { int* i = new int; return

Re: Why is my structure template does not compile?

2008-12-11 Thread Weed
BCS пишет: Reply to Denis, On Fri, 12 Dec 2008 02:21:11 +0300, BCS wrote: Reply to Weed, invariant() { // If I comment out next line compilation goes smoothly: assert( Element.sizeof > 0 ); } OTOH that assert is wrong. Element.sizeof will always return 8, the size of an array refere

Re: Why is my structure template does not compile?

2008-12-11 Thread Weed
ref Element opIndexAssign( in Element a, in uint n ) { data[n] += a; return data[n]; } I'm guessing as I don't use 2.0 but I think that this is a bug. DMD is trying to say that the above returns are trying to return something that can't be referenced (like a math expression result). It is

Why is my structure template does not compile?

2008-12-11 Thread Weed
struct S( Element ) { Element[] data; this( in uint len ) { data.length = len; } ref Element opIndex( in uint n ) { return data[n]; } ref Element opIndexAssign( in Element a, in uint n ) { data[n] += a; return data[n]; }

Re: static initialization question

2008-12-10 Thread Weed
Jarrett Billingsley пишет: On Wed, Dec 10, 2008 at 5:31 PM, Weed <[EMAIL PROTECTED]> wrote: code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyClass c = new MyClass; writeln( c.a ); } It's not the class member that wants static ini

Re: static initialization question

2008-12-10 Thread Weed
Denis Koroskin пишет: On Thu, 11 Dec 2008 01:31:32 +0300, Weed <[EMAIL PROTECTED]> wrote: But my class does not contain data that need initialization and can be created in compile time code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyC

Re: static initialization question

2008-12-10 Thread Weed
code: import std.stdio; class MyClass { invariant uint a = 0; } void main() { static MyClass c = new MyClass; writeln( c.a ); }

static initialization question

2008-12-10 Thread Weed
moved from digitalmars.D > Re: static initialization questionDigital Mars > Benjamin Shropshire ([EMAIL PROTECTED]) 2008/12/10 16:46 > Reply to Weed, > >> why I can not initialize static variable this way: >> >> static MyClass c = new MyClass; >> &