Exceptional coding style

Era Scarecrow rtcvb32 at yahoo.com
Thu Jan 17 08:25:08 PST 2013


> On Thu, Jan 17, 2013 at 08:26:16AM +0100, Era Scarecrow wrote:
>> Somehow what seems like would work good is a card-file system. 
>> Assuming the order of functions/declarations don't matter and 
>> you let the editor deal with where it places things (say, 
>> alphabetically or by attributes like private, pure, etc), then 
>> having a partial 3d view where you can flip through various 
>> function definitions & header documentation, then open only 
>> the function(s) of interest in question, hiding anything 
>> unrelated. If there's anything global or variables it accesses 
>> those could be listed too along with their type, and perhaps 
>> where the type's definition comes from for reference; and any 
>> functions it calls along with others with the same overloading 
>> name.
> [...]
>
> That sounds like a very good idea. In fact, Vim has a feature 
> called folding, where parts of the file are folded into a 
> single line, to be expanded/collapsed at will. Properly 
> configured, this can be made to auto-collapse all functions, 
> nested blocks, etc., to be expanded at will. This makes long 
> source code much more navigable (though it doesn't change 
> sorting order -- I can see where that may be useful).

  NotePad++ does this too. However you are still managing the 
order of the functions, obviously in structs the order of 
variables matter (but not anywhere else), so if the editor 
handled where it was placed you'd always have a consistant 
layout. This likely would help quite a bit with managing source 
code.

  Course alphabetical could be a default after any other 
specialized functions are done. Examples are I'd want 
front/popFront next to eachother in the list, back/popBack, 
length, opIndex, opIndexAssign, all the slices together along 
with opDollar. Etc. Probably also have them in in multiple 
fold-outs where it's sorted by some criteria (unittests, public 
API, templates, pure/@safe).

  Could also have different operators and function predefined (but 
in grey for example), then enabling it gives you a default basic 
skeleton in which to add your operator specific code.

  All of this is what you could do without actually needing the 
compiler (but probably needs proper syntax checking).


More information about the Digitalmars-d mailing list