Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17501
| Date | 2012-12-05 12:00 -0800 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Cheap runtime asserts |
| References | <1892433a-7696-4b03-a94c-0b1f0a984134@googlegroups.com> |
| Message-ID | <jNWdnUip1a1tOiLNnZ2dnUVZ_oadnZ2d@earthlink.com> (permalink) |
On 12/4/2012 10:00 PM, glathoud wrote:
> Hello,
>
> To check argument types in functions that are used in many different
> places, I have been using this:
>
> function someCoreFunction( domnode, text ) {
>
> // "Cheap runtime assert": fails when `domnode` is not a DOM node.
> domnode.childNodes.a;
...
One problem I have with this is that childNodes seems like a good name
for the children of a node in any tree with an arbitrary fan-out,
regardless of whether it has anything to do with DOM. What advantage do
you see to this compared to checking the type?
Patricia
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cheap runtime asserts glathoud <glathoud@yahoo.fr> - 2012-12-04 22:00 -0800
Re: Cheap runtime asserts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-05 20:18 +0100
Re: Cheap runtime asserts glathoud <glathoud@yahoo.fr> - 2012-12-06 11:19 -0800
Re: Cheap runtime asserts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-12-06 23:41 +0100
Re: Cheap runtime asserts Patricia Shanahan <pats@acm.org> - 2012-12-05 12:00 -0800
Re: Cheap runtime asserts glathoud <glathoud@yahoo.fr> - 2012-12-06 11:34 -0800
Re: Cheap runtime asserts JJ <jaejunks@glegooilma-swapit.com> - 2012-12-06 07:29 +0000
Re: Cheap runtime asserts glathoud <glathoud@yahoo.fr> - 2012-12-06 11:40 -0800
Re: Cheap runtime asserts JJ <jaejunks@glegooilma-swapit.com> - 2012-12-07 12:03 +0000
Re: Cheap runtime asserts glathoud <glathoud@yahoo.fr> - 2012-12-10 23:46 -0800
Re: Cheap runtime asserts Stefan Weiss <krewecherl@gmail.com> - 2012-12-06 23:00 +0100
Re: Cheap runtime asserts glathoud <glathoud@yahoo.fr> - 2012-12-11 00:07 -0800
csiph-web