Hacker News new | ask | show | jobs
by jsyedidia 3934 days ago
Thanks for the comment. Because this "Literate" software outputs nicely formatted code (including automatically included comments identifying code blocks) in the target language, it's not too big a deal, you can just see what line the compiler errors are referring to in the target source code. CWEB's approach of treating the tangled code as only intended for machine reading has the major drawback that you can't share the target source code with others and expect them to be able to read it; they need to buy into CWEB too. So there's a trade-off here.
2 comments

> CWEB's approach of treating the tangled code as only intended for machine reading has the major drawback that you can't share the target source code with others and expect them to be able to read it; they need to buy into CWEB too.

There's not much of a trade off there. Either you use the tools that generated the code and edit their inputs, or the first time you update the code and rebuild your changes get clobbered.

And if people really find that literate programming makes the code that much harder to follow that they'd rather not use it, maybe it's not a great idea to use it.

It seems like this could be solved by making it an option? During development, generate line number pragmas to improve the error messages. Then when you have a working program, format the code nicely.
That's an excellent idea. I don't think it would work for all languages, but it's still a good solution, and will be added to the TODO list.