poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] pkl: Add array integrator


From: Mohammad-Reza Nabipoor
Subject: Re: [PATCH 3/3] pkl: Add array integrator
Date: Sun, 9 Jan 2022 11:00:51 +0330

On Sat, Jan 08, 2022 at 11:25:12PM +0100, Jose E. Marchesi wrote:
> 
> Hi Mohammad.
> 
> Awesome, thank you very much for doing this! :)


My pleasure!
It was a very interesting feature :)
Thanks for your help and guidance.
The next step is array de-integrator!


> 
> > +/* Return whether the type TYPE is integrable or not.  */
> > +
> > +int
> > +pkl_ast_type_integrable_p (pkl_ast_node type)
> > +{
> > +  if (PKL_AST_TYPE_CODE (type) == PKL_TYPE_INTEGRAL)
> > +    return 1;
> > +  if (PKL_AST_TYPE_CODE (type) == PKL_TYPE_ARRAY)
> > +    {
> > +      pkl_ast_node etype = PKL_AST_TYPE_A_ETYPE (type);
> > +
> > +      switch (PKL_AST_TYPE_CODE (etype))
> > +        {
> > +        case PKL_TYPE_INTEGRAL:
> > +          return 1;
> > +        case PKL_TYPE_ARRAY:
> > +        case PKL_TYPE_STRUCT:
> > +          return pkl_ast_type_integrable_p (etype);
> > +        default:
> > +          return 0;
> > +        }
> 
> Isn't this switch statement just replicating the logic of the function?
> Why not:
> 
> if (PKL_AST_TYPE_CODE (type) == PKL_TYPE_ARRAY)
>   return pkl_ast_type_integrable_p (etype);
> 


Fixed.


> The rest of the patch looks supergood to me.
> So OK for master.
> 


Pushed to master.


> PS: I am assuming you will document this in the manual in a subsequent
>     patch ;)
> 

Sure :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]