May 9, 2007
Like Haml, a work in progress...
We have readers checking this blog, asking what we are working on, how things are coming, or when we will do X? So I feel like we should post an update to briefly talk about what we are up to. We currently aren't spending much time on company details (thankfully, much of it is now taken care of), and we are getting into coding. We have a pretty good idea of what features we will be trying to complete for the first release. We are currently trying to build the simplest version that will be useful. I think we have made good progress towards that goal.
Personally, I feel like my mind is starting to finally switch gears into the whole new project, language, and framework. I was expecting some downtime as my head flipped from the projects I was working on to this project, but it hasn't been as bad as I was expecting. Today I think I was actually so deep and focused on the code that I wasn't aware of anything going on around me. I think it is a good sign that I am starting to really get into the zone on our new project.
As far as the specifics of the code on our project, I don't feel like there much I can reveal. We have been writing, refactoring, and reworking the code, along the way we have discovered some ups and downs of the ruby and rails. Hopefully, we will be able to share more about our discoveries when we get to a more stable and battle-tested code base.
I will mention briefly one specific issue we have run into with RoR: the templating engine Haml. We started working with Haml templates for some of our more complicated views. It was making the more complex views simpler, easier to read, and reducing LOC. Unfortunately we started to get some cryptic errors related to Haml, and we saw that Haml is still young and actively changing. On one occasion new Haml updates caused errors in our code. After spending some time tracking down the issues on a few occasions, we decided that Haml, while very cool, isn't quite stable enough for our project. Since it is fairly easy to convert views back and forth between Haml and rhtml, we decided we would drop Haml for now. We are planning to take another look at it later after our changes slow down a bit, and see if the Haml project is a little more stable. For now, while nice, it just doesn't provide a large enough benefit to deal with the extra debugging issues that have occurred. If you are working with RoR, I would recommend checking the project out, because it is definitely worth keeping your eye on.
Posted by Dan at May 9, 2007 11:59 PMAs a Haml developer, I'm curious to hear more details about what went wrong. It sounds like what you're talking about are things that definitely shouldn't have happened, and thus something that I'd like to fix.
Posted by: Nathan at May 10, 2007 3:39 AMThere are two specific errors that come to mind. The first was after our SVN pulled in some new Haml code we had a couple files that in sections used acts as authenticated (http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated) checking
"if logged_in?" while this worked in most Haml files other it randomly would not know what the logged_in was. Oddly enough this error never occurred while running in the development version but would pop up while running tests against the project.
Another problem was related to rendering partials that were in Haml and then moving back to rhtml. Occasionally the spacing in the rhtml would then effect if the file could be parsed. his error would throw some odd errors: that originally had us looking through the rails stack before noticing it was caused by Haml. See an example of the error below. (This error we submitted to the group)
I just want to be clear we really like Haml and plan to keep checking in on the project and hopefully as our views become a little more stable and aren't changing on a daily bases we will switch some of the most complicated views back over to Haml.
Ruby version: 1.8.5 [i686-darwin8.8.1]
Rails version: Rails 1.2.3
Haml version: Revision 510
Repro
---------------------
test_controller.rb:
class TestController 'testpartial', :object => nil, :locals =>
{:item => "foo"} %>
'test', :action => 'test' do %>
--------
Note that the above code works fine. However, if you indent the
following lines
'test', :action => 'test' do %>
you get the following error
ArgumentError in Test#test
Showing app/views/test/test.rhtml where line #4 raised:
comparison of Fixnum with nil failed
Extracted source (around line #4):
1: Test
2: 'testpartial', :object => nil, :locals =>
{:item => "foo"} %>
3:
4: 'test', :action => 'test' do %>
5:
6:
7:
RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/whiny_nil.rb:35:in `>'
vendor/plugins/haml/lib/haml/helpers.rb:300:in
`capture_erb_with_buffer'
vendor/plugins/haml/lib/haml/helpers.rb:297:in `each'
vendor/plugins/haml/lib/haml/helpers.rb:297:in
`capture_erb_with_buffer'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/
helpers/capture_helper.rb:67:in `capture'
/opt/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_view/
helpers/form_tag_helper.rb:51:in `form_tag_without_haml'
vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb:57:in
`form_tag'
#{RAILS_ROOT}/app/views/test/test.rhtml:4:in
`_run_rhtml_47app47views47test47test46rhtml'
I'm not sure what's up with the first error - I'd need some way to test it in order to debug it. The second error is a bug that's been brought up elsewhere - I just fixed it in trunk.
Posted by: Nathan at May 12, 2007 3:37 PMVery cool, perhaps I can create a tiny example of the first error which shows what is going on.
That says good things about the Haml code that the second error could be tracked and fixed so quickly. We will be taken another look at Haml a bit later for now we are trying to focus on finishing up our current feature set.
Posted by: Dan at May 13, 2007 1:22 PM
