On Jul 2, 7:00 pm, Nick Morgan <[email protected]> wrote: > On 2 July 2011 01:13, Jason Mulligan <[email protected]> wrote: > > > and, just to prove my point .. show me a built in function that > > expects an object as a param. > > Are you saying that we should be modelling our APIs on the ones > JavaScript supplies? Like `document.location = url`? Most of the > JavaScript API is ugly - we can do much better than that.
I think you mean DOM APIs. Specifying that they accept arguments that are a feature of one particular language is not consistent with their fundamental criteria of being language neutral, so that argument isn't applicable anyway. One use I can see for an object as a parameter is a generic *createElement* function. Given that there are 119 attributes in HTML 4.01 and an unlimited number in HTML5 (given the introduction of data- attributes) it is impractical to cater for all cases as formal parameters. It is much more practical to specify a single requier parameter of tagName and an object for the rest. However, a purpose-build function to create elements for a specific case might use a cloned element and modify only a few properties, so only a small number of parameters are required. These types of conflicts arise from time to time in any general vs specific design decision (micro kernel vs monolithic[1]). 1. <URL: http://linuxhelp.blogspot.com/2006/05/monolithic-kernel-vs-microkernel-which.html > -- Rob -- 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]
