July 30, 2004
> Icky.  I'd just assume have "ctor" and "dtor" but... I figure that bit has been set more or less in stone from the start.  Oh well.

What would be cool (should that route be followed) would be using ctor and dtor as qualifiers/attributes:

class X
{
  ctor Create() {
  };

  ctor CreateWithInt( int i ) {

  };

  ctor CreateClone( X toClone ) {

  };

  dtor Destroy() {
  };
}

That would be cool. You then could have *named* constructors. That would make it worthwhile... That would make the language more verbose, but also more explicit.

Matt

July 31, 2004
Ant wrote:
> Sorry, but...
> 
> I still don't understand why the ctor is called "this"
> instead of "constructor" or "ctor".
> nobody explained it to me...
> 
> why not call trig1 instead of sin
> trig2 instead of cos
> trig3 instead of tan
> 
> Poll:
> How long will Ant be able to hold before bringing up this thing again:
> 
> ---------+>>>>>
> 6 hours  |     1 day    |     1 week   |
> 1 month  |
> 6 months |
> 1 year   | X
> forever	 |
> 
> Ant
> 
I always thought that it was called this, because
'this' refers to the Object that was created when
the thread entered the constructor. Each time the
constructor is called a new 'this' is created which has
its own copy of the variables and methods.

Phill
August 01, 2004
In article <pan.2004.07.30.18.28.59.941166@teqdruid.com>, teqDruid says...
>
>> example, you cannot have:
>> 
>>>    class Int
>>>    {
>>>        this(char[] decDigits);
>>>        this(char[] hexDigits);
>>>    }
>> 
>> However, this could work:
>> 
>>>    class Int
>>>    {
>>>        ctor dec(char[] digits);
>>>        ctor hex(char[] digits);
>>>    }
>> 
>> Regards,
>> Martin M. Pedersen
>
>class Int
>{
>	static Int ctorDec(char[] digits);
>	static Int ctorHex(char[] digits);
>}


I should point out that the class Int does, in fact, have a constructor which takes only a char[]. (As well as a constructor which takes a char[] plus a radix). The char[]-only version parses the string. If it starts with "0x", it's hex. If it starts with "Ob", it's binary. And so on. If you don't want to to use such a prefix, you can use the (char[] digits, int radix) constructor.

So, although this is an interesting idea, I don't think that the current system is necessarily deficient.

Arcane Jill


August 02, 2004
I personally like 'self'.

In article <pan.2004.07.30.03.51.24.524418@yahoo.ca>, Ant says...
>
>Sorry, but...
>
>I still don't understand why the ctor is called "this"
>instead of "constructor" or "ctor".
>nobody explained it to me...
>
>why not call trig1 instead of sin
>trig2 instead of cos
>trig3 instead of tan
>
>Poll:
>How long will Ant be able to hold before bringing up this thing again:
>
>---------+>>>>>
>6 hours  |
>1 day    |
>1 week   |
>1 month  |
>6 months |
>1 year   | X
>forever	 |
>
>Ant
>


1 2
Next ›   Last »