, @Peter :
1 to: 10 do: [:each | dictionary at: each put: each]
+ 1 each , .
+ 1 , . , , , Smalltalk , CompiledMethod, , , , -.
,
m
1 to: 10 do: [:i | i foo]
, Ir tab :
1. label: 1
2. pushLiteral: 1
3. popIntoTemp:
4. goto: 2
5. label: 2
6. pushTemp:
7. pushLiteral: 10
8. send:
9. if: false goto: 4 else: 3
10. label: 3
11. pushTemp:
12. send:
13. popTop
14. pushTemp:
15. pushLiteral: 1
16. send:
17. popIntoTemp:
18. goto: 2
19. label: 4
20. returnReceiver
15 16 + 1. , #+ ( Raw ). AST, +
?
, #to:do: , , . - , .
,
self foo.
1 to: 10 do: [:i | i foo].
self bar
4 : foo, to:do:, foo () bar. 3 foo, foo bar - to:do: .
, to:do: 1 block i, send +, ( ).
,
m
| block |
block := [:i | i foo].
self foo.
1 to: 10 do: block
self bar
inline to:do: . +.
: do: , ?
. , to:do: , . , to:do:?
, , #to:do: . , to:do:. , to:do: , - . , "" to:do:, , "" .