bartavelle / language-puppet

A library to work with Puppet manifests, test them and eventually replace everything ruby.
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

Questions about Lambda parsing #156

Closed PierreR closed 6 years ago

PierreR commented 8 years ago

My last commit involves a bunch of renaming for consistency sake. For instance most statement type have the suffix Declaration while the inner type has the suffix Decl. Decl is meant to imply it does contain position information:

data HigherOrderLambdaDecl = HigherOrderLambdaDecl !HOLambdaCall !PPosition deriving (Eq, Show)
data Statement =
...
    | HigherOrderLambdaDeclaration !HigherOrderLambdaDecl`

Here is a question: I don't see why we have both parsers dotLambdaDecl and hoLambdaDecl. The documentation for lambda is saying that "lambdas can only be used in function calls"; so I was wondering when hoLambdaDecl is used.

bartavelle commented 8 years ago

I admit I don't really know why right now (I will try to answer after a good night of sleep), but I believe this is used to enforce the distinction between each and the other kind of HOF. Looking at the code here I don't see how this is even enforced, so something must be wrong here.

PierreR commented 6 years ago

see #200 where hoLambdaDecl is used to implement the with statement.