4 ms·
Curious, what do you dislike about it? I used it for a project recently and found it to be really nice and expressive. I love that it's got a functional feel
by radarsat1 7y ago
Curious, what do you dislike about it?
I used it for a project recently and found it to be really nice and expressive. I love that it's got a functional feel but you can do loops and compose modules in a really powerful way.
- derekp7 7y agoFor me, the syntax is ok, however it doesn't always do what you expect. For example: if (some_condition) { x = 2; } x doesn't get set to 2. Or even better, this: x = 2; echo("x = ", x); x = 5; This prints out that x = 5.
- iamwil 7y agoIt should technically throw an error before compiling. You're thinking about it as an imperative language, when it aspires to be declarative.
- unlinked_dll 7y agoPersonally I think that's a bug, not a feature. If the language aspires to be declarative, but features imperative constructs, it should have a syntax that reflects the distinction. I work with these kinds of things a lot, having that clear divide between declarative and imperative operations on whatever being expressed isn't only easier to learn and read, it's far more expressive and powerful for complex systems.
- iamwil 7y agoYou misinterpret--or rather, I wasn't clear. While I say it aspires, I'm not saying it's a good choice. I'm just saying its odd behavior makes a lot more sense once you know it's meant to be declarative, and you can make a lot more headway when working with it.
- kevin_thibedeau 7y agoIt is not an imperative language even though it is dressed up like one. You are describing a data structure, not a sequence of operations.
- ptero 7y agoI used OpenScad a few years ago and was also initially horrified by the language until someone pointed to me the "nightly build" versions which supported the functional feel and compositions that I think you are describing. Those made a world of difference for me. I wonder if the parent is referring to a really old version (many Linux distributions still ship those). Just a guess.
- h2odragon 7y agoYes. I built a project using the 2015 release. ugh. https://github.com/h2odragon/MarksEnclosureHelper https://github.com/h2odragon/MarksEnclosureHelper
- radarsat1 7y agoAh that might explain it. I picked it up recently from scratch using the nightly build (via snap) so I'm not aware of the history of the language.
- ptero 7y agoThe old version language was bad to the extent that after playing with the tool for a few hours my thought was "why did you cripple such a good idea with such a bad language"??? I seriously considered digging out the Dragon Book to write a better language front end to it.
- rubenbe 7y agoThe syntax looks like C but it's not, and causes bugs, e.g. in this loop: i =0; for (j = [1:5]){ echo(i); i=i+1; } keeps printing "1" instead of 0 to 4
- ajnin 7y agoNot OP, but : - you can't store objects in variables, so code looks convoluted with deep nesting as you need to apply multiple transforms to objects - there are no real variables, more like constants that take the value of the last assignment, so you can't do basic stuff like x = min(x, 5) - you can't access object attributes (size, etc.) so it's not possible to generate features that depend on another object. You always need to have lots of parameters in scope. A simple use case would be to punch 4 holes in the corners of a box cover. - string functions are very limited, there is only str() to convert a value to string but with no control on the formatting, there is no printf-equivalent
- heretoo 7y agoI'm able to do some of these things. Someone else said that perhaps the nightly build is different? ``` module thing(x) { cylinder(r=x,h=10); } translate([10,0,0]) thing(5); x = min(4,2) + 1; translate([-10,0,0]) thing(x); ``` works for me.
- radarsat1 7y agoYour third and fourth points are good ones. I think the first two points are mitigated by using functions and modules correctly.