Why don't McmWriter/Reader save/load the name?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Why don't McmWriter/Reader save/load the name?

Chris Muller-3
Why isn't serialization for MCConfiguration's include the name?

"Inspect.  Why is 2nd-elements name misisng?"
MCConfiguration allInstances anyOne in:
     [ : config |
     { config.
     (MCMcmReader on:
          (String streamContents:
               [ : stream | config fileOutOn: stream ]) readStream) version } ]

This is unexpected behavior..

Reply | Threaded
Open this post in threaded view
|

Re: Why don't McmWriter/Reader save/load the name?

David T. Lewis
On Mon, Oct 07, 2013 at 09:21:48PM -0500, Chris Muller wrote:

> Why isn't serialization for MCConfiguration's include the name?
>
> "Inspect.  Why is 2nd-elements name misisng?"
> MCConfiguration allInstances anyOne in:
>      [ : config |
>      { config.
>      (MCMcmReader on:
>           (String streamContents:
>                [ : stream | config fileOutOn: stream ]) readStream) version } ]
>
> This is unexpected behavior..

Just guessing but maybe:

Because an MC configuration is stored in a named file (stream), and
an anonymous stream does not have a name.

If you chose to serialize the name and store it in the file, you would
then have the problem of what to do if the file name did not match the
expected name, or what to do if you wanted to rename the file in which
the configuration had been stored. That is certainly a solveable problem,
but there is something to be said for keeping things simple.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: Why don't McmWriter/Reader save/load the name?

Bert Freudenberg
On 08.10.2013, at 06:57, "David T. Lewis" <[hidden email]> wrote:

> On Mon, Oct 07, 2013 at 09:21:48PM -0500, Chris Muller wrote:
>> Why isn't serialization for MCConfiguration's include the name?
>>
>> "Inspect.  Why is 2nd-elements name misisng?"
>> MCConfiguration allInstances anyOne in:
>>     [ : config |
>>     { config.
>>     (MCMcmReader on:
>>          (String streamContents:
>>               [ : stream | config fileOutOn: stream ]) readStream) version } ]
>>
>> This is unexpected behavior..
>
> Just guessing but maybe:
>
> Because an MC configuration is stored in a named file (stream), and
> an anonymous stream does not have a name.
>
> If you chose to serialize the name and store it in the file, you would
> then have the problem of what to do if the file name did not match the
> expected name, or what to do if you wanted to rename the file in which
> the configuration had been stored. That is certainly a solveable problem,
> but there is something to be said for keeping things simple.
>
> Dave

This. I guess it just never occurred to me to store the name in the config because it would be redundant. Also, one should probably treat a configuration as read-only, updating it should create a new one. And that would have to have a new name. So it probably should remember its "parent". And perhaps get a UUID. And a comment. Etc. But since none of these were essential I didn't add them in the beginning, rather choosing to DTSTTCPW.

- Bert -