On 27 January 2011 10:34, Marc Chantreux <khatar / phear.org> wrote:
> On Thu, Jan 27, 2011 at 04:16:50PM +0900, Vý’ Ondruch wrote:
>> Ruby code tends to be readable as plain English.
>> You never write punctuation on the beginning of line, so does Ruby.
>
> i heard the same in perl world but my coworkers finally gave a try to my
> coding style: want to write code as natural as possible must serve
> readability and avoid errors. It doesn't in this case:
>
> you can't see the error immediatly in this code
>
> options = {
> registry_dir => '/usr/share/vim/registry' ,
> source_dir => '/usr/share/vim/addons' ,
> system_dir => '/var/lib/vim/addons'
> target_dir => File.join(ENV['HOME'], '.vim') ,
> query > false,
> system_wide > false,
> }
>
> you'll do in this one
>
> options =
> { :registry_dir => '/usr/share/vim/registry'
> , :source_dir => '/usr/share/vim/addons'
> system_dir => '/var/lib/vim/addons'
> , :target_dir => File.join(ENV['HOME'], '.vim')
> , :query > false
> , :system_wide > false
> }
>
> regards
> marc

Yes, but anyway the parser will show you a parse error indicating the
line just under:
tmp.rb:5: syntax error, unexpected tSYMBEG, expecting '}'
   :target_dir   => File.join(ENV['HOME'], '.vim') ,
    ^

The error could probably be more explicit, but I think it is fine
considering how often these errors happen.