SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Power Assert
YAPC::ASIA 2013, 9/20, Kanagawa
Fuji Goro (gfx) <gfuji@cpan.org>
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
myself
Working at COOKPAD, Inc.
Rubyist / Androider / JSXer
CPAN:
Xslate
Mouse
Plack::Middleware::DevFavicon
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Power Assert
http://dontmindthelanguage.wordpress.com/
2009/12/11/groovy-1-7-power-assert/
Invented in Groovy
Ported to JavaScript by @t_wata, 2013
Ported to Perl by @tokurhiom, 2013
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Test::Power
expect { $x->is_foo }
expect { $x->foo eq ‘bar’ }
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
FAILURE MESSAGES
not ok 1 - L7 : expect { $h->foo->bar == 42 };
# $h->foo
# => undef
# $h
# => bless( {}, 'main' )
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
END
Part 1. End.
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Part 2.
perl.js - Perl 5.18.1 running on browsers
build with emscripten
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Demo
http://gfx.github.io/perl.js/
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Emscripten
LLVM to JavaScript compiler
Compile LLVM bitcode into JavaScript
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Emscripten
Use JavaScript as a machine code
Like a kernel & CPU, not an emulator nor
translator
All the syscalls are implemented in the
emscripten runtime libraries
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
For example: fork(2)
// src/library.js
fork: function() {
// pid_t fork(void);
// We don't support multiple
processes.
___setErrNo(ERRNO_CODES.EAGAIN);
return -1;
},
Most POSIX syscalls are just dummies :(
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
utime(2)
// src/library_fs.js
utime: function(path, atime, mtime) {
var lookup = FS.lookupPath(path,
{ follow: true });
var node = lookup.node;
node.node_ops.setattr(node, {
timestamp: Math.max(atime, mtime)
});
},
Emscripten has a virtual file system
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
BuilD PERL
Write own Makefile based on Makefile.micro
cf. pl! - Perl 5.16.3 based emscripten-ed perl
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Problems
Does not support call main() more than twice
exit() closes stdin, stdout, stderr but there’s
no way to open them again
Fatal errors which cause abort() breaks the
internal state, which then needs to reload the
page (the JavaScript interpreter)
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
Conclusion
Use emscripten for C/C++ applications
Write once, run everywhere
13年9月20日金曜日
perl.js Fuji Goro (gfx) YAPC::Asia 2013
END
http://github.com/gfx/perl.js
13年9月20日金曜日

Contenu connexe

Tendances

Batch processing and Stream processing by SQL
Batch processing and Stream processing by SQLBatch processing and Stream processing by SQL
Batch processing and Stream processing by SQL
SATOSHI TAGOMORI
 

Tendances (20)

秋のVim祭り Rubyを添えて
秋のVim祭り Rubyを添えて秋のVim祭り Rubyを添えて
秋のVim祭り Rubyを添えて
 
ちょっと怖くなくったRails
ちょっと怖くなくったRailsちょっと怖くなくったRails
ちょっと怖くなくったRails
 
Crystalskullを改造してみる
Crystalskullを改造してみるCrystalskullを改造してみる
Crystalskullを改造してみる
 
カーネル VM懇親会LT
カーネル VM懇親会LTカーネル VM懇親会LT
カーネル VM懇親会LT
 
Emacsでの翻訳 - Emacsで訳す、gettextで国際化されたソフトウェア
Emacsでの翻訳 - Emacsで訳す、gettextで国際化されたソフトウェアEmacsでの翻訳 - Emacsで訳す、gettextで国際化されたソフトウェア
Emacsでの翻訳 - Emacsで訳す、gettextで国際化されたソフトウェア
 
UniRx勉強会 reactive extensions inside(公開用)
UniRx勉強会   reactive extensions inside(公開用)UniRx勉強会   reactive extensions inside(公開用)
UniRx勉強会 reactive extensions inside(公開用)
 
20220412 IoTLT vol86 kitazaki v1
20220412 IoTLT vol86 kitazaki v120220412 IoTLT vol86 kitazaki v1
20220412 IoTLT vol86 kitazaki v1
 
分散バージョン管理システムって何なん 20101218
分散バージョン管理システムって何なん 20101218分散バージョン管理システムって何なん 20101218
分散バージョン管理システムって何なん 20101218
 
こんにちはGroovy
こんにちはGroovyこんにちはGroovy
こんにちはGroovy
 
git-svnつかってみる?
git-svnつかってみる?git-svnつかってみる?
git-svnつかってみる?
 
Batch processing and Stream processing by SQL
Batch processing and Stream processing by SQLBatch processing and Stream processing by SQL
Batch processing and Stream processing by SQL
 
FPGAスタートアップ資料
FPGAスタートアップ資料FPGAスタートアップ資料
FPGAスタートアップ資料
 
Ras piでrt linux
Ras piでrt linuxRas piでrt linux
Ras piでrt linux
 
Gitで開発するなら知っておいて損はないいくつかのこと
Gitで開発するなら知っておいて損はないいくつかのことGitで開発するなら知っておいて損はないいくつかのこと
Gitで開発するなら知っておいて損はないいくつかのこと
 
Linuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書くLinuxのユーザーランドをinitから全てまるごとgolangで書く
Linuxのユーザーランドをinitから全てまるごとgolangで書く
 
loggregator update
loggregator updateloggregator update
loggregator update
 
組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ組み込みLinuxでのGolangのススメ
組み込みLinuxでのGolangのススメ
 
Cloud Foundryのコンポーネントloggregatorについて
Cloud FoundryのコンポーネントloggregatorについてCloud Foundryのコンポーネントloggregatorについて
Cloud Foundryのコンポーネントloggregatorについて
 
pkgsrc とは何か? - よもやま話
pkgsrc とは何か? - よもやま話pkgsrc とは何か? - よもやま話
pkgsrc とは何か? - よもやま話
 
MPSoCのPLの性能について
MPSoCのPLの性能についてMPSoCのPLの性能について
MPSoCのPLの性能について
 

Similaire à Power Assert and perl.js

Stream processing and Norikra
Stream processing and NorikraStream processing and Norikra
Stream processing and Norikra
SATOSHI TAGOMORI
 
大(中)規模Java script開発について
大(中)規模Java script開発について大(中)規模Java script開発について
大(中)規模Java script開発について
Yuki Tanaka
 
Scala2.10.x bytecode problems in Android
Scala2.10.x bytecode problems in AndroidScala2.10.x bytecode problems in Android
Scala2.10.x bytecode problems in Android
Taisuke Oe
 
Node.js - JavaScript Thread Programming
Node.js - JavaScript Thread ProgrammingNode.js - JavaScript Thread Programming
Node.js - JavaScript Thread Programming
takesako
 

Similaire à Power Assert and perl.js (20)

最近僕が使うようになったPerl 5.10以降の新しいやつ
最近僕が使うようになったPerl 5.10以降の新しいやつ最近僕が使うようになったPerl 5.10以降の新しいやつ
最近僕が使うようになったPerl 5.10以降の新しいやつ
 
PhpStormとGrunt.jsで作るCakePHP快適開発環境
PhpStormとGrunt.jsで作るCakePHP快適開発環境 PhpStormとGrunt.jsで作るCakePHP快適開発環境
PhpStormとGrunt.jsで作るCakePHP快適開発環境
 
groovy 2.1.0 20130118
groovy 2.1.0 20130118groovy 2.1.0 20130118
groovy 2.1.0 20130118
 
Hadoop-3.2.0の新機能の紹介とJava9+対応のコミュニティ動向
Hadoop-3.2.0の新機能の紹介とJava9+対応のコミュニティ動向Hadoop-3.2.0の新機能の紹介とJava9+対応のコミュニティ動向
Hadoop-3.2.0の新機能の紹介とJava9+対応のコミュニティ動向
 
memcached proxy server development and operation
memcached proxy server development and operationmemcached proxy server development and operation
memcached proxy server development and operation
 
React Native GUIDE
React Native GUIDEReact Native GUIDE
React Native GUIDE
 
Apacheの展望とmod_perlの超絶技巧 #yapcasia
Apacheの展望とmod_perlの超絶技巧 #yapcasiaApacheの展望とmod_perlの超絶技巧 #yapcasia
Apacheの展望とmod_perlの超絶技巧 #yapcasia
 
New features of Groovy 2.0 and 2.1
New features of Groovy 2.0 and 2.1New features of Groovy 2.0 and 2.1
New features of Groovy 2.0 and 2.1
 
JavaScript.Next
JavaScript.NextJavaScript.Next
JavaScript.Next
 
Stream processing and Norikra
Stream processing and NorikraStream processing and Norikra
Stream processing and Norikra
 
今日からはじめるGPars
今日からはじめるGPars今日からはじめるGPars
今日からはじめるGPars
 
JavaScript (ECMAScript) 2013
JavaScript (ECMAScript) 2013JavaScript (ECMAScript) 2013
JavaScript (ECMAScript) 2013
 
GContractsの基礎
GContractsの基礎GContractsの基礎
GContractsの基礎
 
Kanazawa.js.Next
Kanazawa.js.NextKanazawa.js.Next
Kanazawa.js.Next
 
大(中)規模Java script開発について
大(中)規模Java script開発について大(中)規模Java script開発について
大(中)規模Java script開発について
 
C#でOpenCL with OpenTK + Cloo
C#でOpenCL with OpenTK + ClooC#でOpenCL with OpenTK + Cloo
C#でOpenCL with OpenTK + Cloo
 
Scala2.10.x bytecode problems in Android
Scala2.10.x bytecode problems in AndroidScala2.10.x bytecode problems in Android
Scala2.10.x bytecode problems in Android
 
three.js はじめましょ
three.js はじめましょthree.js はじめましょ
three.js はじめましょ
 
Node.js - JavaScript Thread Programming
Node.js - JavaScript Thread ProgrammingNode.js - JavaScript Thread Programming
Node.js - JavaScript Thread Programming
 
(JP) GPGPUがPostgreSQLを加速する
(JP) GPGPUがPostgreSQLを加速する(JP) GPGPUがPostgreSQLを加速する
(JP) GPGPUがPostgreSQLを加速する
 

Plus de Goro Fuji (6)

Xslate sv perl-2013-7-11
Xslate sv perl-2013-7-11Xslate sv perl-2013-7-11
Xslate sv perl-2013-7-11
 
Jsx language-notes
Jsx language-notesJsx language-notes
Jsx language-notes
 
Inside frogc in Dart
Inside frogc in DartInside frogc in Dart
Inside frogc in Dart
 
Let's use Xslate - Osdc.tw 2011
Let's use Xslate - Osdc.tw 2011Let's use Xslate - Osdc.tw 2011
Let's use Xslate - Osdc.tw 2011
 
How Xslate Works
How Xslate WorksHow Xslate Works
How Xslate Works
 
Perl Parser Hacks vol.2
Perl Parser Hacks vol.2Perl Parser Hacks vol.2
Perl Parser Hacks vol.2
 

Power Assert and perl.js

  • 1. Power Assert YAPC::ASIA 2013, 9/20, Kanagawa Fuji Goro (gfx) <gfuji@cpan.org> 13年9月20日金曜日
  • 2. perl.js Fuji Goro (gfx) YAPC::Asia 2013 myself Working at COOKPAD, Inc. Rubyist / Androider / JSXer CPAN: Xslate Mouse Plack::Middleware::DevFavicon 13年9月20日金曜日
  • 3. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Power Assert http://dontmindthelanguage.wordpress.com/ 2009/12/11/groovy-1-7-power-assert/ Invented in Groovy Ported to JavaScript by @t_wata, 2013 Ported to Perl by @tokurhiom, 2013 13年9月20日金曜日
  • 4. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Test::Power expect { $x->is_foo } expect { $x->foo eq ‘bar’ } 13年9月20日金曜日
  • 5. perl.js Fuji Goro (gfx) YAPC::Asia 2013 FAILURE MESSAGES not ok 1 - L7 : expect { $h->foo->bar == 42 }; # $h->foo # => undef # $h # => bless( {}, 'main' ) 13年9月20日金曜日
  • 6. perl.js Fuji Goro (gfx) YAPC::Asia 2013 END Part 1. End. 13年9月20日金曜日
  • 7. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Part 2. perl.js - Perl 5.18.1 running on browsers build with emscripten 13年9月20日金曜日
  • 8. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Demo http://gfx.github.io/perl.js/ 13年9月20日金曜日
  • 9. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Emscripten LLVM to JavaScript compiler Compile LLVM bitcode into JavaScript 13年9月20日金曜日
  • 10. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Emscripten Use JavaScript as a machine code Like a kernel & CPU, not an emulator nor translator All the syscalls are implemented in the emscripten runtime libraries 13年9月20日金曜日
  • 11. perl.js Fuji Goro (gfx) YAPC::Asia 2013 For example: fork(2) // src/library.js fork: function() { // pid_t fork(void); // We don't support multiple processes. ___setErrNo(ERRNO_CODES.EAGAIN); return -1; }, Most POSIX syscalls are just dummies :( 13年9月20日金曜日
  • 12. perl.js Fuji Goro (gfx) YAPC::Asia 2013 utime(2) // src/library_fs.js utime: function(path, atime, mtime) { var lookup = FS.lookupPath(path, { follow: true }); var node = lookup.node; node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) }); }, Emscripten has a virtual file system 13年9月20日金曜日
  • 13. perl.js Fuji Goro (gfx) YAPC::Asia 2013 BuilD PERL Write own Makefile based on Makefile.micro cf. pl! - Perl 5.16.3 based emscripten-ed perl 13年9月20日金曜日
  • 14. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Problems Does not support call main() more than twice exit() closes stdin, stdout, stderr but there’s no way to open them again Fatal errors which cause abort() breaks the internal state, which then needs to reload the page (the JavaScript interpreter) 13年9月20日金曜日
  • 15. perl.js Fuji Goro (gfx) YAPC::Asia 2013 Conclusion Use emscripten for C/C++ applications Write once, run everywhere 13年9月20日金曜日
  • 16. perl.js Fuji Goro (gfx) YAPC::Asia 2013 END http://github.com/gfx/perl.js 13年9月20日金曜日