parsec icon indicating copy to clipboard operation
parsec copied to clipboard

the name of `notFollowedBy` is not consistent with the semantics of the other parsers

Open danse opened this issue 6 years ago • 2 comments

Just a small thing if you want, i'm pointing this out while approaching Parsec, before getting used to this.

Usually a parser's name refers to the current parser input. char 'a' will parse 'a' and so on.

If we read notFollowedBy with the same semantics, a parser like notFollowedBy '.' should correctly parse "." because "." is not followed by a dot. It should fail for "a.", instead.

In this sense a parser called notFollowedBy should probably get two parsers as arguments, like manyTill etcetera. I find that the current semantic of notFollowedBy is closer to a simple not.

danse avatar Apr 20 '18 09:04 danse

I think that you are right, but modifying it might cause a lot of problem and bugs in projects that use it because this new behavior would be different. I am not sure that modifying notFollowedBy is a good idea.

barufa avatar Feb 24 '19 23:02 barufa

Thanks for following up @barufa. First of all we can agree whether we like the interface or whether we think that there is room for improvement. Once we agree that we want to improve, we can find a way towards it. For example an alias of notFollowedBy could be introduced and, if we like the resulting semantic, notFollowedBy could be deprecated in a couple of years. Even if no change is going to happen, it can be helpful to discuss about the clearest semantic so that other function names can follow a schema and the parser can become more approachable. First of all let's wait for more people to chime in :)

danse avatar Feb 25 '19 11:02 danse