Patch release of base2

20 views
Skip to first unread message

Dean Edwards

unread,
Mar 22, 2011, 11:51:18 AM3/22/11
to base2-js
I just issued a patch release for base2.

The new version is 1.0.2:

http://base2.googlecode.com/svn/version/1.0.2/

This fixes an issue in Firefox 4. Mozilla changed the way that nulls are
enumerated by Array.forEach and that broke base2 pretty badly.

The good news is that base2 has proven to be pretty robust. This is only
the second patch that I've had to release. Both patches have been
because of changes to JavaScript implementations (not DOM related).

Version 2.0 of base2 is now feature complete. I am currently preparing a
preview release. Version 2.0 is not compatible with version 1.0. The
APIs are largely the same but you will have to do some refactoring if
you want to upgrade.

-dean

doekman

unread,
Mar 22, 2011, 5:28:30 PM3/22/11
to base2-js
Quick reaction. Nice!

What I personally miss is what the exact change is.
You created a new folder under the version root folder, but the change
set does not include the changed base files.
(of course i could fetch both versions to a local disc, but with the
google tooling on the google code pages i am lost. Yes, you may call
me lazy).

Doeke

Dean Edwards

unread,
Mar 22, 2011, 6:28:15 PM3/22/11
to base...@googlegroups.com
On 22/03/2011 21:28, doekman wrote:
> Quick reaction. Nice!

It would be much nicer if the sand didn't keep shifting!

I get the feeling that this change was made by Mozilla to provide ES5
compliance. The real annoyance is that ES5 has defined behaviour that is
contrary to all current JavaScript implementations.

> What I personally miss is what the exact change is.
> You created a new folder under the version root folder, but the change
> set does not include the changed base files.
> (of course i could fetch both versions to a local disc, but with the
> google tooling on the google code pages i am lost. Yes, you may call
> me lazy).

I changed the following (line 1164 in /version/1.0.1/base2.js):

// Remove methods that are already implemented.
for (var name in INative) {
if (name != "prototype" && Native[name]) {
INative[name] = Native[name];
delete INative.prototype[name];
}
Native2[name] = INative[name];
}


to this:

// Remove methods that are already implemented.
for (var name in INative) {
if (name != "prototype" && Native[name]) {
delete INative.prototype[name];
}
Native2[name] = INative[name];
}

I'm getting rid of the JavaScript package in version 2.0 anyway. :)

-dean

doekman

unread,
Mar 23, 2011, 6:17:37 AM3/23/11
to base2-js
Hmm, I liked the Array2 and Date2 functionality.
Hate to see that go.

Anyways, I didn't use any JavaScript package functions with my Barcode
project, so I'm good ;-)

Thanks,
Doeke

Dean Edwards

unread,
Mar 23, 2011, 11:56:50 AM3/23/11
to base...@googlegroups.com
On 23/03/2011 10:17, doekman wrote:
> Hmm, I liked the Array2 and Date2 functionality.
> Hate to see that go.

The functionality is still there.

To get the functionality of Date2, you can now do this:

base2.require("Date", function() {
var Date = base2.Date;

alert(Date.now());
alert(new Date.toISOString());
alert(Date.parse("2001-01-01"));
});

If the native Date is ISO compliant then that object is used without
loading the patch. This avoids loading code that is not used on most
browsers.

What functions of Array2 are you using that you will miss? All of the
Enumerable methods are still available in the Enumerable object and in
base2's namespace:

base2.exec(function(namespace) {
eval(namespace);

var numbers = [1,2,4];
var squares = map(numbers, function(value) {
return value * value;
});
});

I'd consider providing a loader for Array that is similar to Date. But
it does pose a slightly different problem which I am happy to elaborate on.

-dean

doekman

unread,
Mar 25, 2011, 5:26:44 AM3/25/11
to base2-js
Hmm,

maybe me missing Array2 is more of a nostalgic nature.

Although: I would use contains and indexOf. I wouldn't use Enumerable
methods to accomplish that. Contains could be implemented with some,
and indexOf I don't know. I just can't get comfortable with map/reduce
for some reason...

But I don't think a require for Array2 would be appropriate: indexOf
is just not important enough for me to remember I can use it with
require: I probably write a forEach loop to get the index.

Dean Edwards

unread,
Mar 25, 2011, 3:06:27 PM3/25/11
to base...@googlegroups.com
On 25/03/2011 09:26, doekman wrote:
> Hmm,
>
> maybe me missing Array2 is more of a nostalgic nature.
>
> Although: I would use contains and indexOf. I wouldn't use Enumerable
> methods to accomplish that. Contains could be implemented with some,
> and indexOf I don't know. I just can't get comfortable with map/reduce
> for some reason...
>

Funny you should mention indexOf() as I just added it to base2.lang.
It's been in and out for a while and I've finally decide that it should
be in the core library.

contains() can be easily derived from indexOf() so you won't miss that. :)

-dean

Reply all
Reply to author
Forward
0 new messages