[PD-dev] Tcl/Tk code formatting and file organization

Miller Puckette mpuckett at imusic1.ucsd.edu
Sat Jan 3 22:48:11 CET 2009


Sorry for the slow response on this one...

> - first, does anyone object to making the Tcl files use 90 or 100  
> character widths?  Tcl lines tend to be long and 80 char width tends  
> to cause a lot of really ugly lines.
> 

This would cause me much misery since I often depend on 'terminal' editors
that can't be conveniently reformatted by file.  Plus, it's hard to know where
to draw the line.

> - second, I think we should use a similar tab format as the C side,  
> but cleaner: 4 char tabs, all spaces or maybe all tabs.
> 
I've "always" used 4-character indents, no tabs (except for makefile.in :) 
Various contributed code deviates from that, and when I have to actually look
at it I feel at liberty to thrash it into the pd "standard".  There are some
bits I'm afraid to touch, such as the ALSA MIDI code, since I don't have any
setup on which to test it.

I think it causes great confusion to use hard tabs in the code.  If they're
absolutely unavoidable let's keep them to 8 spaces (the most standard value
even if it doesn't agree with the indentation style.)

> - third, I am thinking that the Tcl should be broken up into single- 
> file packages where the package name and the file name are the same.   
> For example:
> 
> pd.tk
> menus.tcl
> menucommands.tcl
> bindings.tcl
> preferences.tcl
> ...
> 
> or maybe:
> 
> pd.tk
> pdmenus.tcl
> pdmenucommands.tcl
> pdbindings.tcl
> pdpreferences.tcl
> ...

but 'pd' is understood - it's the name of the program.  On the other hand, "u"
is opaque as a prefix.  "g" is taken.  Maybe "t", as in "t_pd.tk", etc.
Also, unless there's a reason to have some named ".tk" and others ".tcl" they
should share the same suffix to make globbing easier.

Historical note: the reason the makefile copies the tk script is so that all
the source could live in the same directory, but so that the runtime wouldn't
look in the source directory in case someone wants to install the two in
separate places (as in redhat's "rpm" and "srpm" setup).

cheers
Miller

> 
> ------------------------------------------------------------------------ 
> ----
> 
> The arc of history bends towards justice.     - Dr. Martin Luther  
> King, Jr.
> 
> 
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev




More information about the Pd-dev mailing list