Talk:Dwoo Compiler

I have a suggestion which is (for me at least) very helpful: Template testing. In Smarty it's practically impossible and way too difficult. Because Dwoo is built so incredibly OO (KUDO'S!!), it's very easy in Dwoo. I added three methods to class Dwoo, to be able to test a template, but maybe it's more suited in the Compiler class (whatever you want I guess). I don't think it can be done without altering existing classes :( (Just one) so I myself can't add it in good sense (it's rude for me to edit your code isn't it? :))

My additions:

The code I would use to test a template:

Why it can't be done without altering existing class Dwoo: Compiling the template can be done without altering any classes, but when a compiling error occurs, the CompilerException requests the Dwoo's template object and that object doesn't exist when compiling a template like I did initally (outside any class so outside the protected scope). The problem (of the missing $this->template) would be solved by making Dwoo.template public (auch!?) or by adding the 'test methods' to the protected scope (like so above).

Solution
What you should really do there is extend from Dwoo to provide your own methods in the protected namespace, i.e.:

class DwooTester extends Dwoo { public function testTemplate { $this->...    } }

Dwoo is fully extensible and as far as I know there are no classes that you can't extend/override.