
The text will still be in the same order regardless of parallelism. I can all receive debug strings from its children, concatenate them and return them to its parent. each node evaluates it children (potentially in parallel) and returns the geometry to is parent. As long as the text from echo is returned as part of the value of the child node instead of being immediately printed the tree can be used to render it in the console in the correct order. Any parallel execution has to evaluate the children of a node before it can use the results to do its operation. If any debug information needs to be output during the geometry creation it isn't a problem either. It doesn't create any side effect type problems like mutable variables do because its effect is external to the program. It is no longer a side effect any more than creating geometry and

#Openscad print serial#
Well actually I think echo is run while the CSG tree is being made from the AST tree, which is a serial process and unlikely to be the bit paralleled for speed, which would be evaluating the CSG tree to create geometry.Īs I said before if you consider the console text as part of the result In OpenSCAD, the final result is usually the geometry, but in the above example it's the BOM, if the BOM is defined declaratively using metadata. Something internal to the implementation, it does not (should not)Īffect the final result. Remember that in a declarative language, the evaluation order is
#Openscad print how to#
In OpenSCAD2, I've provided a mechanism for attaching user-defined metadata to geometric shapes, and I also explain how to use this to generate a BOM declaratively, without using echo. We should provide a more declarative way to do this. I know that people use 'echo' to generate a bill of materials. With multi-core evaluation, the evaluation order can change from one run to the next.

I think we should make it clear that 'echo' is only a debug feature, that there is no defined evaluation order, and that the evaluation order can change across releases, or vary depending on the hardware and operating system. A problem with 'echo' and 'echof' is that they are part of the language, and users might come to rely on a particular script producing echo output in a particular order. Declarative programs can be automatically parallelized, so that multiple cores are used to simultaneously evaluate different parts of the program.ĭebugging tools expose the evaluation order.If the same subexpression occurs multiple times, the compiler can recognize this and arrange to only evaluate the expression once, caching the result for later use.An optimizing compiler can lift that subexpression outside of the loop, and only evaluate it once. Suppose that an expensive-to-compute subexpression occurs inside a for loop, but doesn't depend on the iteration variable.Ideally, it has no side effects, and it has no defined evaluation order, which gives the implementation maximum flexibility to compile scripts into a form that execute quickly.
#Openscad print code#
If you could use a debugger to set "watchpoints" that print a trace message to the console each time a particular expression is evaluated, then you could debug a program without cluttering up the source code with echo statements.

But we should be aiming higher, at providing a proper debugger UI in a future release. This is needed as a debug feature, since OpenSCAD doesn't have proper debug facilities. There is nothing wrong with adding an "echof" function as an aid in debugging functions.
#Openscad print archive#
Sent from the OpenSCAD mailing list archive at. The TPP is no simple “trade agreement.” Fight it! time is running out! Obviously inclusion of works of previous authors is not included in the above. Unless specifically shown otherwise above, my contribution is in the Public Domain to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Newly minted Admin - PM me if you need anything, or if I've done something stupid. Seems to be the main argument against echof() Nice use of a "side-effect" which I thought we didn't allow? On 14 January 2016 at 22:19, MichaelAtOz wrote:
