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
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.
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.
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
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
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)?
>>>>
>
subj
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
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 ~
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
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
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
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
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
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
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'
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
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
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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?
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
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
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
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)
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();
}
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
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
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
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
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
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];
}
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
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
code:
import std.stdio;
class MyClass
{
invariant uint a = 0;
}
void main()
{
static MyClass c = new MyClass;
writeln( c.a );
}
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;
>>
&
62 matches
Mail list logo