Currently if you're switching back and forth between programs that have different amount of texture samplers, you have to pass in NULL, which kind of doesn't make sense.
for instance a frag shader with 3 textures you would setTextureAt 3 times, however, you might bind a different program afterwards with only one texture -- requiring you to set those to null:
doesn't it make sense to set all textures to null when binding to the program?
No, it doesn't make much sense this way. Molehill is low level and should not automatically guess what you want to do - "don't think, just work."
Any low level state setting should not affect any other state setting, otherwise it's hard to build an optimized scenegraph sorting renderables to minimize state calls.
Don't see "setProgram" as the start or an exposed call of a render session part, but as a state setting just like "setProgramConstants". So it should not initiate or delete anything except what it stands for.
But maybe the case "setting textures while not using them" should throw a warning instead of an error. Or is there a case where it is necessary to throw an error?