the isObject test does not check the type of the object, but it's
constructor. check the test case. [] will not return true. {} will.
On Nov 27, 7:06 pm, Andrew Dupont <[EMAIL PROTECTED]> wrote:
> I don't know how useful Object.isObject would be, since it could
> arguably return true for anything that reports its type as "object."
> Otherwise we'd be using some different definition of "object," and
> that would violate POLS.
>
> And I can't imagine a use case for Object.isBoolean -- you've got the
> strict equivalence operator (===) for when you need to check for
> "true" or "false." Plus, how often do you need to know if something
> merely is a boolean, rather than if it's explicitly true or false?
if (Object.isBoolean(arg)) { if (arg) .... }
or
if (arg === true || arg === false) { if (arg) ... }
take your pick. I thought all of these isFoo methods were test for
checking what type the argument is, rather than checking its value. If
a function can take an argument, and you'd expect to get a boolean in
some cases, but an object in others, what would you do?
>
> Naturally, I'm just thinking out loud and am not trying to make an
> official pronouncement.
>
> Cheers,
> Andrew
>
> On Nov 24, 11:32 am, Viktor Kojouharov <[EMAIL PROTECTED]> wrote:
>
> > I've submitted a patch to trac for your consideration, which adds
> > array slices a' la Rubyhttp://dev.rubyonrails.org/ticket/10268
>
> > And another one which adds the missing isObject and isBoolean
> > methodshttp://dev.rubyonrails.org/ticket/10269
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---