[Javascript] Try and Catch Question
Scott Reynen
scott at randomchaos.com
Tue Mar 10 10:35:52 CDT 2009
On [Mar 10], at [ Mar 10] 8:28 , Troy III Ajnej wrote:
> ECMAScript is not a brower Script.
There's certainly a difference between spec and implementation, but
you seem to be wrong in both contexts, so I don't see how that's
relevant. Can you point to a single browser that treats catch like
other functions? For example, do any browsers return "function" for
typeof catch? Or allow you to assign catch to a variable? Or really
do anything resembling a function beyond taking parameters? Do you
also contend if, while, and for are functions?
> In addition:The try\catch()\finally algo is still, not a part of ECMA.
It's in the ECMAScript spec, right where Benjamin pointed to it.
>> All "functions" in ECMAScript are objects. "catch" is not an object.
>
> False...
If you read the ECMAScript spec, you'll find this:
> 10.1.1 Function Objects
> There are two types of Function objects:
> • Program functions are defined in source text by a
> FunctionDeclaration or created dynamically either
> by using a FunctionExpression or by using the built-in Function
> object as a constructor.
> • Internal functions are built-in objects of the language, such as
> parseInt and Math.exp. An
> implementation may also provide implementation-dependent internal
> functions that are not described
> in this specification. These functions do not contain executable
> code defined by the ECMAScript
> grammar, so they are excluded from this discussion of execution
> contexts.
That covers all of the different functions you mentioned, and they're
all objects.
> Every object is not a function
No one said they were.
> and not all (buillt in) functions may be
>
> objects.
Can you point to anything beyond your own words supporting your
arguments?
Peace,
Scott
More information about the Javascript
mailing list