Re: One good argument against using "with"
- From: Charles McAllister <charles@xxxxxxxxxxx>
- Date: Sat, 11 Feb 2006 21:53:27 -0600
Adem wrote:
Charles McAllister wrote:Good thinking <g>. Yes I've thought of that, and I started to make each class descend from a TPersistent, with refcounting removed. But backed out of my changes because of the other issues I talked about above.
I don't know if its unsurmountable, but it is going to be difficult
to save everything and be able to load it back into the tree just
as before (I'm speaking of the interfaces in IcwInterfaces.pas).
This is because everything is linked together through an interface
pointer reference, which obviously cannot be persisted.
Oh, no.. Is there any reason those interfaces couln't be made TPersistent
with virtual abstract methods?
Yeah it's good enough for me. But something would have to be done, if its going to integrated into the IDE, where refactorings could be done many times throughout the day without having to reparse every single unit. How about requiring a full parse when you first use the expert, then the expert would pay attention to what units are altered in the IDE throughout the day, and only re-parse those units. There could be some killer experts made using CW, like on the scale of CodeRush.
IMHO, CodeLense infrastructure is blazingly fast, I very much doubt
file I/O (saving and loading *.cwu) can beat CW's parsing speed.
The largest single pas file I have so far seen hasn't been bigger
than 1.5 MB (save the one I autogenerated couple of weeks ago which
was 133 MB and choked Delphi --we won't go into that <g>).
So, no, I would not go that route. In memory should be good enough.
But, I'd really like to know your opinion/stance on turningThere are several options. One idea would be to make a TPersistent descendant that would aggregate the interface, and publish what it needs.
every Interface into a TPersistent (or TObject at worst).
This would make a really nice expert in Delphi's IDE. Have a little window docked that would show scope-aware search results. Does Delphi 2006 have this? I think I could use this like 100 times a day <g>.When you parse a project in CW, you get a tree view of symbols it
has gathered. These symbols are defined in ucwInterfaces.pas.
But these interfaces (and the classes that implement them) don't
keep any of the whitespace, and comments in each unit. So its
not possible to re-generate the source code using these interfaces.
Not much of a problem. What I had in mind was, a more intelligent
search and replace (refactoring) that would have to be scope-aware.
For this type of thing, it would help (for speed) that token location
be known.
IcwClass has a property called InheritsFromClass. It also has a Descendants property.What I did then was create a set of classes that represent a hierarchy
of sections in the source code, and these classes do preserve all of
the source code. These classes are found in ucwRefactorNodes.pas.
You can use the RefactorNodeTreeView.bpl plugin to see how a unit
gets parsed into these classes.
Yes, I did see that. What I did not check or see was whether references
to classes (or methods) derive/override from base classes (and from
other units). I suppose it is there, or else 'unwith'ing wouldn't work.
Un-withing does look at the current class and all ancestors.
Cheers,.
Adem
- Follow-Ups:
- Re: One good argument against using "with"
- From: Adem
- Re: One good argument against using "with"
- References:
- One good argument against using "with"
- From: Captain Jake
- Re: One good argument against using "with"
- From: marc hoffman
- Re: One good argument against using "with"
- From: John Jacobson
- Re: One good argument against using "with"
- From: marc hoffman
- Re: One good argument against using "with"
- From: Charles McAllister
- Re: One good argument against using "with"
- From: Adem
- Re: One good argument against using "with"
- From: Charles McAllister
- Re: One good argument against using "with"
- From: Adem
- Re: One good argument against using "with"
- From: Charles McAllister
- Re: One good argument against using "with"
- From: Adem
- One good argument against using "with"
- Prev by Date: Re: Who Owns the Source Code - Looking for Links
- Next by Date: Re: The Future Of Delphi
- Previous by thread: Re: One good argument against using "with"
- Next by thread: Re: One good argument against using "with"
- Index(es):
Relevant Pages
|