Jump to page: 1 2 3
Thread overview
Unofficial wish list status.
Mar 24, 2005
12tkvvb02
Mar 24, 2005
Ben Hinkle
Mar 24, 2005
Derek Parnell
Mar 25, 2005
Ben Hinkle
Mar 25, 2005
Knud Sørensen
Mar 25, 2005
Regan Heath
Mar 25, 2005
Lionello Lunesu
Mar 25, 2005
Knud Sørensen
Mar 25, 2005
John C
Auto newing of classes (was: Unofficial wish list status)
Mar 25, 2005
Lionello Lunesu
Mar 26, 2005
Derek Parnell
Mar 26, 2005
Ben Hinkle
Mar 26, 2005
Regan Heath
Mar 27, 2005
Derek Parnell
Mar 27, 2005
Ben Hinkle
Mar 28, 2005
Regan Heath
Mar 27, 2005
Knud Sørensen
Mar 29, 2005
Georg Wrede
Re: Unofficial wish list status. (null)
Mar 28, 2005
Regan Heath
Mar 25, 2005
David Medlock
Mar 25, 2005
Regan Heath
Jun 02, 2006
renox
March 24, 2005
Hi

This is the monthly status for the unofficial d wish list: http://all-technology.com/eigenpolls/dwishlist/

Right now the wish list looks like this:

0.565  5  Auto new-ing of classes
0.528  6  unit test after compilation
0.507  6  array initialization/literals
0.501  6  Reflection API
0.487  3  Compiler values
0.407  4  vectorization
0.396  4  black box unit testing
0.394  4  Unit test isolation
0.375  4  unit test & code separation
0.33  3  Array masking
0.315  4  unit test coverage
0.263  4  Unit test measurements
0.202  2  Posix threads support native
0.187  2  Javadoc documentation
0.187  3  Faster GC
March 24, 2005
<12tkvvb02@sneakemail.com> wrote in message news:d1uve0$2ca$1@digitaldaemon.com...
> Hi
>
> This is the monthly status for the unofficial d wish list: http://all-technology.com/eigenpolls/dwishlist/
>
> Right now the wish list looks like this:
>
> 0.565  5  Auto new-ing of classes

wow - I'm surprised this is popular (though I don't know how many people
have voted or how often). For those who didn't follow the link, here's the
description of auto new'ing:
Foo A;
is shorthand for Foo A = new Foo and
Foo A = !new
would be the way of initializing to null.

I'd be very surprised if Walter changes the language to do that. The current system is much better.


March 24, 2005
On Thu, 24 Mar 2005 17:58:31 -0500, Ben Hinkle wrote:

> <12tkvvb02@sneakemail.com> wrote in message news:d1uve0$2ca$1@digitaldaemon.com...
>> Hi
>>
>> This is the monthly status for the unofficial d wish list: http://all-technology.com/eigenpolls/dwishlist/
>>
>> Right now the wish list looks like this:
>>
>> 0.565  5  Auto new-ing of classes
> 
> wow - I'm surprised this is popular (though I don't know how many people
> have voted or how often). For those who didn't follow the link, here's the
> description of auto new'ing:
> Foo A;
> is shorthand for Foo A = new Foo and
> Foo A = !new
> would be the way of initializing to null.
> 
> I'd be very surprised if Walter changes the language to do that. The current system is much better.

I submitted this one. There is further discussion at ...

http://www.prowiki.org/wiki4d/wiki.cgi?FeatureRequestList/AutoNewingOfClasses


-- 
Derek Parnell
Melbourne, Australia
25/03/2005 10:17:37 AM
March 25, 2005
"Derek Parnell" <derek@psych.ward> wrote in message news:1hyzck675ctcf$.14kdoa1p26fdc$.dlg@40tude.net...
> On Thu, 24 Mar 2005 17:58:31 -0500, Ben Hinkle wrote:
>
>> <12tkvvb02@sneakemail.com> wrote in message news:d1uve0$2ca$1@digitaldaemon.com...
>>> Hi
>>>
>>> This is the monthly status for the unofficial d wish list: http://all-technology.com/eigenpolls/dwishlist/
>>>
>>> Right now the wish list looks like this:
>>>
>>> 0.565  5  Auto new-ing of classes
>> I'd be very surprised if Walter changes the language to do that. The
>> current
>> system is much better.
>
> I submitted this one. There is further discussion at ...
>
> http://www.prowiki.org/wiki4d/wiki.cgi?FeatureRequestList/AutoNewingOfClasses

The =null makes more sense than the =!new. How did it turn into !new on the
eigenpoll? oh well. But even with =null I would be surprised if Walter goes
for it. The proposal doesn't feel right to me for two reasons: 1) an
expensive operation like "new" shouldn't be implicit, and 2) it would mean
the code
Foo a;
a = ...;
is different than
Foo a = ...;

Even though C++ distinguishes between initialization and assignment I don't D should go down that road.


March 25, 2005
Ben Hinkle wrote:
> <12tkvvb02@sneakemail.com> wrote in message news:d1uve0$2ca$1@digitaldaemon.com...
> 
>>Hi
>>
>>This is the monthly status for the unofficial d wish list:
>>http://all-technology.com/eigenpolls/dwishlist/
>>
>>Right now the wish list looks like this:
>>
>>0.565  5  Auto new-ing of classes
> 
> 
> wow - I'm surprised this is popular (though I don't know how many people have voted or how often). For those who didn't follow the link, here's the description of auto new'ing:
> Foo A;
> is shorthand for Foo A = new Foo and
> Foo A = !new
> would be the way of initializing to null.
> 
> I'd be very surprised if Walter changes the language to do that. The current system is much better. 
> 
> 
Syntaxes are like opinions, everyone has them, they usually only like their own.

How about:
auto Foo A;

Cleaner and doesnt break much(if any) code.
-David

March 25, 2005
> The =null makes more sense than the =!new. How did it turn into !new on the eigenpoll? oh well.

Apparently someone posted it with !new. The question is how long it will take for someone to post a new suggestion with null.

But I can see why it is popular.

When coming from C++ it seems strange
that you should write the class name twice to get an element.
C++: MyClassName aElement(...);
D:   MyClassName aElement= new MyClassName(...);

That is almost twice as much typing to do the same thing, and that is every time you need an element of a class.

To go easy on exiting code the compiler could be updated in stages.

1) Warn for implicit null code like
MyClassName nullElement;

2) Disallow implicit null and enforce MyClassName nullElement = null; This will force all existing code to be updated.

3) After a while change
MyClassName aElement;
to implicit mean
MyClassName aElement = new MyClassName;

> But even with =null I would be surprised if Walter goes for it. The proposal doesn't feel right to me for two reasons: 1) an expensive operation like "new" shouldn't be implicit,

Not even if you need it anyway 99.99% of the time ?

> and 2) it would mean
> the code
> Foo a;
> a = ...;
> is different than
> Foo a = ...;
> Even though C++ distinguishes between initialization and assignment I don't
> D should go down that road.



March 25, 2005
Knud Sørensen wrote:

> But I can see why it is popular.
> 
> When coming from C++ it seems strange
> that you should write the class name twice to get an element.
> C++: MyClassName aElement(...);
> D:   MyClassName aElement= new MyClassName(...);

This is because D (just like Java) has eliminated both
special syntax for pointers/references and stack objects ?

C++:  MyClassName *aElement; // some fun random value
D:    MyClassName aElement; // always null

Both: aElement = new MyClassName(...);

I can see how it get's a bit tricky at first, though...
(when coming from C++ and used to non-reference classes)

> 3) After a while change MyClassName aElement;
> to implicit mean  MyClassName aElement = new MyClassName;
> 
>>But even with =null I would be surprised if Walter goes for it. The proposal doesn't feel right to me for two reasons: 1) an expensive operation like "new" shouldn't be implicit, 

Simple objects like ints and structs are different
from references and pointers, as well ? But since the
default (.init) values seems messed up anyway, like
with characters and floating point values, I do *fear*
that one has to initialize everything explicitly...

Who knows, maybe this will change in a future D version ?
(then all now-null references will allocate Objects instead,
and the current code will start behaving somewhat differently...)

But I hope not. (being used to Java)

--anders
March 25, 2005
On Fri, 25 Mar 2005 11:55:41 +0100, Knud Sørensen <12tkvvb02@sneakemail.com> wrote:
> When coming from C++ it seems strange
> that you should write the class name twice to get an element.
> C++: MyClassName aElement(...);
> D:   MyClassName aElement= new MyClassName(...);
>
> That is almost twice as much typing to do the same thing,
> and that is every time you need an element of a class.

If anything, I would like this idea better..

MyClassName a;       //a is null
MyClassName a();     //same as MyClassName a = new MyClassName();
MyClassName a(1,2);  //same as MyClassName a = new MyClassName(1,2);
MyClassName a = new MyClassName(1,2,3);  //obvious :)

Though, and here's the kicker, the a() example looks like a class created on the stack, right? as in C++, and it's not.

Regan
March 25, 2005
On Thu, 24 Mar 2005 19:48:06 -0500, David Medlock <nospam@nospam.com> wrote:
> Ben Hinkle wrote:
>> <12tkvvb02@sneakemail.com> wrote in message news:d1uve0$2ca$1@digitaldaemon.com...
>>
>>> Hi
>>>
>>> This is the monthly status for the unofficial d wish list:
>>> http://all-technology.com/eigenpolls/dwishlist/
>>>
>>> Right now the wish list looks like this:
>>>
>>> 0.565  5  Auto new-ing of classes
>>   wow - I'm surprised this is popular (though I don't know how many people have voted or how often). For those who didn't follow the link, here's the description of auto new'ing:
>> Foo A;
>> is shorthand for Foo A = new Foo and
>> Foo A = !new
>> would be the way of initializing to null.
>>  I'd be very surprised if Walter changes the language to do that. The current system is much better.
> Syntaxes are like opinions, everyone has them, they usually only like their own.
>
> How about:
> auto Foo A;
>
> Cleaner and doesnt break much(if any) code.
> -David

"auto" already has a meaning.
http://www.digitalmars.com/d/attribute.html#auto

Regan
March 25, 2005
Hey,

Just a short remark...

In my toolkit I use some 'smart pointer' classes (kind-of like CComPtr in ATL) and one of the nice things is a constructor that can new the object:

// c++ pseudo code from the top of my head
enum _newnow { NEWNOW=1; }
template <class T>
class SmartPtr
{
  T* ptr;
  SmartPtr() : ptr(NULL) {}
  SmartPtr(_newnow) { ptr = new T; }
// more stuff, a.o. dereference operator etc..
};

//Use it as follows:
SmartPtr<SomeClass> sca;        // will be NULL
SmartPtr<SomeClass> scb(NEWNOW);
sc->Bla();

This syntax seems doable? Could be like this:

// D now
class Whatever { ... };

Whatever wa;        // will be NULL;
Whatever wa();        // new, default constructor
Whatever wa(...);    // new, constructor with arguments

Won't break any code, since "Whatever wa();" is illegal? Would be very nice if "auto Whatever wa();" would behave as if the object was made on the stack in C++. Maybe the compiler can even choose to do it on the stack, when it gets smarter!

Lionello.


« First   ‹ Prev
1 2 3