-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't put array items on the same line when persisting #558
Don't put array items on the same line when persisting #558
Conversation
IIRC, this style was used because of manifest files. Since manifest files are zipped now, I suppose it makes no difference... |
@hishamhm why? This doesn't change manifest size, both separators have length 2 |
deeply indented subtables produce lots of spaces |
@hishamhm would you like an option to retain old behaviour when saving manifests or is this OK? |
@@ -147,17 +144,11 @@ write_table = function(out, tbl, level, field_order) | |||
end | |||
|
|||
write_value(out, v, level, sub_order) | |||
if type(k) == "number" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking at the manifest tables. I suggest this compromise solution: if type(v) == "number"
. This will catch the version tables correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that for parsed version tables in dependencies
table? That could work. Although isn't that table redundant? repository
table contains dependencies in string format already...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is redundant, but I wanted to store the pre-parsed info for speeding things up for luarocks.loader
(though I don't remember if I measured it, and if I did, it was back in 2007 or so when I first wrote this code). The idea was that luarocks.loader
should work as little as possible to have minimal impact on require
.
Instead of pairs with number keys. Keeps parsed version representation compact but puts items in regular arrays each on its own line.
7b23838
to
3d21d6c
Compare
Rockspec fields with array values (e.g. dependencies) are typically written with each item on its own line. This change makes
luarocks new-version
follow this style, too. This also affects they way manifests are saved.