Forum Navigation
text.Properties interface should be consistent
Posted: 10/29/07 17:30:32Looking at the current interface for text.Properties, the load functions use a delegate to process the properties in the stream. The save functions use an associative array which contains all the properties as a parameter.
I think the interface should be consistent for saving and loading. If I am storing properties in some way other than an associative array, I should not have to first convert to the AA before storing.
Perhaps some sort of container interface? Like:
interface PropertyContainer(T) { void add(T[] name, T[] value); int opApply(delegate dg(ref T[] name, ref T[] value)); }Then the Properties class would use a PropertyContainer? class to interface between the runtime storage method chosen by the coder and a file/stream. The interface would be consistent with both saving and loading.
Then, you would probably want a default PropertyContainer? that stored its properties as an AA.
I can code up something like this if it's something that people want.
-Steve