Helma Logo
main list history

Modules Discussion

This page is a copy of the original Modules page. While the the Modules page will assume the role of documenting the modules in Helma NG, this page will provide a place for discussion: Which modules and function should ship with helma-ng, and how they should be structured in directories and modules.

(Note: I've removed the empty module headers from the page, as they were outdated and made it harder to assess the actual content in here. -hns)


Core could be renamed to "lang" or "javascript" because all modules here are extending original Javascript objects. Mozilla docs refers to these objects as "Core" (Core JavaScript 1.5 Reference:Global Objects:Array:indexOf at http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:indexOf) in their reference. What do you think? Should we stay with "Core"? Or should we change that? (matt) +/-


prototype.js provides a bunch of neat functions: Enumerable Docs and Array Docs. prototype.js could be offered as a replacement or addition to the current array.js -> see /sandbox/aida/modules/javascript/prototype.js


works, but could be replaced by prototype.js>Enumerable>include ; see: http://www.prototypejs.org/api/enumerable/include, for compaitibility reasons we could add a conatains alias


Has a bug when the source objects look similar, but are not

 var obj1 = {test:"one"};
 var obj2 = {test:"one"};
 (obj1 != obj2) === true;
 var arr1 = [obj1];
 var arr2 = [obj2];
 Array.union(arr1, arr2); // => [{test:"one"}]
                          //    instead of [{test:"one"}, {test:"one"}]

Array.union could be replaced by using the prototyp.js .uniq() function. It's not very fast, but it works like expected.

 // replacement using prototype.js
 var result = arr1.concat(ar2).uniq();
 // or:
 Array.union = function() {
   var r = [];
      $A(arguments).forEach(function(arr) { r = r.concat(arr).uniq() });
      return r;

not tested yet

 // replacement using prototype.js
 var result = arr1.intersect(ar2).uniq();