Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
'const' binding construct in predicates and preconditions
sebastian_egner
Member Posts: 2 ✭
This is a suggestion for a minor addition to the FeatureScript language.
The 'const' binding construct (a.k.a. 'let' in other languages) is extremely helpful for introducing short lived abbreviations in functions. It would be useful to have it available in the predicate language as well.
For a contrived example consider:
{ const x = veryLongVariableName.someFieldNameWhichHasManyCharacters;
f(x) == [x,x,x]; }
This is a minor addition because there are effective workarounds. You can either define a helper predicate, or use
{ for (var x in [veryLongVariableName.someFieldNameWhichHasManyCharacters])
f(x) == [x,x,x]; }
which is an implicit way of saying what you mean.
Tagged:
0
Comments
I am thinking of the language allowed between curly braces after he 'predicate' and 'precondition' keywords, not after 'annotation'. So I guess that makes it the non-feature predicates and preconditions.