On Feb 20, 2008, at 3:35 PM, P T Withington wrote:
> On 2008-02-20, at 17:20 EST, Brendan Eich wrote:
>
>> On Feb 20, 2008, at 10:17 AM, Kris Zyp wrote:
>>
>>> Is there any way this compatibility can be mitigated? I am assuming
>>> there is
>>> no conceivable way to actually replace methods ad-hoc with arbitrary
>>> functions and retain sane typing and class expectations.
>>
>> I'm not sure why you assume this. Latest RI downloaded from http://
>> ecmascript.org/ :
>
> I thought the question was about annotating class fixtures?
How could it be, since those do not exist in ES1-3?
Fixtures are in the intrinsic namespace, so yes, 'use namespace
intrinsic' will break AOP. The two do not mix, they're fundamentally
opposed to each other.
> But your reply made me think: So, built-ins cannot be classes,
> because they require backward compatibility? Or maybe I missed that
> there are sealed/class versions of built-ins (in some other
> namespace?) with just a thin veneer of prototype around them for back
> compatibility?
You can read the code ;-). Built-in constructors such as Date are
dynamic classes. Here's part of builtins/Date.es:
package
{
import ECMAScript4_Internal.*;
import JSON.*;
use default namespace public;
use namespace helper;
use namespace informative;
use namespace intrinsic;
use namespace __ES4__;
use strict;
const NOARG = {};
dynamic class Date
{
static const length = 7;
/* E262-3 15.9.2: The Date Constructor Called as a Function */
meta static function invoke(...args) // args are ignored.
(new Date()).public::toString();
/* E262-3 15.9.3: The Date Constructor. */
function Date(year=NOARG, month=NOARG, date=NOARG,
hours=NOARG, minutes=NOARG, seconds=NOARG
, ms=NOARG) {
informative::setupNanoAge();
switch (NOARG) {
etc.
Yes, typeof Date == "function" for backward compatibility. typeof is
broken and we can't fix it, but the |is| operator and the meta
objects proposal provides better alternative tools.
/be
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss