Skip to content

Support C-preprocessor-style #define/#ifdef #9

@cxw42

Description

@cxw42

One common use case for the C preprocessor is conditional compilation using #ifdef/#else/#endif. Those can already be done in perlpp with <? if(...) { ?> <? } ?>. Similarly, #define/#undef can already be done with variable assignments. However, I think syntactic sugar for those functions, together with a -D command-line option, would make it easier for people to transition from cpp to perlpp.

I have an example implementation in branch defines of my fork. It fills %Defs for use at generation time and %D for use at execution time. Any thoughts on this approach? An alternative would be to merge %D and %S (-s name=val options). I'll leave this issue open for a bit in case anyone has any ideas or concerns.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions