== 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?
> >
> > This now won't compile due to multip
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?
>
> This now won't compile due to multiple matches.
>
>
> module main;
>
> interface I1{}
> interface I2
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
On Saturday 08 January 2011 19:16:26 Ellery Newcomer wrote:
> On 01/08/2011 09:02 PM, Jonathan M Davis wrote:
> > On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote:
> >> where did libdruntime.a go in dmd.2.051.zip:/linux/lib ?
> >
> > I think that it's included inside of libphobos.a now,
On 01/08/2011 09:02 PM, Jonathan M Davis wrote:
On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote:
where did libdruntime.a go in dmd.2.051.zip:/linux/lib ?
I think that it's included inside of libphobos.a now, and has been for a few
releases. The libraries are still separate, and you
On Saturday 08 January 2011 13:32:19 Ellery Newcomer wrote:
> where did libdruntime.a go in dmd.2.051.zip:/linux/lib ?
I think that it's included inside of libphobos.a now, and has been for a few
releases. The libraries are still separate, and you can build them separately,
but from what I can t
Tomek got it right. Fixed by copying the objects, rather than using pointers.
Thanks!
On 1/9/11, Jesse Phillips wrote:
> I don't think new line means to flush the buffer like it does in printf. I
> think you can use stdout.flush() from stdio;
>
Ok, that works. Thanks.
Andrej Mitrovic Wrote:
> Unfortunately I can't provide a simple test case, but I have a case where
> using:
>
> writef("..\n");
>
> inside a loop that runs a dozen times does not print out each line as the
> statement is reached, instead it prints out everything at once when the
> app
On Sat, 08 Jan 2011 16:39:34 -0500, bearophile wrote:
> Two versions:
Probably by mistake, both are the same.
Michal Minich:
> Probably by mistake, both are the same.
You are right, I am sorry :-)
In D the name of functions starts with lowercase.
class Fib {
private const Fib left, right;
this(in Fib left=null, in Fib right=null) {
this.left = left;
this.right = right;
}
Unfortunately I can't provide a simple test case, but I have a case where using:
writef("..\n");
inside a loop that runs a dozen times does not print out each line as the
statement is reached, instead it prints out everything at once when the
application is done. If I use this:
writeln
Sean Eskapp:
> I had some code that was segfaulting, so I rewrote the basic idea as a
> fibonacci function, and lo and behold, it still segfaults. Why, and how to
> fix?
Two versions:
struct Fib {
private const Fib* left, right;
this(in Fib* left=null, in Fib* right=null) {
thi
where did libdruntime.a go in dmd.2.051.zip:/linux/lib ?
> 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,
Use case:
import std.variant;
void foo (Variant v) {}
void main () {
Variant v = 3; // ok, this () called
v = 3; // ok, opAssing called
foo (v); // ok, struct copy, this(this) called
foo (3); // error
}
I'm trying to understand what is needed to make thi
Sean Eskapp napisał(a):
I had some code that was segfaulting, so I rewrote the basic idea as a
fibonacci function, and lo and behold, it still segfaults. Why, and how
to fix?
This looks fishy:
class Fib
{
private const Fib* left, right;
...
this(in Fib left, in Fib right)
On Sat, 08 Jan 2011 20:34:39 +, Sean Eskapp wrote:
> if(left == null)
1) write if (left is null) instead if checking for null. Equality
operator is rewritten to a.opEquals(b), which you don't want if you
checking for null.
> this()
> {
> left = right = null;
> }
2) defaul
Thank Pelle , and others.
I'm thinking ways to do this task :
http://rosettacode.org/wiki/Anonymous_recursion
With this last version of Y-combinator
http://rosettacode.org/wiki/Y_combinator#D ,
it look like this:
ulong fib(long n) {
if(n < 0) throw new Exception("No negative") ;
return Y((ul
On 1/8/11, Stewart Gordon wrote:
> On 08/01/2011 17:40, Andrej Mitrovic wrote:
>
>> Otherwise I'd really like the ability for a lambda to call itself.
>> Perhaps a feature request is in order.
>
> I'm not sure what D would gain in practice. If you want a function that
> calls itself, why not jus
On 08/01/2011 05:56, %u wrote:
{
auto b = Array!(bool)();
b.length = 1024 * 1024 * 128 * 8;
//Test memory here: high
}
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.
If you run thi
On 08/01/2011 17:40, Andrej Mitrovic wrote:
Otherwise I'd really like the ability for a lambda to call itself.
Perhaps a feature request is in order.
I'm not sure what D would gain in practice. If you want a function that
calls itself, why not just name the function?
Stewart.
On 08/01/2011 16:00, Pelle wrote:
http://en.wikipedia.org/wiki/Fixed_point_combinator#Y_combinator
How are you getting around D not supporting recursively defined types?
Stewart.
As a workaround you can do this for now:
import std.stdio;
enum deleg = returnFib();
ulong delegate(ulong m) returnFib()
{
return (ulong m)
{
if(m < 2)
return m;
return deleg(m-1)+deleg(m-2);
};
}
void main()
{
writeln(returnFib()(10));
}
Otherwise I'
On 01/08/2011 04:45 PM, tsukikage wrote:
eg. to return a fibonacci delegate:
return (ulong m) {
if(m < 2) return m ;
return _self_ref(m-1)+_self_ref(m-2) ;
} ;
Is it possible? Thank you!
http://en.wikipedia.org/wiki/Fixed_point_combinator#Y_combinator
I don't think there's a built in way to
eg. to return a fibonacci delegate:
return (ulong m) {
if(m < 2) return m ;
return _self_ref(m-1)+_self_ref(m-2) ;
} ;
Is it possible? Thank you!
On 2011-01-08 09:15, Guilherme Vieira wrote:
Is is possible to get a named tuple from a struct type?
E.g.:
struct S { int foo; string bar; }
S s;
S.tupleof t; // S.tupleof is a tuple type, as opposed to s.tupleof,
// which yields a tuple instance
t[0] = 1;
Ellery Newcomer:
> int a = 1, *b = null;
Walter has disallowed code like this in D because in C it is a well known
source of bugs (so much that C style guides strongly suggest to declare only
each variable in a distinct statement and line of code).
> auto a = 1, b = null;
I have discussed th
Is is possible to get a named tuple from a struct type?
E.g.:
struct S { int foo; string bar; }
S s;
S.tupleof t; // S.tupleof is a tuple type, as opposed to s.tupleof,
// which yields a tuple instance
t[0] = 1;
t.bar = "2";
If not, I think it would be quite useful.
Even still,
29 matches
Mail list logo