On 11/11/2014 04:54 PM, Freddie Chopin wrote:
Maybe it's my personal preference, but in my project I use tup.rule() exclusively, and when working with examples from the website I wasted some time trying to make tup.definerule() do the right thing (; tup.rule() is a bit more powerful - it properly expands variables and tup %-flags, it's also a bit more compact. I don't even use tup.foreach_rule(), as a lua loop works better.
That's a good point. When I wrote the documentation, I thought that using the lower-level tup.definerule would be easier to understand and might make the connection to the original parser clearer, but maybe that's sufficiently explained through the Lua reference.

Maybe convert the existing examples to tup.rule and remove the extra examples at the bottom?

For the record, I use tup.definerule... it's wrapped in other functions and I felt the verbosity savings weren't worth the increased complexity in my case.


Another thing would be to show how you can specify flags for the compilation (like CFLAGS etc.) the way it is done in original tup parser, so not "in" the rule, but before that. This way you will have one global Tuprules.lua with you compile(), link(), etc... functions and a few Tupfile.lua files which set required flags and then call these functions on appropriate sources.

Currently the lua examples are some sort of "proof of concept", but the most of them are not very useful as presented (because of using tup.definerule()) - it would be nice if they would show something you can just copy-paste into a real project and use right away - with support for all these flags, definitions, include paths etc. Something in the spirit of the very last examples from this page - http://gittup.org/tup/ex_multiple_directories.html
Maybe there could be docs with examples for specific use cases? Or a "getting started" page that has a more concrete example, with everything used together (CFLAGS, tup.rule).


I've already given a link to my embedded project that uses tup+lua for build description, if anyone else uses that we could try to find some common parts. These can safely be assumed to be the most useful and worth presenting in the examples. I hope it's not only me who uses that (;
I took a quick look at your Tupfiles and they seem really clean and well organized. I'm a bit hesitant to write a best-practices style document myself, since even with my own Tupfiles I'm not sure they'll support the abstraction I need as I use them in more projects.

Having some sort of example "compile", "link", etc. functions would probably help to illustrate the advantages of Lua. I'm not really sure how that could be worked into the current documentation.

As an aside, I put my common Tup Lua code in a git project, and I include it in my other projects as a git submodule. The submodule has a Tuprules.lua template that includes the helper files in the submodule. It's really convenient and I recommend it if you're looking for ways to increase the reusability of your Tup functions.

BTW - here's another thing to improve in the docs - https://github.com/gittup/tup/issues/207
Thanks for pointing that out - I actually didn't realize that was merged myself, if it is what I think it is. I'll definitely take a look!


--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- You received this message because you are subscribed to the Google Groups "tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to