From: John Benediktsson Date: Sun, 31 Jul 2022 17:36:42 +0000 (-0700) Subject: slots: minor tweak to "accessors" article X-Git-Tag: 0.99~1313 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=dfd6c6cbc00bfe76bb4a2dcfca8e71e0c37ae8f3 slots: minor tweak to "accessors" article --- diff --git a/core/slots/slots-docs.factor b/core/slots/slots-docs.factor index 047aa1cba8..6201a5c7e5 100644 --- a/core/slots/slots-docs.factor +++ b/core/slots/slots-docs.factor @@ -5,15 +5,15 @@ assocs byte-arrays alien classes.tuple ; IN: slots ARTICLE: "accessors" "Slot accessors" -"For every tuple slot, a " { $emphasis "reader" } " method is defined in the " { $vocab-link "accessors" } " vocabulary. The reader is named " { $snippet { $emphasis "slot" } ">>" } " and given a tuple, pushes the slot value on the stack." +"For every tuple slot, a " { $emphasis "reader" } " method is defined in the " { $vocab-link "accessors" } " vocabulary. The reader is named " { $snippet "slot>>" } " and given a tuple, pushes the slot value on the stack." $nl -"Writable slots—that is, those not attributed " { $link read-only } "—also have a " { $emphasis "writer" } ". The writer is named " { $snippet { $emphasis "slot" } "<<" } " and stores a value into a slot. It has stack effect " { $snippet "( value object -- )" } ". If the slot is specialized to a specific class, the writer checks that the value being written into the slot is an instance of that class first. See " { $link "tuple-declarations" } " for details." +"Writable slots —- that is, those not attributed " { $link read-only } " —- also have a " { $emphasis "writer" } ". The writer is named " { $snippet "slot<<" } " and stores a value into a slot. It has stack effect " { $snippet "( value object -- )" } ". If the slot is specialized to a specific class, the writer checks that the value being written into the slot is an instance of that class first. See " { $link "tuple-declarations" } " for details." $nl "In addition, two utility words are defined for each writable slot." $nl -"The " { $emphasis "setter" } " is named " { $snippet ">>" { $emphasis "slot" } } " and stores a value into a slot. It has stack effect " { $snippet "( object value -- object )" } "." +"The " { $emphasis "setter" } " is named " { $snippet ">>slot" } " and stores a value into a slot. It has stack effect " { $snippet "( object value -- object )" } "." $nl -"The " { $emphasis "changer" } " is named " { $snippet "change-" { $emphasis "slot" } } ". It applies a quotation to the current slot value and stores the result back in the slot; it has stack effect " { $snippet "( object quot -- object )" } "." +"The " { $emphasis "changer" } " is named " { $snippet "change-slot" } ". It applies a quotation to the current slot value and stores the result back in the slot; it has stack effect " { $snippet "( object quot -- object )" } "." $nl "Since the reader and writer are generic, words can be written which do not depend on the specific class of tuple passed in, but instead work on any tuple that defines slots with certain names." $nl