prof.jsECMAScript 262-5th based JavaScript       Dynamic TypeSystem. with Trace and Profiling functions
function mm_each(data, // @arg Object/Function/Array/Hash: data                 fn) { // @arg Function: callback function ...
function mm_each(data, // @arg Object/Function/Array/Hash: data                 fn) { // @arg Function: callback function ...
Aspect-Oriented Programming)
•    –    –    –    –        •        ••    –•    –
mm.each = function() {    switch (引数の数) {    case 3: mm.allow(arguments[2], "2番目の引数の型");    case 2: mm.allow(arguments[1],...
mm.each = function() {    switch (引数の数) {    case 3: mm.allow(arguments[2], "2番目の引数の型");    case 2: mm.allow(arguments[1],...
mm.each = function() {    switch (引数の数) {    case 3: mm.allow(arguments[2], "2番目の引数の型");    case 2: mm.allow(arguments[1],...
mm.each = function() {    switch (引数の数) {    case 3: mm.allow(arguments[2], "2番目の引数の型");    case 2: mm.allow(arguments[1],...
•    –    –
•      –      –// ライブラリ(lib)のAPIの型情報を登録prof.add(    lib.fn1(),    lib.fn2(a:Integer/String = ",", b:Object):Object,    lib...
<script src="debug/prof.js"></script><script src="mm.js"></script><!-- mm.js は  mm.allow で動的な型チェックを使う場合に必要 --><script>prof...
• mofmof.js   – http://code.google.com/p/mofmof-js/• prof.js   – http://code.google.com/p/mofmof-     js/source/browse/tru...
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Prof.js
Upcoming SlideShare
Loading in …5
×

Prof.js

1,302 views

Published on

see http://uupaa.hatenablog.com/entry/2012/10/31/221550

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,302
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Prof.js

  1. 1. prof.jsECMAScript 262-5th based JavaScript Dynamic TypeSystem. with Trace and Profiling functions
  2. 2. function mm_each(data, // @arg Object/Function/Array/Hash: data fn) { // @arg Function: callback function // @help: mm.each // @desc: each object//{@debug mm.allow(data, "Object/Function/Array/Hash"); mm.allow(fn, "Function");//}@debug typeof data.each === "function" ? data.each(fn) : Object_each(data, fn);}
  3. 3. function mm_each(data, // @arg Object/Function/Array/Hash: data fn) { // @arg Function: callback function // @help: mm.each // @desc: each object//{@debug// mm.allow(data, "Object/Function/Array/Hash");// mm.allow(fn, "Function");//}@debug typeof data.each === "function" ? data.each(fn) : Object_each(data, fn);}//{@debugprof.add( "mm.each(data:Object/Function/Array/Hash, fn:Function");//}@debug
  4. 4. Aspect-Oriented Programming)
  5. 5. • – – – – • •• –• –
  6. 6. mm.each = function() { switch (引数の数) { case 3: mm.allow(arguments[2], "2番目の引数の型"); case 2: mm.allow(arguments[1], "1番目の引数の型"); case 1: mm.allow(arguments[0], "0番目の引数の型"); } console.group("関数名"); var now = Date.now(); var rv = org_mm_each.apply(mm, arguments); _tm[path].time += (Date.now() - now); _tm[path].count++; console.groupEnd(); mm.allow(rv, "戻り値の型"); return rv;};
  7. 7. mm.each = function() { switch (引数の数) { case 3: mm.allow(arguments[2], "2番目の引数の型"); case 2: mm.allow(arguments[1], "1番目の引数の型"); case 1: mm.allow(arguments[0], "0番目の引数の型"); } console.group("関数名"); var now = Date.now(); var rv = org_mm_each.apply(mm, arguments); _tm[path].time += (Date.now() - now); _tm[path].count++; console.groupEnd(); mm.allow(rv, "戻り値の型"); return rv;};
  8. 8. mm.each = function() { switch (引数の数) { case 3: mm.allow(arguments[2], "2番目の引数の型"); case 2: mm.allow(arguments[1], "1番目の引数の型"); case 1: mm.allow(arguments[0], "0番目の引数の型"); } console.group("関数名"); var now = Date.now(); var rv = org_mm_each.apply(mm, arguments); _tm[path].time += (Date.now() - now); _tm[path].count++; console.groupEnd(); mm.allow(rv, "戻り値の型"); return rv;};
  9. 9. mm.each = function() { switch (引数の数) { case 3: mm.allow(arguments[2], "2番目の引数の型"); case 2: mm.allow(arguments[1], "1番目の引数の型"); case 1: mm.allow(arguments[0], "0番目の引数の型"); } console.group("関数名"); var now = Date.now(); var rv = org_mm_each.apply(mm, arguments); _tm[path].time += (Date.now() - now); _tm[path].count++; console.groupEnd(); mm.allow(rv, "戻り値の型"); return rv;};
  10. 10. • – –
  11. 11. • – –// ライブラリ(lib)のAPIの型情報を登録prof.add( lib.fn1(), lib.fn2(a:Integer/String = ",", b:Object):Object, lib.fn3(...:Mix):Array, lib.fn4(a:Mix):Boolean);// ネイティブオブジェクトの動的な型チェックも可能prof.add( String#hoge(a:Mix,b:Mix,c:Mix):String);
  12. 12. <script src="debug/prof.js"></script><script src="mm.js"></script><!-- mm.js は mm.allow で動的な型チェックを使う場合に必要 --><script>prof.add("…");</script>
  13. 13. • mofmof.js – http://code.google.com/p/mofmof-js/• prof.js – http://code.google.com/p/mofmof- js/source/browse/trunk/js_src/debug/prof.js

×