Jordan Harrison:
> I'm not sure when and where it is best to check function parameters
> for the correct type and valid input.
>
> What kind of function parameter type checking do you do? Do you check
> in every function? Just the core library functions? What do you think
> about the overhead costs of checking? What kind of checking patterns
> do you use to write less code or make the process of writing it easier?

Plz dont care about performance in debug mode. Check types, add guard
expr and asserts etc. I recommend you implement this pattern
var _addNumToStr = _({
  s: String,
  n: Guarded(function(n){ return  n > 1 }, Number),
  howManyTimes: Guarded('$ >= 0', Number) // guard expr as string is
valid too to make code shorter
  },
  function(scope){with(scope) {
// scope contains {s}, {n} and {howManyTimes}, scope.__proto__ == null
}})
P.S. i know that {with} is 'evil' and __proto__ is nonstandard and
hash enumeration order is broken generally in V8 but work when you
dont change hash but its only for debug mode in Chrome or FF

-- 
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