Perl does not have a simple #include, OK, but WHY? -
The C-style preprocessor level in "Perl" is not "included" function. That's it, and there are many such sites that explain how to emulate the same kind of behavior.
I can not find any of these sites, so there is an explanation why Pearl does not have this functionality, seeing that Pearl is often going to meet many different things Provides methods, it is an eager lapse.
Can anyone explain why decision was made to exclude such functionality?
In Pearl already requires
, do < / Code>,
eval
and here among other things. It does not require a Biltine Preprocessor, if you need one, then Filter by Bullet
Normally, no one wants to #include
, even here
- Fast compiled
- Clear module system
#include
inheritance, duration if any mainstream language designer announced yesterday that they were adding #include
Ndida language), you're probably mass hysteria, laugh, and were looking for a loss of confidence in the designer. Language designers do not implement #include
in any new language, there are just better ways to do this. In general, this tendency is to attain single pass lexing. Preprocessing requires that you incrementally expand #includes
and potentially see the same characters again and again again. It has been coined with problems, and one of the reasons is that C ++ is such a dog to compile. It was fine in the 60's and 70's when memory and CPU were small and languages and the problems were simple, like the codebes were. Nowadays, once you want to be able to compile "Library", you want to store your own metadata with it so that the compiler can use it without any risk.
So what would be good for #include
?
- Module? No, see above. The modules are compiled once, export their metadata efficiently, they do not pollute the namespace of the customers, they do not inject to include the other, they can be distributed in binary form, many others Also among the advantages I am not very clever to think about.
- Including macros? No. Replace with constant, inlining and general programming. All of which can be precompiled and exposed with a module.
- Splitting into generated code? Better ways to do this anyway. View module.
The only useful functionality for preprocessor, IMO, is conditional compilation.
#fdef _WIN32_ // do windowsy stuff #else #endif
Then, Pearl it do
, eval Can also do with
or requirement
.
Comments
Post a Comment