Changing the value of :layout depending on the filename starting with
an underscore sounds like a really bad API.
I simply use this:
http://github.com/monkrb/glue/blob/1a5a2ad8beb6275692394f35b3401b8b9a67ae53/lib/monk/glue.rb#L54-56
I don't think it's worth including in core, at all.
That said, if you use a helper, there's nothing stopping you from
using your own convention if you feel the need to:
!= partial :foo
!= partial :_foo
!= partial :"partials/foo"
etc.
Agreed. It's not that I want to keep a status quo, just that the
current implementation (no extra checks for "_") allows you to write
your own helper with your convention (you can subclass, define #haml,
and call super). The same wouldn't be true if we changed the
implementation.
In any case, I think template rendering code is frozen until Tilt is
integrated, so we might need to wait a little bit on that...
We use something very similar (to the Monk code) for partials, and
have never had any problems with it. Ours is also three lines of code.
I think all this does is make Sinatra act more like Rails, with no
real added value (we're talking about one more character when you're
typing in a file name here). We've implemented partials a few
different ways that don't make any sense with the underscore. For
example, we've implemented "super partials", which are partials
re-used by multiple controller routes, by putting a partials folder in
the view root.
-Kyle