[frogs] Re: T1055: Avoid using deprecated %module-public-interface in guile initialisation. (issue1160044)

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


On 2010/05/15 21:39:39, Patrick McCarty wrote:
On 2010/05/15 19:56:47, Ian Hulin wrote:
> On 2010/05/14 03:23:55, hanwenn wrote:
> >
> > rather than
> >
> >   SCM x = ..;
> >   SCM y = ..;
> >
> >   z = foo(x);
> >   call(y);
> >
> > do
> >
> >
> >   SCM x = ..;
> >   z = foo(x);
> >
> >   SCM y = ..;
> >   call(y);
> >
> > i.e. declare vars just before their first use.
>
> I really don't like interlacing data declarations with
> executable code, and I'd have felt happier if all the
> declarations were at the top of the function separate from the
> code. . .  I've coded it as I have so only the relevant changes
> show up, even though I personally disagree with the existing
> coding style.  We obviously come from opposing schools of
> programming style so if it doesn't affect the functionality
> we'll have to agree to differ on this one.

Hi Ian,

If the location at which a variable is declared/initialized is so
close to its place of usage, why bother putting the declarations
at the top of a block?

IMO, it's not worth going through the trouble of separating
everything unless it's necessary.  From my experience, it
decreases code readability.  I would do it like this:

   SCM maker = ly_lily_module_constant ("make-module");
   mod = scm_call_0 (maker);

   SCM module_export_all_x = ly_lily_module_constant
("module-export-all!");
   scm_call_1 (module_export_all_x, mod);

   SCM scm_module = ly_lily_module_constant ("the-scm-module");
   ly_use_module (mod, scm_module);
   ly_use_module (mod, global_lily_module);

I'll reluctantly conform if that's the house style, but it needs to be
documented as a standard in the Contributors Guide.

I've added the comments so hopefully another maintainer would find it
simple to see what's going on without having to bother Han-Wen or the
developers' list.

Cheers,
Ian

http://www.codereview.appspot.com/1160044/show

---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/