josephwilk/pronounce — pull request #5 by gwagener (2013-05-31 22:59:07+00:00)
Title: WIP Syllable rule DSL

I haven't finished retrofitting all the existing rules to use the DSL, but it's definitely time this got some feedback. I especially would like some thoughts on the use of `convert_to_lambda`. Because rules are defined with blocks it won't be clear that they act as lambdas for `return` statements. One alternative would be to require them to be declared as lambdas, but the expectation with a DSL is that it will just take a block. Another alternative would be to leave them as blocks and rearrange the logic in them to not use explicit `return`s. The downside of that is that it would make guard clauses in rules a bit uglier. For example SSP would become:

```ruby
if context.current_phone.syllabic? && !context.previous_phone_in_onset?
true
elsif context.word_end?
false
else
context.previous_phone_in_coda? || context.sonority_trough?
end
```

Opinions on those options or suggestions of others would be great!