On Fri, Jul 1, 2011 at 8:13 PM, Jason Mulligan <[email protected]> wrote:

> yes i am. extjs/jquery are fantastic examples of this paradigm gone
> wrong. the syntax ends up on multiple lines as you try to figure out
> what's what, and no IDE can accurately parse the docblock/expression/
> literal to say Param1 is ..., Param2 is ...
>
> most of the time it's just bad design.
>
> and, just to prove my point .. show me a built in function that
> expects an object as a param.
>


Have you seen es5 at all? The property descriptors in Object.defineProperty
and similar are great examples of built in javascript functions using
objects as params. There are some real limitations of function arguments in
the language. It appears they'll be corrected in the next es version but
until then options objects make for a nice workaround. And sometimes,
they're just the right answer (e.g. property descriptor objects).

But I'll concede that it doesn't feel right when any number of rare params
are promoted to the same level of importance as a few absolutely required
arguments -- it's called an "options" object for a reason. It's more
explicit when required params have their own argument slot, but this is
largely cosmetic.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to