emberjs/ember.js — pull request #661 by christophersansone (2012-04-06 18:41:38+00:00)
Title: Makes yield blocks optional

I have been using the {{yield}} helper extensively to build some reusable controls, and it works great. However, sometimes when a control is used, it may not need to specify a block to be yielded. Ember currently requires a block to be specified. If you write a view containing a {{yield}} block as...

```
{{view View.With.Yield}}
```

... it will throw:

```
You called yield on [view] without supplying a template
```

You can work around it today by writing it as:

```
{{#view View.With.Yield}}{{/view}}
```
This works because an empty template is created... but this seems unnecessary from both a coding standpoint and a performance standpoint.

This pull request prevents the exception from being thrown and instead simply renders nothing when {{yield}} is specified without a corresponding block.

The {{yield}} functionality certainly seems to be inspired by Ruby's implementation of yielding, and Ruby does not force a block to be specified. In my opinion, Ember should not either.