Automatic code refactoring

BCS ao at pathlink.com
Thu Aug 2 16:24:22 PDT 2007


Reply to Robert,

> This is probably jumping way ahead of myself here, but if (some day,
> in the far future), Descent were to gain some automated D code
> refactoring support, what would you like to see?
> 
> So far I've thought of/stolen from the JDT:
> ----------
> - Extract abstract class, where some (or all, you choose which ones)
> of the fields/methods of a class are moved to a new abstract class,
> and the remainder remain as implementations in the subtype.

I'd go the other way

I would like this is convert a class to abstract, derive a cocreate class 
from it that acts as the original class does, replace all 'new's and derivations 
with this new class.

> 
> - Extract interface: create an interface for some or all of the
> methods of a class.
> 

extract interface from several classes (only ask about overlapping functions)

> ----------
> 
> Anyone have any other ideas or things they'd like to see? Descent
> doesn't even have semantic analysis yet, so this is a mostly
> theoretical topic, but someday your dreams may become a reality...
> 

convert "auto T = ..." to it's actual type
---
generate a explicit specialization of a template from a general one

template T(U) { U foo; }

becomes, for int

template T(U) { U foo; }
template T(U : int) { int foo; }
---
select methods from a class and build a mixin template for them
with interface extraction this would allow extracting interface + functionality 
blocks

interface I       { int foo() }
template I_impl() { int foo(){...} }
...
class C : I { mixin I_impl!() }






More information about the Digitalmars-d mailing list