MarcWeber / vim-addon-manager

manage and install vim plugins (including their dependencies) in a sane way. If you have any trouble contact me. Usually I reply within 24 hours
Other
660 stars 59 forks source link

scriptmanager2#KnownAddons() returns wrong items. #16

Closed Raimondi closed 13 years ago

Raimondi commented 13 years ago

scriptmanager2#KnownAddons() without arguments or with 0 as argument returns the same as when given 'installable' as argument.

MarcWeber commented 13 years ago

Filter first, then map names. Doh ! It happens again and again. I wonder what my mind did and why I never noticed it. Probably because all the plugins were found by "source" rather than by "being installed". Thanks.

Most strings compared to 0 give true. First: Its a nice habbit saying why the current behaviour breaks something Second: You make something work I don't know why its necessary. The code you add is not much more readable then the code which was present. May I suggest one of these instead? if type(arg) != type("") throw "string expected" endif

or type(arg) == type("") && arg == "installable"

or the like. Both are much more descriptive. If you agree on this fix it and I'll merge and add you to the "hall of fame' (contributors list) Do you want me to use your real name or Raimondi?

Raimondi commented 13 years ago

You are right, the commit message should be more explicit.

The change is necessary because the test installable == 'installable' always returns true, from :help eva.txt:

When comparing a String with a Number, the String is converted to a Number, and the comparison is done on Numbers. This means that "0 == 'x'" is TRUE, because 'x' converted to a Number is zero.

I can modify it. Do you expect to use any arguments besides "installable" in the future for that function?

Do you want me to use your real name or Raimondi?

My real name would be OK.

MarcWeber commented 13 years ago

Sorry. You've been right. I missed a detail. I'll pull and merge and shut up. Thanks.