Path: csiph.com!news.mixmin.net!weretis.net!feeder4.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.108.227.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Object.create(canvas.getContext()) Date: Sun, 19 Nov 2017 05:48 +0100 Organization: PointedEars Software (PES) Lines: 37 Message-ID: <10957516.O9o76ZdvQC@PointedEars.de> References: <5326256.lOV4Wx5bFT@PointedEars.de> <1754058.usQuhbGJ8B@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit Injection-Info: gwaiyur.mb-net.net; posting-host="108.227.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch:178.197.227.108"; logging-data="23636"; mail-complaints-to="abuse@open-news-network.org" User-Agent: KNode/4.14.2 X-User-ID: U2FsdGVkX1/UPSZWrhoVC8FAr68QCm8dwb+NZj3uu+dQX+4Y4btySA== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. this.define_method = function(nam,cobj,cfun){ > > this[nam] = function() { return cfun.apply(cobj,arguments); }; > > }; > > this.inherit_methods = function(o) { > > for (var i in o) { if (typeof(o[i])=="function") { > > this.define_method(i,o,o[i]); > > };};}; > > > this.inherit_methods(gl); > > Looks much more human readable to me. YMMV. But your code is also much more error-prone (and lacks code style). For example, there is a reason why I enclosed the host object property access in a “try” block. >>> that don't have anything to do with webgl. >> Yes, it is a general approach. Your point being? > > ? I do not understand that question. -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.