[MonoDevelop] Some changes to ambiences

Michael Hutchinson m.j.hutchinson at gmail.com
Sat Nov 29 14:37:22 EST 2008


On Sat, Nov 29, 2008 at 2:23 AM, Mike Krüger <mkrueger at novell.com> wrote:
> in the public api and all helper methods became helper properties in the
> settings. But the main problem was not the API usability (we've enough
> 'examples' of using ambiences (monkey see/monkey do learning)) the main

It's still nice to have that usability ourselves :)

> problem was the limitation of the visitor pattern.
> The visitor pattern was the bad guy here. Therefore I changed the
>
> IDomVisitor {
> object Visit (Something something, object data);
> ..
> }
>
> to
>
> IDomVisitor<T, S> {
> S Visit (Something something, T data);
> ..
> }
>
> and the ambiences are using an 'IDomVisitor<OutputSettings, string>'. So
> all methods are now looking like:
>
> public string Visit (IProperty property, OutputSettings settings)
> {
>  ...
> }
>
> I think this'll solve all issues I had with using strong typing and will
> also solve some issues with the visitor pattern. No more objects
> floating around/no boxing/no ugly upcasts.
> Maybe we should introduce typed visitors in nrefactory as well, but
> that's a complete different story.

Ah, fantastic! I hadn't realised it was possible to generically type a
visitor's data argument.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list