Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two decades? It's beginning to look that way. Obviously I'm
devouring the 2.0 documentation right now, but have not ye
Welcome!
On 01/20/2011 07:18 PM, Luke J. West wrote:
how do I, in c++ speak, do the D for...
A b(a); // or if you prefer...
A* b = new A(a);
try
A b = new A(a);
I'm sure this must be trivial.
Many many thanks,
Luke
On Thursday, January 20, 2011 17:18:48 Luke J. West wrote:
> Hi to all from a total noob.
>
> first of all, I'd like to say how impressed I am with D. In fact, I keep
> pinching myself. Have I *really* found a language worth leaving C++ for
> after two decades? It's beginning to look that way. Obv
On 1/20/11 7:18 PM, Luke J. West wrote:
Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two decades? It's beginning to look that way. Obviously I'm
devouring the 2.
Be afraid.. be very afraid!
import std.algorithm;
import std.stdio;
import std.conv;
enum fields = [__traits(allMembers, Foo)];
string populateFields(string[] haystack)
{
string result;
while (haystack.length > 0)
{
switch (haystack[0])
{
case "__ctor":
Ah, damnit, Andrei beat me to the punch!
Well, at least his methods make much more sense than my little hacks.
On 1/21/11, Andrei Alexandrescu wrote:
> I think copyMembers belongs to the standard library. I wanted to define
> a family of functions like it but never got around to it.
>
It's a shame we can't use .dup. It would look really nice in code.
On Thu, 20 Jan 2011 22:02:42 -0500, Andrei Alexandrescu
wrote:
On 1/20/11 7:18 PM, Luke J. West wrote:
Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two deca
On 2011-01-21 04:02, Andrei Alexandrescu wrote:
On 1/20/11 7:18 PM, Luke J. West wrote:
Hi to all from a total noob.
first of all, I'd like to say how impressed I am with D. In fact, I keep
pinching myself. Have I *really* found a language worth leaving C++ for
after two decades? It's beginning
On 1/20/11 11:28 PM, Robert Jacques wrote:
On Thu, 20 Jan 2011 22:02:42 -0500, Andrei Alexandrescu
wrote:
First, why not use tupleof? b.tupleof = a.tupleof; works perfectly fine,
simpler and ahem, actually works. __traits(getMember, ...) has to obey
scoping rules, so using it with a class that d
On 01/21/2011 04:48 AM, Andrej Mitrovic wrote:
On 1/21/11, Andrei Alexandrescu wrote:
I think copyMembers belongs to the standard library. I wanted to define
a family of functions like it but never got around to it.
It's a shame we can't use .dup. It would look really nice in code.
+++
De
spir:
> > It's a shame we can't use .dup. It would look really nice in code.
>
> +++
Copying classes is not a so common need in D. As an example, I need a byPair()
method for AAs more than dup for classes :-)
Bye,
bearophile
On 01/21/2011 06:28 AM, Robert Jacques wrote:
void copyMembers(A)(A src, A tgt) if (is(A == class)) { tgt.tupleof =
src.tupleof; }
What about this feature in Object under name "copy" or "dup"? Sure, it's
not to be used evereday; but it's typcally the kind of routine that,
when needed, we're v
On 01/21/2011 01:29 PM, bearophile wrote:
> spir:
>
>>> It's a shame we can't use .dup. It would look really nice in code.
>>
>> +++
>
> Copying classes is not a so common need in D. As an example, I need a
byPair() method for AAs more than dup for classes :-)
>
> Bye,
> bearophile
Sure, but wh
Theorizing: Would it be a bad idea if .dup for classes did the same
thing as normal assignment did for structs with postblit constructors?
Essentially I was thinking that code like this would do the trick:
import std.stdio;
class Widget
{
int integral; // field-by-field assignment
int[]
On Fri, 21 Jan 2011 08:16:24 -0500, spir wrote:
On 01/21/2011 06:28 AM, Robert Jacques wrote:
void copyMembers(A)(A src, A tgt) if (is(A == class)) { tgt.tupleof =
src.tupleof; }
What about this feature in Object under name "copy" or "dup"? Sure, it's
not to be used evereday; but it's typc
On 01/21/2011 05:27 PM, Robert Jacques wrote:
On Fri, 21 Jan 2011 08:16:24 -0500, spir wrote:
On 01/21/2011 06:28 AM, Robert Jacques wrote:
void copyMembers(A)(A src, A tgt) if (is(A == class)) { tgt.tupleof =
src.tupleof; }
What about this feature in Object under name "copy" or "dup"? Sure
On Fri, 21 Jan 2011 14:54:53 -0500, spir wrote:
On 01/21/2011 05:27 PM, Robert Jacques wrote:
On Fri, 21 Jan 2011 08:16:24 -0500, spir wrote:
On 01/21/2011 06:28 AM, Robert Jacques wrote:
void copyMembers(A)(A src, A tgt) if (is(A == class)) { tgt.tupleof =
src.tupleof; }
What about this
On Friday, January 21, 2011 12:10:26 Steven Schveighoffer wrote:
> On Fri, 21 Jan 2011 14:54:53 -0500, spir wrote:
> > (*)
> > Or do people really speak like:
> > << Would you please make a duplicate of the guest list? >>
> > in the US?
>
> They might, it doesn't sound that odd to me, though copy
19 matches
Mail list logo