On 29 Gen, 13:43, Richard Quadling <> wrote:
> 2009/1/28 Diego Perini <>:
> > The other good thing you are doing with JSLint is enforce the type of
> > each function, I mean the return type. I have been told several time
> > that not being a strict typed language it doesn't matter blah..blah
> > blah.
> Why would you cripple the language by enforcing return types?

Hey it is Douglas Crockford JSLint saying that, not me, I am just
happily supporting the idea...

Are you saying that C and Java are crippled languages because they
enforce return types ?

Just wanted to point out that doing what Crockford suggests will help
write more robust javascript, though that doesn't mean you may be able
to achieve the same goal using functions returning mixed types. Not
everybody is able to write and work well in a polymorphic environment.

> Many times it is useful to return a boolean False if something doesn't
> work and the appropriate type when it does.

You can do the same with any type without mixing:

- object, return null instead of an existing object (null is still an
- string, return empty string instead of not empty string
- number, return negative number instead of a positive
- boolean, return boolean false instead of boolean true

I agree about that methodology you enforce is a shortcut most of the
time, but I would try to avoid that if possible.

> So mainly return types are mixed.
> Prototype, functions return types are mixed (but only in some
special circumstance), I don't have them enumerated and I don't know
which one does that and I don't see any documentation explaining which
one does .... :-)

Diego Perini

> --
> -----
> Richard Quadling
> Zend Certified Engineer :
> "Standing on the shoulders of some very clever giants!"
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to