scripting: implement prototype definition and re-use