Comment #5 on issue 22 by [email protected]: JavaScript JSONTemplate cannot  
be prototyped
http://code.google.com/p/json-template/issues/detail?id=22

So, I went to apply this patch, but I need something to write in the unit  
test to
verify it.

This got me down this rathole of trying to understand all of JavaScript's  
idioms for
inheritance, e.g. http://javascript.crockford.com/prototypal.html and
http://brehaut.net/miscellany/Development/Javascript/Crockford_vs_Base2,  
etc.

I think what you're initially suggesting is just to do:

jsontemplate.Template.prototype.writeToFile = function (filename) {
   ...
}

or

jsontemplate.Template.prototype.expand = function (filename) {
   ...
}

I'm not sure I want to recommend this to people because it's a global  
mutation that
can break other modules using jsontemplate.  It's not a big deal for smaller
programs, but the implementation is also meant to be used with server side  
JS, and
thus larger programs.

So what inheritance idiom do you have in mind for people who don't want to  
directly
modify jsontemplate.Template.protoype?  Can you provide this code with the  
patch?

Crockford's solution seems to involve his special Object.create method, and  
it seems
like a bad idea to foist this on people.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON 
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to