`pure` and `@safe` grammars/rules?
Dechcaudron opened this issue · comments
Hi,
First of all thanks for the great library and for the good work that is still put into maintaining it. I would like to request an improvement, if possible.
Is there any chance grammar and rule functions can be made pure @safe
? Conceptually I do not see any reason why they should not be, but there may be internal limitations I am not aware of.
Thanks in advance,
Héctor
Hi Héctor,
I don't see a problem there either. @cbleser has done a lot of @safe
work in #302, but I cannot merge that as it is failing tests. I am very much in favour of separating the @safe
work out of that PR, as well as other refactorings, to keep things easy to review and not have progress stall because of unrelated problems. I am fine with combining @safe
and pure
in the same PR, though.
Even though it should be fairly straightforward, I am not sure when I would be able to add this myself. Feel free to have a go at it, I'll be happy to answer any questions regarding building Pegged. Beware that a number of files are generated, so make your edits at the right spot :-)
Cheers,
Bastiaan.
Hi Bastiaan,
apologies for taking so long to reply. I'm currently working against the clock to meet some deadlines, so I will have to make due by calling unsafe-impure functions in debug
conditional statements. I hope to be able to fix that in pegged once I finish what I have in my hands.
I would naïvely think the grammar
template mixin is a good place to begin?
Regards,
Héctor
I would naïvely think the
grammar
template mixin is a good place to begin?
I would naïvely think so too :-) Reuse from #302 where practical, and be sure to not change files that are generated (change the generator).