kikito / inspect.lua

Human-readable representation of Lua tables
https://github.com/kikito/inspect.lua
MIT License
1.38k stars 196 forks source link

Added a shorthand for specifying depth as the second argument #8

Closed dpashkevich closed 11 years ago

dpashkevich commented 11 years ago

Besides retaining backwards compabibility with 1.x.x it would also be a nice shorthand (as depth is perhaps the most common option)

dpashkevich commented 11 years ago

As for the spec, I just copy-pasted the tests from it('is modifiable by the user' ... but I can do some refactoring to reduce code duplication if you support the idea

kikito commented 11 years ago

Hi dpashkevich,

I actually thought about doing this (make options behave as {options = depth} when it was a number), but I finally decided against it. The new syntax is more extensible (for example, now I can leave a tab option very easily) and with the addition of filter the depth option is a bit less useful.

If people really need the old syntax, they can use the 1.x.x branch and it will work just fine. If they need luajit type compatibility, they will have to upgrade, and use the new syntax, but I think that's ok.

Thanks for the PR, but I will not merge this one.

dpashkevich commented 11 years ago

I agree that the new syntax is extensible and I'm not for removing it (it works). Why not support both and reduce the number of typed characters for 90% of cases? I feel like most of the time if options are used at all, they would consist of just the depth option.