In NVIDIA cg/cgfx, there is a very good feature, unsized array. Although the compiler must know its length in compiling time, but it's very suit to handle lot's of lights, materials, cut whole shader into pieces, easily to extent.
Will glsl support this ? Currently I have to pass a integer to control the steps in the loop. :-(