Quick demonstration in a sidebar.php file (from Pindol theme). The change I make avoids an error when using WTG Portal Manager to automatically apply sidebars to pages that have a relationship with a portal. I'm finding the WordPress sidebar system inflexible while creating my portal plugin and theme edits may be required often.
However I do have a plan to get around it by making the plugin work with the themes data. Problem with that is I'll need to integrate on a per theme basis.
In short we have the best example of plugin and theme not working well together because the core does not support what I'm trying to do. Which is proper dynamic sidebars controlled by a plugin rather than the theme. The problem with a theme creating sidebars is the sidebars are no longer registered (they vanish) if the theme is disabled/removed.
I give it a couple of years and there will be floods of people asking how to migrate registered sidebars to a new theme or into a plugin or hopefully into a new core system which allows us to create custom sidebars.