[squeak-dev] The Trunk: Help-Squeak-TerseGuide-ct.16.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Sep 8 17:22:26 UTC 2022
Christoph Thiede uploaded a new version of Help-Squeak-TerseGuide to project The Trunk:
http://source.squeak.org/trunk/Help-Squeak-TerseGuide-ct.16.mcz
==================== Summary ====================
Name: Help-Squeak-TerseGuide-ct.16
Author: ct
Time: 8 September 2022, 7:22:19.321712 pm
UUID: 6f446ac1-2ee0-a549-8108-8b47c90ea5a8
Ancestors: Help-Squeak-TerseGuide-mt.15
Minor refinements to terse guide.
(Follow-up from https://github.com/squeak-smalltalk/squeak.org/pull/44)
=============== Diff against Help-Squeak-TerseGuide-mt.15 ===============
Item was changed:
----- Method: TerseGuideHelp class>>block (in category 'pages') -----
block
"This method was automatically generated. Edit it using:"
"TerseGuideHelp edit: #block"
<generated>
^(HelpTopic
title: 'Blocks'
contents:
'"Blocks:
- blocks are objects and may be assigned to a variable
- value is last expression evaluated unless explicit return
- blocks may be nested
- specification -
[ arguments | | localvars | expressions ]
- ^ expression terminates block & method (exits all nested blocks)
+ - blocks intended for long term storage must not contain ^,
- - blocks intended for long term storage should not contain ^,
as they can not return to the sender context
+ - up to 15 arguments are possible;
+ for up to 5 arguments, there are #value:, #value:value:, ...;
+ for more, use #valueWithArguments:
+ - use #cull: (and #cull:cull:...) or #valueWithEnoughArguments:
+ if you do not know the exact number of arguments
- - use #cull: (and #cull:cull:...) if you do not know the exact number of arguments
- blocks (along with polymorphism on booleans) are the basis of control structures
-> See Conditional Expressions
"
| x y z fac |
x := [ y := 1. z := 2. ]. x value. "simple block usage"
x := [ :argOne :argTwo | argOne, '' and '' , argTwo.]. "set up block with argument passing"
Transcript show: (x value: ''First'' value: ''Second''); cr. "use block with argument passing"
x := [:e | | v | v := 1. e + v] value: 2. "local variable in a block"
fac := [ :n | n > 1 ifTrue: [n * (fac value: n-1)] ifFalse: [1]]. "closure on block variable"
+ fac value: 5. "closure variable scoped to its block"!!' readStream nextChunkText)
- fac value: 5. "closure variable scoped to its block"
-
- !!' readStream nextChunkText)
key: #block;
shouldStyle: true;
yourself!
Item was changed:
----- Method: TerseGuideHelp class>>introduction (in category 'pages') -----
introduction
"This method was automatically generated. Edit it using:"
"TerseGuideHelp edit: #introduction"
+ <generated>
^(HelpTopic
title: 'General'
contents:
'Allowable characters:
- a-z
- A-Z
- 0-9
- .+/\*~<>@%|&?
- blank, tab, cr, ff, lf
Variables:
- Variables must be declared before use
+ - Shared vars (globals, pools, and class vars) must begin with uppercase
- - Shared vars must begin with uppercase
- Local vars must begin with lowercase
- Reserved names: self, super, thisContext, true, false, and nil
Variable scope:
- Global: defined in current environment (that is usually Smalltalk) and accessible by all objects in system
- Special (reserved): self, super, thisContext, true, false, and nil
- Method Temporary: local to a method
- Block Temporary: local to a block
- Pool: variables in a Dictionary object
- Method Parameters: automatic local vars created as a result of message call with params
- Block Parameters: automatic local vars created as a result of value: message call
- Class: shared with all instances of one class & its subclasses
- Class Instance: unique to each instance of a class
- Instance Variables: unique to each instance
"Comments are enclosed in quotes - like this"
+ Period (.) is the statement separator!!' readStream nextChunkText)
- Period (.) is the statement separator
-
- !!' readStream nextChunkText)
key: #introduction;
shouldStyle: false;
yourself!
More information about the Squeak-dev
mailing list
|