www.digitalmars.com         C & C++   DMDScript  

D - Standards

reply "anderson" <anderson firestar.com.au> writes:
IDEA 1
I just had an idea for the style standards.

I'd be good if there was support for people who take a top-down (or is
bottom-up) approach to coding, where code there ends up being lots of stubs
(empty code areas).

Suggest they put a comment a word like
//STUB
or
//UNDONE

Then the programmer only needs to search for the these keywords.

It'd be one of those standards that won't be kept all the time, but everyone
would know what it means when they came across it. I find that a number of
error can occur in a large program by forgetting to fill a case statement
latter on.

Alternatively, (and I know Walter that you hate warnings), some sort of
count of all empty sections this could be done in a pre-phase compiler. And
it won't be a warning, you have a message like.

"34 incomplete areas"
And you'd keep working at the program until you'd removed them all, perhaps
a smart IDE could direct you to each one.

This concept probably has been included in some compliers as a warning
though.

IDEA 2
On another note,

I'd be nice to be able to deprecated code like in java. Perhaps assertion
could be used and paced in the standard.

ie message
"This function as deprecated as of version ... please use ... instead"
or
"This function as deprecated ... please use ... instead"

It'd also be good to have 2 levels of deprecation

One, that allows the use of the old function,
And one that doesn't but reports the error.

But perhaps versioning could do this?

IDEA 3
I'd be nice to be able to include a class one and have the program detect
it.

ie
1. Allow a class data type, that can hold classes

classtype(myclass) identifyer  = subclassofmyclass;

where myclass is a class
classtype is a keyword
subclassofmyclass the name of the subclass of myclass

That way you could simply put all classes into an array and create them on
the fly.
ie

classidentifyerarray[n] identifier = new classidentifyerarray[n];

//But the syntax need work of coarse (because arrays now become confusing)

perhaps
[n]classidentifyerarray identifier = new [n]classidentifyerarray;

2. Allow classes to supply a list of all there sub classes
This would probably be very difficult because there would be a number of
problems, such as how deep to go and which order to list them. I would
suggest having both single and multilevel options.

something like,

classtype(myclass)[] identifier = myclass.children;

(building on 1.)

This would fill an array of all the immediate subclasses in myclass, but
that may be impossible with the way the compiler works.

3. Allow some type of class enumeration or contant array

ie

const classtype ClassArray[] =
{
    className,
    className2,
    ect...
}

That way you'd may get rid of some dynamic problems the the previous
methods.

4. Fix loadLibary
As you probably know loadLibary is compiler specific for classes. It'd be
really neat to write plugins as classes.

At the moment loadLibary probably won't have problems, but when other
compiler based D begin to be build, problems could begin to arrise.

5. Allow virtual static member functions
There are workarounds for static virtual member functions, but why should we
use work arounds?
Virtual Static member functions could do provide workarounds for some of the
topics above as will as meny other things such as maintaining an automatic
individual object count, instead of a global object count for a particular
sub class.

Also I think this would (from my point of view) complete the class
operations.


For example in a drawing package, I have the super class called element.
When I want to add a new item such as line, I should be able to simply
extend the element class and include "line" the program should detect the
new class and included it in the next build (or at runtime). This way you
can have many programmers working univocally on many extend components (with
pre-define standards in the base class).


I've some other ideas (quite different) on style standards, but I've
forgotten them at present.

I'd like the style standards to be even more detailed, or alternatively have
an style advanced standard, because that's when you get to the real time
savers.  Styles should help specify how programs are designed (not to reduce
alternatives) but to help prevent programmers from doing stupid things
(because we're all human - well.. Walter I don't know about, he's a super
programmer (just kidding). Some of these things can be included in a
compiler, and some of them can't.


I'm glad I got some of that of my chest.

Sorry for the length.



But I'm sure Walter enough of his own ideas to last him a life time.

PS - Are private types virtual ?? why do private types need to be virtual???
May 28 2002
parent reply "Pavel Minayev" <evilone omen.ru> writes:
"anderson" <anderson firestar.com.au> wrote in message
news:ad0qqf$7ki$1 digitaldaemon.com...

 IDEA 2
 On another note,

 I'd be nice to be able to deprecated code like in java. Perhaps assertion
 could be used and paced in the standard.

 ie message
 "This function as deprecated as of version ... please use ... instead"
 or
 "This function as deprecated ... please use ... instead"

 It'd also be good to have 2 levels of deprecation

 One, that allows the use of the old function,
 And one that doesn't but reports the error.

It is possible with the help of "deprecated" keyword (RTFM the section on attributes). The compiler can be tuned to allow deprecated features, or to forbid them.
May 28 2002
parent "anderson" <anderson firestar.com.au> writes:
Thanks,

Theres a little bit of new stuff to learn.

"Pavel Minayev" <evilone omen.ru> wrote in message
news:ad1r4j$2hjh$1 digitaldaemon.com...
 "anderson" <anderson firestar.com.au> wrote in message
 news:ad0qqf$7ki$1 digitaldaemon.com...

 IDEA 2
 On another note,

 I'd be nice to be able to deprecated code like in java. Perhaps


 could be used and paced in the standard.

 ie message
 "This function as deprecated as of version ... please use ... instead"
 or
 "This function as deprecated ... please use ... instead"

 It'd also be good to have 2 levels of deprecation

 One, that allows the use of the old function,
 And one that doesn't but reports the error.

It is possible with the help of "deprecated" keyword (RTFM the section on attributes). The compiler can be tuned to allow deprecated features, or to forbid them.

May 29 2002