-
Notifications
You must be signed in to change notification settings - Fork 45
Added object() in cheat sheet for snapshot #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically good. Two requested changes (lower-case anchor for has_key()
, don't move section boundary), one recommendation (re-order the object()
variants), and a couple of points for discussion that don't require action now.
</section> | ||
<section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo: I wouldn't make this particular change, especially as part of this project. Having "Functions" be at the top of a column seems right; burying it under "Other" seems wrong. On the other hand, I don't know why "Type test functions" is before Functions; I'd move it over to after "Functions" or after "Mathematical". But again, Not This Project.
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(…,object,…);</a></code></dt> | ||
<dd> copy</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(…,name=value,…);</a></code></dt> | ||
<dd> assign/override</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(…,[…,["name"],…],…);</a></code></dt> | ||
<dd> remove name</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(…,[…,["name",value],…],…);</a></code></dt> | ||
<dd> add name=value</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation: I would order these as
- name=value
- object
- [[name,value]]
- [[name]]
because I think name=value is the most likely variant.
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(…,object,…);</a></code></dt> | ||
<dd> copy</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(…,name=value,…);</a></code></dt> | ||
<dd> assign/override</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(…,[…,["name"],…],…);</a></code></dt> | ||
<dd> remove name</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(…,[…,["name",value],…],…);</a></code></dt> | ||
<dd> add name=value</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opinions solicited: There is an argument that this and has_key()
belong over in the "Functions" section.
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = obj["name"];</a></code></dt> | ||
<dd> get value from object by string</dd> | ||
<dd> get value from object by name</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discuss: Hmm. Using "string" there was deliberate, to emphasize that it was an arbitrary string expression, as opposed to an limited-to-identifier-and-constant name for the next.
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(…,object,…);</a></code></dt> | ||
<dd> copy</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = object(…,name=value,…);</a></code></dt> | ||
<dd> assign/override</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(…,[…,["name"],…],…);</a></code></dt> | ||
<dd> remove name</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects_edits">var = object(…,[…,["name",value],…],…);</a></code></dt> | ||
<dd> add name=value</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Futures: I have mixed feelings about the "name"
style, with the quotes. There are examples both ways through the cheat sheet, showing a sample value or showing the name of the argument. One would hope that people would understand that "name"
is a sample and that you could use an arbitrary string expression there, but I've seen people who think that in cube([10,10,10])
the brackets are part of the syntax of cube()
, or that in rands(1,10,1)[0]
the [0]
is part of the syntax.
It's certainly fine for now.
We should also work on consistency in how argument names are presented; we have cases where they are plain text, are part of the link or not, are gray, are italics. We have most functions not mentioning their arguments, but a couple do. But Not This Project.
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Objects">var = obj.name;</a></code></dt> | ||
<dd> get value from object by identifier</dd> | ||
<dt><code><a href="https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/General#Has_key">has_key(object,"name");</a></code></dt> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change: anchors for other functions are in lower case.
@jordanbrown0 could you take a look? I am also ok if you want to take this over since you already edited this cheat sheet.