Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
I get the error message
d.d(5): Error: cannot implicitly convert expression (this) of type const(S) to S
If I remove const from
On 2010-09-18 00:37, Mariusz GliwiĆski wrote:
I just could promise I've seen in D2 something like in scripting languages:
module test;
void main (string[] args) {
test(b = test);
}
void test(string a = a, string b = b, string c = c) {
}
Basically picking just right parameter while other have
Greetings!
I want to have a try on dflplot.But I don't find module dstats.all which is
used by dflplot.d,could anybody let me where it is?
Thank you.
Hi,
to improve my understanding of the GC and when/how
allocators/deallocators and constructors/destructors get called, I wrote
a little test program. And now I understand even less than before...
Here is the program:
import core.memory;
import std.stdio;
Am Samstag, den 18.09.2010, 02:15 -0700 schrieb Jonathan M Davis:
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
Actually, wouldn't it be much more simple to just copy
Ivo Kasiuk Wrote:
Hi,
to improve my understanding of the GC and when/how
allocators/deallocators and constructors/destructors get called, I wrote
a little test program. And now I understand even less than before...
...
Running this with DMD 2.049, I observed the following:
- S1(int),
Thanks. I figured that it was a duplicate definition, but not if I leave out
st.stream, then OpenException is undefined. Is there a documentation for the
exceptions which are in the relevant packages - I'll struggle without it!
And thanks, all for the help - much appreciated.
BTW, am I making
Am Samstag, den 18.09.2010, 10:08 -0400 schrieb Sean Kelly:
Ivo Kasiuk Wrote:
Hi,
to improve my understanding of the GC and when/how
allocators/deallocators and constructors/destructors get called, I wrote
a little test program. And now I understand even less than before...
...
On Sat, 18 Sep 2010 05:15:38 -0400, Jonathan M Davis jmdavisp...@gmx.com
wrote:
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
int[] _val;
}
void main()
{
}
I get the error message
d.d(5): Error: cannot
An interesting case is when using C's malloc for C1 and using the scope
attribute for c1:
class C1 {
ubyte[1_000_000] buf;
new(size_t size) {
void* ptr = std.c.stdlib.malloc(size);
if (ptr is null)
throw new OutOfMemoryError(__FILE__, __LINE__);
writefln(C1.new(%d)
Hi,
I've just arrived to D 2.0 and after reading Andrei's book I'm loving
everything I'm seeing (except the bugs, of course).
I wanted to ask how these would be done, because I can't find how to do it:
1. Having the strings, defined at compile time, MyClass and mymethod,
how could I could I get
Ivo Kasiuk i.kas...@gmx.de wrote:
Ok, that makes sense. So the deallocators really should not get called
in this case. But why are the destructors not invoked when the GC
finalizes the objects?
For S1 and S2, this is a known bug - destructors of structs on the heap
don't get called.
As for
On Sat, Sep 18, 2010 at 19:59, Juanjo Alvarez juan...@gmail.com wrote:
I wanted to ask how these would be done, because I can't find how to do it:
1. Having the strings, defined at compile time, MyClass and mymethod,
how could I could I get to a delegate to MyClass.mymethod?
You can insert
It seems doable to have some kind of function transformer (adaptor?) for
this.
from:
int foo(int a = 0, int b = 1, double c = 0.0, bool d = false) { return 1;}
alias namedParams!foo nfoo;
nfoo(d, true); // a = 0, b = 1, c = 0.0, d = true
nfoo(d, true, b, 100); // a=0, b=100, c=0.0, d=true
Philippe Sigaud philippe.sig...@gmail.com wrote:
It seems doable to have some kind of function transformer (adaptor?) for
this.
from:
int foo(int a = 0, int b = 1, double c = 0.0, bool d = false) { return
1;}
alias namedParams!foo nfoo;
nfoo(d, true); // a = 0, b = 1, c = 0.0, d = true
My main problem with these solutions is that they're largely runtime
solutions. Not that calling a function with named parameters is very likely
to happen in an inner loop, now I think of it...
I imagined the foo(b, 100, d, true) version to be largely CT: variadic
list, testing and
Exploring the example a bit further:
If C's malloc is used instead of GC.malloc then the deallocators also
are not called and the program runs out of memory. How are the objects
supposed to get finalized in this case - do I have to use the delete
keyword explicitly?
If you use C's
On Saturday 18 September 2010 06:45:51 Ivo Kasiuk wrote:
Am Samstag, den 18.09.2010, 02:15 -0700 schrieb Jonathan M Davis:
Okay, if I try and compile the following program.
struct S
{
@property S save() const
{
return this;
}
Ivo Kasiuk i.kas...@gmx.de wrote:
Exploring the example a bit further:
If C's malloc is used instead of GC.malloc then the deallocators also
are not called and the program runs out of memory. How are the objects
supposed to get finalized in this case - do I have to use the delete
keyword
On Saturday 18 September 2010 08:50:41 Graham Nicholls wrote:
Thanks. I figured that it was a duplicate definition, but not if I leave
out st.stream, then OpenException is undefined. Is there a documentation
for the exceptions which are in the relevant packages - I'll struggle
without it!
If a pure function takes a reference/pointer, does that state that the result
of
the function will be the same on two calls to it if the reference/pointer
points
to the same data in both cases or if the data itself is unchanged?
If it's a matter of pointing to the same data, then that could
Jonathan M Davis jmdavisp...@gmx.com wrote:
If a pure function takes a reference/pointer, does that state that the
result of
the function will be the same on two calls to it if the
reference/pointer points
to the same data in both cases or if the data itself is unchanged?
If it's a matter
On Saturday 18 September 2010 17:33:21 Simen kjaeraas wrote:
Jonathan M Davis jmdavisp...@gmx.com wrote:
If a pure function takes a reference/pointer, does that state that the
result of
the function will be the same on two calls to it if the
reference/pointer points
to the same data in
On Saturday 18 September 2010 18:16:31 Jonathan M Davis wrote:
I don't think that *anything*
is implicitly convertable to immutable. const yes, but not immutable
Actually, I guess that value types are implicitly convertible to immutable in
the sense that you can create a new immutable value
Jonathan M Davis jmdavisp...@gmx.com wrote:
Except that since when is anything implictly convertable to immutable?
Implicitly converted to const, yes. That happens often enough, but
immutable?
Anything that does not contain pointers or references to non-immutable
data is implicitly
Philippe Sigaud wrote:
1. Having the strings, defined at compile time, MyClass and mymethod,
how could I could I get to a delegate to MyClass.mymethod?
You can insert them in a piece of code as a string, and then mix it in:
enum string code = auto deleg = ~ className ~ . ~ methodName ~
Is it in any way possible to copy a delegate? Take this program for example:
import std.stdio;
void main()
{
int a = 0;
int func()
{
return a++;
}
int delegate() b = func;
int delegate() c = b;
writeln(b());
writeln(c());
writeln(b());
}
It will
On Sun, Sep 19, 2010 at 03:43, Juanjo Alvarez juan...@gmail.com wrote:
enum string code = auto deleg = ~ className ~ . ~ methodName ~ ;;
// auto deleg = MyClass.mymethod;
mixin(code); // created deleg, you're good to go.
I tried it and worked like a charm (but I've changed my code so
28 matches
Mail list logo