On 27 January 2011 10:34, Marc Chantreux <khatar / phear.org> wrote:
> On Thu, Jan 27, 2011 at 04:16:50PM +0900, V=EDt 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 =3D {
> =A0 =A0:registry_dir =3D> '/usr/share/vim/registry' ,
> =A0 =A0:source_dir =A0 =3D> '/usr/share/vim/addons' ,
> =A0 =A0:system_dir =A0 =3D> '/var/lib/vim/addons'
> =A0 =A0:target_dir =A0 =3D> File.join(ENV['HOME'], '.vim') ,
> =A0 =A0:query =A0 =A0 =A0 =A0=3D> false,
> =A0 =A0:system_wide =A0=3D> false,
> }
>
> you'll do in this one
>
> options =3D
> { :registry_dir =3D> '/usr/share/vim/registry'
> , :source_dir =A0 =3D> '/usr/share/vim/addons'
> =A0:system_dir =A0 =3D> '/var/lib/vim/addons'
> , :target_dir =A0 =3D> File.join(ENV['HOME'], '.vim')
> , :query =A0 =A0 =A0 =A0=3D> false
> , :system_wide =A0=3D> 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   =3D> File.join(ENV['HOME'], '.vim') ,
    ^

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