www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Structure of D Applications

reply "Tony" <talk#to#tony# #email.com> writes:
Hi all,

I would like to know what the recommended (and possible) methods are for
structuring a D application.

By this I mean: what are the techniques/paradigms available in the language?

For instance, I consider Lisp to have the following:

structured programming
object-oriened programming
functional programming
aspect-oriented programming (via auxiliary methods)
domain specific language development (via macros)

Thanks for any advice.

Tony
]Melbourne, Australia
talk#to#tony#at#email.com (remove the #'s)
May 05 2005
parent pragma <pragma_member pathlink.com> writes:
In article <d5cn87$p0q$1 digitaldaemon.com>, Tony says...
Hi all,

I would like to know what the recommended (and possible) methods are for
structuring a D application.

By this I mean: what are the techniques/paradigms available in the language?

For instance, I consider Lisp to have the following:

structured programming
object-oriened programming
functional programming
aspect-oriented programming (via auxiliary methods)
domain specific language development (via macros)

The quick-and-dirty rundown is that it follows very closely to C++: Structured programming Object-oriented programming Functional (free-function) programming Template (meta) programming D doesn't foist any particular paradigm on the programmer. They're all available so you can use the tool that fits best. D also brings to the table some things that are not explicitly enshrined in other languages (at least, not all at once): Template mixins RAII-style objects ('auto' keyword) Contract-oriented programming ('in', 'out', 'body' and 'invariant') Unitesting ('unittest' keyword) Built-in Delegate and Function pointer types ('delegate' and 'function'). Partial-array types The last one is a real nifty feature: any array type can be extended one method-at-time via free functions, where the first argument is the type to be extended: char[][] stringList; char[] getFirst(char[][] list){ return list[0]; } stringList.getFirst(); // first argument is substituted with 'stringList' This is similar to a partial-class in C#, but only applies to array types. Also on the menu are the fact that D is directly compiled to native machinecode (no VM), and sports a non-ref-counting GC. - EricAnderton at yahoo
May 05 2005