From b4b9d6e56221d8a35b10adc430f6a7a8402b580a Mon Sep 17 00:00:00 2001 From: John Bowman Date: Sat, 14 Dec 2024 11:41:57 -0800 Subject: [PATCH 1/2] Improve documentation of autounravel. --- doc/asymptote.texi | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/asymptote.texi b/doc/asymptote.texi index de6354f79..e1017bee3 100644 --- a/doc/asymptote.texi +++ b/doc/asymptote.texi @@ -6560,18 +6560,17 @@ that renames a struct. @node Where autounravel is legal @subsection Where @code{autounravel} is legal -For the most part, @code{autounravel} can be used in the same -places as @code{static}. However, there are certain places -where @code{autounravel} will give an error. - -Specifying @code{autounravel} at the top level of a module (i.e., +The @code{autounravel} modifier implies @code{static} and can be used +in many of the same places as @code{static}. However, specifying +@code{autounravel} at the top level of a module (i.e., outside of any struct or function) is an error, whereas @code{static} -gives only a warning. If top-level @code{autounravel} were allowed, +gives only a warning. @footnote{If top-level @code{autounravel} were allowed, a user might incorrectly assume that the field would be unraveled -whenever the module is @code{access}ed. The @code{static} modifier is allowed at -the top level because, while it does nothing, it does not mislead the user. +whenever the module is @code{access}ed. The @code{static} modifier +is allowed at the top level because, while it does nothing, it does +not mislead the user.} In front of a @code{struct} definition or @code{typedef} statement, -@code{autounravel} is forbidden, because types cannot be autounraveled. +@code{autounravel} is forbidden because types cannot be autounraveled. While @code{static static} results in an error, @code{static autounravel} and @code{autounravel static} are both legal and have exactly the same effect as @code{autounravel} alone. From 77ba9cd2bc0746c72caa891f7281be7bee23c2e4 Mon Sep 17 00:00:00 2001 From: John Bowman Date: Sat, 14 Dec 2024 11:48:06 -0800 Subject: [PATCH 2/2] Improve documentation of autounravel. --- doc/asymptote.texi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/asymptote.texi b/doc/asymptote.texi index e1017bee3..3a222e7bf 100644 --- a/doc/asymptote.texi +++ b/doc/asymptote.texi @@ -6537,24 +6537,24 @@ feature request at @uref{https://github.com/vectorgraphics/asymptote/issues}. @node When fields are autounraveled @subsection When fields are autounraveled -If a struct contains fields (including functions) that are declared with -@code{autounravel}, these fields will be unraveled from the struct at: +If a @code{struct} contains fields (including functions) that are declared with +@code{autounravel}, these fields will be unraveled from the @code{struct} at: @itemize @item -the end of the struct definition; +the end of the @code{struct} definition; @item -a @code{typedef import} statement, if the struct is the argument for one of +a @code{typedef import} statement, if the @code{struct} is the argument for one of the type parameters; @item -an @code{unravel} or @code{access} statement that unravels the struct from -a module or outer struct (for instance, +an @code{unravel} or @code{access} statement that unravels the @code{struct} from +a module or outer @code{struct} (for instance, @code{from rational access rational;} would make the @code{+} operator available -from the struct @code{rational} defined in @code{rational.asy}); +from the @code{struct} @code{rational} defined in @code{rational.asy}); @item A @code{typedef} statement like @code{typedef rational.rational rat;} -that renames a struct. +that renames a @code{struct}. @end itemize @node Where autounravel is legal @@ -6563,12 +6563,12 @@ that renames a struct. The @code{autounravel} modifier implies @code{static} and can be used in many of the same places as @code{static}. However, specifying @code{autounravel} at the top level of a module (i.e., -outside of any struct or function) is an error, whereas @code{static} +outside of any structure or function) is an error, whereas @code{static} gives only a warning. @footnote{If top-level @code{autounravel} were allowed, a user might incorrectly assume that the field would be unraveled whenever the module is @code{access}ed. The @code{static} modifier is allowed at the top level because, while it does nothing, it does -not mislead the user.} +not mislead the user.} In front of a @code{struct} definition or @code{typedef} statement, @code{autounravel} is forbidden because types cannot be autounraveled. While @code{static static} results in an error,