On Thu, Sep 26, 2013 at 12:40 PM, Jose A. Lopes <[email protected]>wrote:

> On Thu, Sep 26, 2013 at 11:35:53AM +0200, Thomas Thrainer wrote:
> > On Thu, Sep 26, 2013 at 11:29 AM, Jose A. Lopes <[email protected]
> >wrote:
> >
> > > Modify Hs2Py constants to include a comment in the generated comments
> > > describing the source of those constants.
> > >
> > > Signed-off-by: Jose A. Lopes <[email protected]>
> > > ---
> > >  src/Ganeti/Hs2Py/GenConstants.hs | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/src/Ganeti/Hs2Py/GenConstants.hs
> > > b/src/Ganeti/Hs2Py/GenConstants.hs
> > > index 085b0dc..38db1e5 100644
> > > --- a/src/Ganeti/Hs2Py/GenConstants.hs
> > > +++ b/src/Ganeti/Hs2Py/GenConstants.hs
> > > @@ -35,7 +35,8 @@ genList name consNames = do
> > >    sig <- sigD name [t| [(String, String)] |]
> > >    fun <- funD name [clause [] (normalB cons) []]
> > >    return [sig, fun]
> > > -  where mkString n = stringE (deCamelCase (nameBase n))
> > > +  where comm n = "# Generated automatically from Haskell constant " ++
> > > show n
> > >
> >
> > Would it be a problem to mention the source file as well? This could help
> > contributors a lot (not everybody knows where to look if you say "Haskell
> > constant").
>
> The constant names appear qualified, so I thought they could find the
> source name through the module name.  For example,
>
>   # Generated automatically from Haskell constant
> Ganeti.HsContants.configMajor


> What do you think ?
>

Well, the average Python programmer might not know that he has to look in
src/Ganeti/HsConstants.hs just because of this comment. Pointing him to
HsConstants.hs would make his live easier (he could just search for the
file...).
But if that's tricky to do (because different constants are in different
files or such), don't bother wasting time on this...


>
>
> >
> >
> > > +        mkString n = stringE (comm n ++ "\n" ++ deCamelCase (nameBase
> n))
> > >          mkPyValueEx n = [| showValue $(varE n) |]
> > >
> > >  genPyConstants :: String -> [Name] -> Q [Dec]
> > > --
> > > 1.8.4
> > >
> > >
> > Rest LGTM, thanks.
> >
> >
> > --
> > Thomas Thrainer | Software Engineer | [email protected] |
> >
> > Google Germany GmbH
> > Dienerstr. 12
> > 80331 München
> >
> > Registergericht und -nummer: Hamburg, HRB 86891
> > Sitz der Gesellschaft: Hamburg
> > Geschäftsführer: Graham Law, Christine Elizabeth Flores
>
> --
> Jose Antonio Lopes
> Ganeti Engineering
> Google Germany GmbH
> Dienerstr. 12, 80331, München
>
> Registergericht und -nummer: Hamburg, HRB 86891
> Sitz der Gesellschaft: Hamburg
> Geschäftsführer: Graham Law, Christine Elizabeth Flores
> Steuernummer: 48/725/00206
> Umsatzsteueridentifikationsnummer: DE813741370
>



-- 
Thomas Thrainer | Software Engineer | [email protected] |

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to