lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Jun 10, 2012 at 12:38 AM, Paul K <paulclinger@yahoo.com> wrote:
>> (2) A "--[[table: 0x9aa7988]]" style comment is appended after each
>> (3) The keys are not currently being sorted.
>> (10) Dumps of bytecode are probably not useful for pretty printing
>> (12) In "nil values are included when expected ({1, nil, 3} instead of

The above four points all are related to whether the dumper should
have the property of deterministic output under structural equality.
Either way, this property may be worth discussing in Features.

Arguments for deterministic output:

- Dumping may be used as a poor man's test of structural equality:
serialize(a) == serialize(b).  This can be useful in test suites.
More sophisticated alternatives include
https://github.com/silentbicycle/tamale .

- Sizes of diffs between dumps is reduced.  This may be useful when
the serializer is used to write data or configuration files to be
maintained under revision control.  It may also be useful in
debugging, such as diffing dumps from two separate runs.  However,
deterministic output is not the only factor affecting diff size.

- Sorting may improve readability, particularly for tables with many
elements (e.g. thousands).  However, optimal sort order is subjective
-- http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html
.

Arguments against:

- Impact on performance and code complexity?

- Not needed in some cases.