Indeed I support the basic idea of differentiate file and macro. As a coder,
I also like the #include but as it was said you will lose power.

It's possible.  But it's also possible that file inclusions in mid-line
are something we shouldn't be doing, or can be more cleanly handled in
a different way.  I'm suspicious of this 'feature'; like C macros,
it invites all kinds of hard-to-debug abuses -- for example, when
an included file isn't a balanced syntactic unit.
I think that you can't prevent this. If I want to do it, I just use your
"#include file.cfg" define a macro in it and use it in mid-line. This a
macro system with all its good and bad things. I suppose that I'm not the
only one who consider that a cfg file is implicitly the declaration of a big
macro with the name of the file.

But I don't like using special character like {%file.cfg}. There is enough
WML complexity to don't add an other "special" thing for the normal include
of a file. So I propose to simply use {file.cfg} and detect the ".cfg"
extension to see if it's a file or a macro.
- it's very human/WML noob readable.
- it implicitly enforce the rule to use cfg extension.
- but you can also use it to detect *.map or other future filetypes and
react accordingly

If you want to declare a directory just detect the final "/" in{directory/}
or maybe use  {directory/*.cfg}. And yes, I know, this idea to use the file
extension to decide what to do is not very original (maybe even copyrighted
by M$ ;), but again I think it's best to use the same file tricks as OS do.

Alink
_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to