TrySmalltalk.js 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. define("amber_examples_profstef/TrySmalltalk", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Web"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('TrySmalltalk');
  4. smalltalk.packages["TrySmalltalk"].transport = {"type":"amd","amdNamespace":"amber_examples_profstef"};
  5. smalltalk.addClass('AbstractTutorial', globals.Object, [], 'TrySmalltalk');
  6. globals.AbstractTutorial.comment="Parent class of all ProfStef tutorials.\x0a\x0aTo create your own tutorial:\x0a- subclass AbstractTutorial\x0a- implement a few methods which returns a Lesson instance\x0a- implement tutorial which returns a Collection of selectors to the methods you've created.";
  7. smalltalk.addMethod(
  8. smalltalk.method({
  9. selector: "indexOfLesson:",
  10. protocol: 'accessing',
  11. fn: function (aSelector){
  12. var self=this;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $1;
  15. $1=_st(self._tableOfContents())._indexOf_(aSelector);
  16. return $1;
  17. }, function($ctx1) {$ctx1.fill(self,"indexOfLesson:",{aSelector:aSelector},globals.AbstractTutorial)})},
  18. args: ["aSelector"],
  19. source: "indexOfLesson: aSelector\x0a\x09^self tableOfContents indexOf: aSelector.",
  20. messageSends: ["indexOf:", "tableOfContents"],
  21. referencedClasses: []
  22. }),
  23. globals.AbstractTutorial);
  24. smalltalk.addMethod(
  25. smalltalk.method({
  26. selector: "lessonAt:",
  27. protocol: 'accessing',
  28. fn: function (anInteger){
  29. var self=this;
  30. var lessonSelector;
  31. return smalltalk.withContext(function($ctx1) {
  32. var $1;
  33. lessonSelector=_st(self._tableOfContents())._at_(anInteger);
  34. $1=self._perform_(lessonSelector);
  35. return $1;
  36. }, function($ctx1) {$ctx1.fill(self,"lessonAt:",{anInteger:anInteger,lessonSelector:lessonSelector},globals.AbstractTutorial)})},
  37. args: ["anInteger"],
  38. source: "lessonAt: anInteger\x0a\x09| lessonSelector |\x0a\x09lessonSelector := self tableOfContents at: anInteger.\x0a\x09^ self perform: lessonSelector.",
  39. messageSends: ["at:", "tableOfContents", "perform:"],
  40. referencedClasses: []
  41. }),
  42. globals.AbstractTutorial);
  43. smalltalk.addMethod(
  44. smalltalk.method({
  45. selector: "size",
  46. protocol: 'accessing',
  47. fn: function (){
  48. var self=this;
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1;
  51. $1=_st(self._tableOfContents())._size();
  52. return $1;
  53. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AbstractTutorial)})},
  54. args: [],
  55. source: "size\x0a\x09^ self tableOfContents size",
  56. messageSends: ["size", "tableOfContents"],
  57. referencedClasses: []
  58. }),
  59. globals.AbstractTutorial);
  60. smalltalk.addMethod(
  61. smalltalk.method({
  62. selector: "tableOfContents",
  63. protocol: 'accessing',
  64. fn: function (){
  65. var self=this;
  66. var $1;
  67. $1=["welcome", "testLesson", "theEnd"];
  68. return $1;
  69. },
  70. args: [],
  71. source: "tableOfContents\x0a^ #(\x0a 'welcome'\x0a 'testLesson'\x0a 'theEnd'\x0a)",
  72. messageSends: [],
  73. referencedClasses: []
  74. }),
  75. globals.AbstractTutorial);
  76. smalltalk.addMethod(
  77. smalltalk.method({
  78. selector: "testLesson",
  79. protocol: 'pages',
  80. fn: function (){
  81. var self=this;
  82. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  83. return smalltalk.withContext(function($ctx1) {
  84. var $1;
  85. $1=_st($Lesson())._title_contents_("Test Lesson","\x22This lesson is a test\x22");
  86. return $1;
  87. }, function($ctx1) {$ctx1.fill(self,"testLesson",{},globals.AbstractTutorial)})},
  88. args: [],
  89. source: "testLesson\x0a\x09^ Lesson\x0a\x09\x09title: 'Test Lesson' \x0a\x09\x09contents: '\x22This lesson is a test\x22'",
  90. messageSends: ["title:contents:"],
  91. referencedClasses: ["Lesson"]
  92. }),
  93. globals.AbstractTutorial);
  94. smalltalk.addMethod(
  95. smalltalk.method({
  96. selector: "theEnd",
  97. protocol: 'pages',
  98. fn: function (){
  99. var self=this;
  100. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  101. return smalltalk.withContext(function($ctx1) {
  102. var $1;
  103. $1=_st($Lesson())._title_contents_("The End","\x22And that'd be pretty much it :)\x22");
  104. return $1;
  105. }, function($ctx1) {$ctx1.fill(self,"theEnd",{},globals.AbstractTutorial)})},
  106. args: [],
  107. source: "theEnd\x0a\x09^ Lesson\x0a\x09\x09title: 'The End' \x0a\x09\x09contents: '\x22And that''d be pretty much it :)\x22'",
  108. messageSends: ["title:contents:"],
  109. referencedClasses: ["Lesson"]
  110. }),
  111. globals.AbstractTutorial);
  112. smalltalk.addMethod(
  113. smalltalk.method({
  114. selector: "welcome",
  115. protocol: 'pages',
  116. fn: function (){
  117. var self=this;
  118. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  119. return smalltalk.withContext(function($ctx1) {
  120. var $1;
  121. $1=_st($Lesson())._title_contents_("Welcome","\x22Hi, this is a test tutorial.\x22");
  122. return $1;
  123. }, function($ctx1) {$ctx1.fill(self,"welcome",{},globals.AbstractTutorial)})},
  124. args: [],
  125. source: "welcome\x0a\x09^ Lesson\x0a\x09\x09title: 'Welcome' \x0a\x09\x09contents: '\x22Hi, this is a test tutorial.\x22'",
  126. messageSends: ["title:contents:"],
  127. referencedClasses: ["Lesson"]
  128. }),
  129. globals.AbstractTutorial);
  130. smalltalk.addClass('SmalltalkSyntaxTutorial', globals.AbstractTutorial, [], 'TrySmalltalk');
  131. globals.SmalltalkSyntaxTutorial.comment="The default ProfStef tutorial to learn Smalltalk syntax";
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "basicTypesArray",
  135. protocol: 'pages',
  136. fn: function (){
  137. var self=this;
  138. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  139. return smalltalk.withContext(function($ctx1) {
  140. var $1;
  141. $1=_st($Lesson())._title_contents_("Basic types: Array","\x22Literal arrays are created at parse time:\x22\x0a\x0a#(1 2 3).\x0a\x0a#( 1 2 3 #(4 5 6)) size.\x0a\x0a#(1 2 4) isEmpty.\x0a\x0a#(1 2 3) first.\x0a\x0a#('hello' 'Javascript') at: 2 put: 'Smalltalk'; yourself.\x0a\x0aProfStef next.");
  142. return $1;
  143. }, function($ctx1) {$ctx1.fill(self,"basicTypesArray",{},globals.SmalltalkSyntaxTutorial)})},
  144. args: [],
  145. source: "basicTypesArray\x0a\x09^ Lesson\x0atitle: 'Basic types: Array' \x0acontents: \x0a'\x22Literal arrays are created at parse time:\x22\x0a\x0a#(1 2 3).\x0a\x0a#( 1 2 3 #(4 5 6)) size.\x0a\x0a#(1 2 4) isEmpty.\x0a\x0a#(1 2 3) first.\x0a\x0a#(''hello'' ''Javascript'') at: 2 put: ''Smalltalk''; yourself.\x0a\x0aProfStef next.'",
  146. messageSends: ["title:contents:"],
  147. referencedClasses: ["Lesson"]
  148. }),
  149. globals.SmalltalkSyntaxTutorial);
  150. smalltalk.addMethod(
  151. smalltalk.method({
  152. selector: "basicTypesCharacters",
  153. protocol: 'pages',
  154. fn: function (){
  155. var self=this;
  156. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  157. return smalltalk.withContext(function($ctx1) {
  158. var $1;
  159. $1=_st($Lesson())._title_contents_("Basic types: Characters","\x22A Character can be instantiated using $ operator:\x22\x0a\x0a$A.\x0a\x0a$A class.\x0a\x0a$B charCode.\x0a\x0aCharacter cr.\x0a\x0aCharacter space.\x0a\x0a\x22You can print all 256 characters of the ASCII extended set:\x22\x0a\x0aCharacter allByteCharacters.\x0a\x0aProfStef next.");
  160. return $1;
  161. }, function($ctx1) {$ctx1.fill(self,"basicTypesCharacters",{},globals.SmalltalkSyntaxTutorial)})},
  162. args: [],
  163. source: "basicTypesCharacters\x0a\x09^ Lesson\x0atitle: 'Basic types: Characters' \x0acontents: \x0a'\x22A Character can be instantiated using $ operator:\x22\x0a\x0a$A.\x0a\x0a$A class.\x0a\x0a$B charCode.\x0a\x0aCharacter cr.\x0a\x0aCharacter space.\x0a\x0a\x22You can print all 256 characters of the ASCII extended set:\x22\x0a\x0aCharacter allByteCharacters.\x0a\x0aProfStef next.'",
  164. messageSends: ["title:contents:"],
  165. referencedClasses: ["Lesson"]
  166. }),
  167. globals.SmalltalkSyntaxTutorial);
  168. smalltalk.addMethod(
  169. smalltalk.method({
  170. selector: "basicTypesDynamicArray",
  171. protocol: 'pages',
  172. fn: function (){
  173. var self=this;
  174. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  175. return smalltalk.withContext(function($ctx1) {
  176. var $1;
  177. $1=_st($Lesson())._title_contents_("Basic types: Dynamic Array","\x22Dynamic Arrays are created at execution time:\x22\x0a\x0a{ (2+3) . (6*6) }.\x0a\x0a{ (2+3) . (6*6) . 'hello', ' Stef'} size.\x0a\x0a\x0a{ ProfStef } first next.");
  178. return $1;
  179. }, function($ctx1) {$ctx1.fill(self,"basicTypesDynamicArray",{},globals.SmalltalkSyntaxTutorial)})},
  180. args: [],
  181. source: "basicTypesDynamicArray\x0a\x09^ Lesson\x0atitle: 'Basic types: Dynamic Array' \x0acontents: \x0a'\x22Dynamic Arrays are created at execution time:\x22\x0a\x0a{ (2+3) . (6*6) }.\x0a\x0a{ (2+3) . (6*6) . ''hello'', '' Stef''} size.\x0a\x0a\x0a{ ProfStef } first next.'",
  182. messageSends: ["title:contents:"],
  183. referencedClasses: ["Lesson"]
  184. }),
  185. globals.SmalltalkSyntaxTutorial);
  186. smalltalk.addMethod(
  187. smalltalk.method({
  188. selector: "basicTypesNumbers",
  189. protocol: 'pages',
  190. fn: function (){
  191. var self=this;
  192. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  193. return smalltalk.withContext(function($ctx1) {
  194. var $1;
  195. $1=_st($Lesson())._title_contents_("Basic types: Numbers","\x22You now know how to execute Smalltalk code. \x0a\x0aNow let's talk about basic objects.\x0a\x0a1, 2, 100, 2/3 ... are Numbers, and respond to many messages evaluating mathematical expressions.\x0aEvaluate these ones:\x22\x0a\x0a2.\x0a\x0a(1/3).\x0a\x0a(1/3) + (4/5).\x0a\x0a(18/5) rounded.\x0a\x0a1 class.\x0a\x0a1 negated.\x0a\x0a1 negated negated.\x0a\x0a(1 + 3) odd.\x0a\x0aProfStef next.");
  196. return $1;
  197. }, function($ctx1) {$ctx1.fill(self,"basicTypesNumbers",{},globals.SmalltalkSyntaxTutorial)})},
  198. args: [],
  199. source: "basicTypesNumbers\x0a\x09^ Lesson\x0atitle: 'Basic types: Numbers' \x0acontents: \x0a'\x22You now know how to execute Smalltalk code. \x0a\x0aNow let''s talk about basic objects.\x0a\x0a1, 2, 100, 2/3 ... are Numbers, and respond to many messages evaluating mathematical expressions.\x0aEvaluate these ones:\x22\x0a\x0a2.\x0a\x0a(1/3).\x0a\x0a(1/3) + (4/5).\x0a\x0a(18/5) rounded.\x0a\x0a1 class.\x0a\x0a1 negated.\x0a\x0a1 negated negated.\x0a\x0a(1 + 3) odd.\x0a\x0aProfStef next.'",
  200. messageSends: ["title:contents:"],
  201. referencedClasses: ["Lesson"]
  202. }),
  203. globals.SmalltalkSyntaxTutorial);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "basicTypesString",
  207. protocol: 'pages',
  208. fn: function (){
  209. var self=this;
  210. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  211. return smalltalk.withContext(function($ctx1) {
  212. var $1;
  213. $1=_st($Lesson())._title_contents_("Basic types: Strings","\x22A String is a collection of characters. Use single quotes to create a String object. Print these expressions:\x22\x0a\x0a'ProfStef'.\x0a\x0a'ProfStef' size.\x0a\x0a'abc' asUppercase.\x0a\x0a'Hello World' reversed. \x0a\x0a\x22You can access each character using at: message\x22\x0a\x0a'ProfStef' at: 1.\x0a\x0a\x22String concatenation uses the comma operator:\x22\x0a\x0a'ProfStef', ' is cool'.\x0a\x0aProfStef next.");
  214. return $1;
  215. }, function($ctx1) {$ctx1.fill(self,"basicTypesString",{},globals.SmalltalkSyntaxTutorial)})},
  216. args: [],
  217. source: "basicTypesString\x0a\x09^ Lesson\x0atitle: 'Basic types: Strings' \x0acontents: \x0a'\x22A String is a collection of characters. Use single quotes to create a String object. Print these expressions:\x22\x0a\x0a''ProfStef''.\x0a\x0a''ProfStef'' size.\x0a\x0a''abc'' asUppercase.\x0a\x0a''Hello World'' reversed. \x0a\x0a\x22You can access each character using at: message\x22\x0a\x0a''ProfStef'' at: 1.\x0a\x0a\x22String concatenation uses the comma operator:\x22\x0a\x0a''ProfStef'', '' is cool''.\x0a\x0aProfStef next.'",
  218. messageSends: ["title:contents:"],
  219. referencedClasses: ["Lesson"]
  220. }),
  221. globals.SmalltalkSyntaxTutorial);
  222. smalltalk.addMethod(
  223. smalltalk.method({
  224. selector: "basicTypesSymbol",
  225. protocol: 'pages',
  226. fn: function (){
  227. var self=this;
  228. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  229. return smalltalk.withContext(function($ctx1) {
  230. var $1;
  231. $1=_st($Lesson())._title_contents_("Basic types: Symbols","\x22A Symbol is a String which is guaranteed to be globally unique. \x0a\x0aThere is one and only one Symbol #ProfStef. There may be several 'ProfStef' String objects.\x0a\x0a(Message == returns true if the two objects are the SAME)\x22\x0a\x0a'ProfStef' asSymbol.\x0a\x0a#ProfStef asString.\x0a\x0a(2 asString) == (2 asString).\x0a\x0a(2 asString) asSymbol == (2 asString) asSymbol.\x0a\x0a\x0a(Smalltalk at: #ProfStef) next.");
  232. return $1;
  233. }, function($ctx1) {$ctx1.fill(self,"basicTypesSymbol",{},globals.SmalltalkSyntaxTutorial)})},
  234. args: [],
  235. source: "basicTypesSymbol\x0a\x09^ Lesson\x0atitle: 'Basic types: Symbols' \x0acontents: \x0a'\x22A Symbol is a String which is guaranteed to be globally unique. \x0a\x0aThere is one and only one Symbol #ProfStef. There may be several ''ProfStef'' String objects.\x0a\x0a(Message == returns true if the two objects are the SAME)\x22\x0a\x0a''ProfStef'' asSymbol.\x0a\x0a#ProfStef asString.\x0a\x0a(2 asString) == (2 asString).\x0a\x0a(2 asString) asSymbol == (2 asString) asSymbol.\x0a\x0a\x0a(Smalltalk at: #ProfStef) next.'",
  236. messageSends: ["title:contents:"],
  237. referencedClasses: ["Lesson"]
  238. }),
  239. globals.SmalltalkSyntaxTutorial);
  240. smalltalk.addMethod(
  241. smalltalk.method({
  242. selector: "blocks",
  243. protocol: 'pages',
  244. fn: function (){
  245. var self=this;
  246. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  247. return smalltalk.withContext(function($ctx1) {
  248. var $1;
  249. $1=_st($Lesson())._title_contents_("Blocks","\x22Cascade is cool ! Let's talk about blocks.\x0a\x0aBlocks are anonymous methods that can be stored into variables and executed on demand.\x0a\x0aBlocks are delimited by square brackets: []\x22\x0a\x0a[Transcript open].\x0a\x0a\x22does not open a Transcript because the block is not executed.\x0a\x0aHere is a block that adds 2 to its argument (its argument is named x):\x22\x0a\x0a[:x | x+2].\x0a\x0a\x22We can execute a block by sending it value messages.\x22\x0a\x0a[:x | x+2] value: 5.\x0a\x0a[Transcript open] value.\x0a\x0a[:x | x+2] value: 10.\x0a\x0a[:x :y| x + y] value:3 value:5.\x0a\x0a[ProfStef next] value.");
  250. return $1;
  251. }, function($ctx1) {$ctx1.fill(self,"blocks",{},globals.SmalltalkSyntaxTutorial)})},
  252. args: [],
  253. source: "blocks\x0a\x09^ Lesson\x0atitle: 'Blocks' \x0acontents: \x0a'\x22Cascade is cool ! Let''s talk about blocks.\x0a\x0aBlocks are anonymous methods that can be stored into variables and executed on demand.\x0a\x0aBlocks are delimited by square brackets: []\x22\x0a\x0a[Transcript open].\x0a\x0a\x22does not open a Transcript because the block is not executed.\x0a\x0aHere is a block that adds 2 to its argument (its argument is named x):\x22\x0a\x0a[:x | x+2].\x0a\x0a\x22We can execute a block by sending it value messages.\x22\x0a\x0a[:x | x+2] value: 5.\x0a\x0a[Transcript open] value.\x0a\x0a[:x | x+2] value: 10.\x0a\x0a[:x :y| x + y] value:3 value:5.\x0a\x0a[ProfStef next] value.'",
  254. messageSends: ["title:contents:"],
  255. referencedClasses: ["Lesson"]
  256. }),
  257. globals.SmalltalkSyntaxTutorial);
  258. smalltalk.addMethod(
  259. smalltalk.method({
  260. selector: "blocksAssignation",
  261. protocol: 'pages',
  262. fn: function (){
  263. var self=this;
  264. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  265. return smalltalk.withContext(function($ctx1) {
  266. var $1;
  267. $1=_st($Lesson())._title_contents_("Block assignation","\x22Blocks can be assigned to a variable then executed later.\x0a\x0aNote that |b| is the declaration of a variable named 'b' and that ':=' assigns a value to a variable.\x0a\x0aSelect the three lines then Print It:\x22\x0a\x0a|b|\x0ab := [:x | x+2].\x0ab value: 12.\x0a\x0a\x0aProfStef next.");
  268. return $1;
  269. }, function($ctx1) {$ctx1.fill(self,"blocksAssignation",{},globals.SmalltalkSyntaxTutorial)})},
  270. args: [],
  271. source: "blocksAssignation\x0a\x09^ Lesson\x0atitle: 'Block assignation' \x0acontents: \x0a'\x22Blocks can be assigned to a variable then executed later.\x0a\x0aNote that |b| is the declaration of a variable named ''b'' and that '':='' assigns a value to a variable.\x0a\x0aSelect the three lines then Print It:\x22\x0a\x0a|b|\x0ab := [:x | x+2].\x0ab value: 12.\x0a\x0a\x0aProfStef next.'",
  272. messageSends: ["title:contents:"],
  273. referencedClasses: ["Lesson"]
  274. }),
  275. globals.SmalltalkSyntaxTutorial);
  276. smalltalk.addMethod(
  277. smalltalk.method({
  278. selector: "conditionals",
  279. protocol: 'pages',
  280. fn: function (){
  281. var self=this;
  282. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  283. return smalltalk.withContext(function($ctx1) {
  284. var $1;
  285. $1=_st($Lesson())._title_contents_("Conditionals","\x22Conditionals are just messages sent to Boolean objects\x22\x0a\x0a1 < 2\x0a ifTrue: [100]\x0a ifFalse: [42].\x0a\x0a\x22Here the message is ifTrue:ifFalse\x0a\x0aTry this:\x22\x0a\x0aTranscript open.\x0a\x0a3 > 10 \x0a\x09ifTrue: [Transcript show: 'maybe there''s a bug ....']\x0a\x09ifFalse: [Transcript show: 'No : 3 is less than 10'].\x0a\x0a3 = 3 ifTrue: [ProfStef next].");
  286. return $1;
  287. }, function($ctx1) {$ctx1.fill(self,"conditionals",{},globals.SmalltalkSyntaxTutorial)})},
  288. args: [],
  289. source: "conditionals\x0a\x09^ Lesson\x0atitle: 'Conditionals' \x0acontents: \x0a'\x22Conditionals are just messages sent to Boolean objects\x22\x0a\x0a1 < 2\x0a ifTrue: [100]\x0a ifFalse: [42].\x0a\x0a\x22Here the message is ifTrue:ifFalse\x0a\x0aTry this:\x22\x0a\x0aTranscript open.\x0a\x0a3 > 10 \x0a\x09ifTrue: [Transcript show: ''maybe there''''s a bug ....'']\x0a\x09ifFalse: [Transcript show: ''No : 3 is less than 10''].\x0a\x0a3 = 3 ifTrue: [ProfStef next].'.",
  290. messageSends: ["title:contents:"],
  291. referencedClasses: ["Lesson"]
  292. }),
  293. globals.SmalltalkSyntaxTutorial);
  294. smalltalk.addMethod(
  295. smalltalk.method({
  296. selector: "debugger",
  297. protocol: 'pages',
  298. fn: function (){
  299. var self=this;
  300. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  301. return smalltalk.withContext(function($ctx1) {
  302. var $1;
  303. $1=_st($Lesson())._title_contents_("Debugger","\x22The Debugger may be the most famous tool of Smalltalk environments. It will open as soon as an unmanaged Exception occurs. \x0a\x0aThe following code will open the debugger.\x0a\x0a***This should be rethought completely***\x22\x0a\x0a\x0a ");
  304. return $1;
  305. }, function($ctx1) {$ctx1.fill(self,"debugger",{},globals.SmalltalkSyntaxTutorial)})},
  306. args: [],
  307. source: "debugger\x0a\x09^ Lesson\x0atitle: 'Debugger' \x0acontents: '\x22The Debugger may be the most famous tool of Smalltalk environments. It will open as soon as an unmanaged Exception occurs. \x0a\x0aThe following code will open the debugger.\x0a\x0a***This should be rethought completely***\x22\x0a\x0a\x0a '",
  308. messageSends: ["title:contents:"],
  309. referencedClasses: ["Lesson"]
  310. }),
  311. globals.SmalltalkSyntaxTutorial);
  312. smalltalk.addMethod(
  313. smalltalk.method({
  314. selector: "doingVSPrinting",
  315. protocol: 'pages',
  316. fn: function (){
  317. var self=this;
  318. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  319. return smalltalk.withContext(function($ctx1) {
  320. var $1;
  321. $1=_st($Lesson())._title_contents_("Doing VS Printing: Doing","\x22Cool ! (I like to say Cooool :) ).\x0aYou've just executed a Smalltalk expression.\x0aMore precisely, you sent the message 'next' to ProfStef class (it's me !).\x0a\x0aNote you can run this tutorial again by evaluating: 'ProfStef go'. \x0a'ProfStef previous' returns to the previous lesson.\x0a\x0aYou can also Do It using the keyboard shortcut 'CTRL d'\x0a\x0aTry to evaluate this expression:\x22\x0a\x0awindow alert: 'hello world!'.\x0a\x0a\x22Then go to the next lesson:\x22\x0a\x0aProfStef next.");
  322. return $1;
  323. }, function($ctx1) {$ctx1.fill(self,"doingVSPrinting",{},globals.SmalltalkSyntaxTutorial)})},
  324. args: [],
  325. source: "doingVSPrinting \x0a\x09^ Lesson\x0atitle: 'Doing VS Printing: Doing' \x0acontents: \x0a'\x22Cool ! (I like to say Cooool :) ).\x0aYou''ve just executed a Smalltalk expression.\x0aMore precisely, you sent the message ''next'' to ProfStef class (it''s me !).\x0a\x0aNote you can run this tutorial again by evaluating: ''ProfStef go''. \x0a''ProfStef previous'' returns to the previous lesson.\x0a\x0aYou can also Do It using the keyboard shortcut ''CTRL d''\x0a\x0aTry to evaluate this expression:\x22\x0a\x0awindow alert: ''hello world!''.\x0a\x0a\x22Then go to the next lesson:\x22\x0a\x0aProfStef next.'",
  326. messageSends: ["title:contents:"],
  327. referencedClasses: ["Lesson"]
  328. }),
  329. globals.SmalltalkSyntaxTutorial);
  330. smalltalk.addMethod(
  331. smalltalk.method({
  332. selector: "instanciation",
  333. protocol: 'pages',
  334. fn: function (){
  335. var self=this;
  336. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  337. return smalltalk.withContext(function($ctx1) {
  338. var $1;
  339. $1=_st($Lesson())._title_contents_("Instanciation","\x22Objects are instances of their class. Usually, we send the message #new to a class for creating an instance of this class.\x0a\x0aFor example, let's create an instance of the class Array:\x22\x0a\x0aArray new\x0a\x09add: 'Some text';\x0a\x09add: 3.;\x0a\x09yourself.\x0a\x0a\x22See the array we've created? Actually, #('Some text' 3) is just a shorthand for instantiating arrays.\x22\x0a\x0a\x22If we use a variable to keep track of this object, we'll be able to do stuff with it.\x22\x0a\x0a\x22The following code must be ran all at one, as the 'anArray' variable will cease to exist once the execution finishes:\x22\x0a\x0a|anArray|\x0a\x0aanArray := Array new\x0a\x09add: 'Some text';\x0a\x09add: 3;\x0a\x09yourself.\x0a\x0aTranscript show: anArray; cr.\x0a\x0aanArray remove: 3.\x0a\x0aTranscript show: anArray; cr.\x0a\x0aanArray add: 'Some more text!'.\x0a\x0aTranscript show: anArray; cr.\x0a\x09\x0a\x22I'll put myself in an instance of a class named Dictionary and go to the next lesson:\x22\x0a\x0a((Dictionary new add: ('move on!' -> ProfStef)) at: 'move on!') next");
  340. return $1;
  341. }, function($ctx1) {$ctx1.fill(self,"instanciation",{},globals.SmalltalkSyntaxTutorial)})},
  342. args: [],
  343. source: "instanciation\x0a\x09^ Lesson\x0atitle: 'Instanciation' \x0acontents: \x0a'\x22Objects are instances of their class. Usually, we send the message #new to a class for creating an instance of this class.\x0a\x0aFor example, let''s create an instance of the class Array:\x22\x0a\x0aArray new\x0a\x09add: ''Some text'';\x0a\x09add: 3.;\x0a\x09yourself.\x0a\x0a\x22See the array we''ve created? Actually, #(''Some text'' 3) is just a shorthand for instantiating arrays.\x22\x0a\x0a\x22If we use a variable to keep track of this object, we''ll be able to do stuff with it.\x22\x0a\x0a\x22The following code must be ran all at one, as the ''anArray'' variable will cease to exist once the execution finishes:\x22\x0a\x0a|anArray|\x0a\x0aanArray := Array new\x0a\x09add: ''Some text'';\x0a\x09add: 3;\x0a\x09yourself.\x0a\x0aTranscript show: anArray; cr.\x0a\x0aanArray remove: 3.\x0a\x0aTranscript show: anArray; cr.\x0a\x0aanArray add: ''Some more text!''.\x0a\x0aTranscript show: anArray; cr.\x0a\x09\x0a\x22I''ll put myself in an instance of a class named Dictionary and go to the next lesson:\x22\x0a\x0a((Dictionary new add: (''move on!'' -> ProfStef)) at: ''move on!'') next'",
  344. messageSends: ["title:contents:"],
  345. referencedClasses: ["Lesson"]
  346. }),
  347. globals.SmalltalkSyntaxTutorial);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "iterators",
  351. protocol: 'pages',
  352. fn: function (){
  353. var self=this;
  354. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  355. return smalltalk.withContext(function($ctx1) {
  356. var $1;
  357. $1=_st($Lesson())._title_contents_("Iterators","\x22The message do: is sent to a collection of objects (Array, Dictionary, String, etc), evaluating the block for each element.\x0a\x0aHere we want to print all the numbers on the Transcript (a console)\x22\x0a\x0a#(11 38 3 -2 10) do: [:each |\x0a Transcript show: each printString; cr].\x0a\x0a\x22Some other really nice iterators\x22\x0a\x0a#(11 38 3 -2 10) collect: [:each | each negated].\x0a\x0a#(11 38 3 -2 10) collect: [:each | each odd].\x0a\x0a#(11 38 3 -2 10) select: [:each | each odd].\x0a\x0a#(11 38 3 -2 10) select: [:each | each > 10].\x0a\x0a#(11 38 3 -2 10) reject: [:each | each > 10].\x0a\x0a#(11 38 3 -2 10) \x0a do: [:each | Transcript show: each printString]\x0a separatedBy: [Transcript show: '.'].\x0a\x0a\x0a(Smalltalk current classes select: [:eachClass | eachClass name = 'ProfStef']) do: [:eachProfstef | eachProfstef next].");
  358. return $1;
  359. }, function($ctx1) {$ctx1.fill(self,"iterators",{},globals.SmalltalkSyntaxTutorial)})},
  360. args: [],
  361. source: "iterators\x0a\x09^ Lesson\x0atitle: 'Iterators' \x0acontents: \x0a'\x22The message do: is sent to a collection of objects (Array, Dictionary, String, etc), evaluating the block for each element.\x0a\x0aHere we want to print all the numbers on the Transcript (a console)\x22\x0a\x0a#(11 38 3 -2 10) do: [:each |\x0a Transcript show: each printString; cr].\x0a\x0a\x22Some other really nice iterators\x22\x0a\x0a#(11 38 3 -2 10) collect: [:each | each negated].\x0a\x0a#(11 38 3 -2 10) collect: [:each | each odd].\x0a\x0a#(11 38 3 -2 10) select: [:each | each odd].\x0a\x0a#(11 38 3 -2 10) select: [:each | each > 10].\x0a\x0a#(11 38 3 -2 10) reject: [:each | each > 10].\x0a\x0a#(11 38 3 -2 10) \x0a do: [:each | Transcript show: each printString]\x0a separatedBy: [Transcript show: ''.''].\x0a\x0a\x0a(Smalltalk current classes select: [:eachClass | eachClass name = ''ProfStef'']) do: [:eachProfstef | eachProfstef next].'",
  362. messageSends: ["title:contents:"],
  363. referencedClasses: ["Lesson"]
  364. }),
  365. globals.SmalltalkSyntaxTutorial);
  366. smalltalk.addMethod(
  367. smalltalk.method({
  368. selector: "loops",
  369. protocol: 'pages',
  370. fn: function (){
  371. var self=this;
  372. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  373. return smalltalk.withContext(function($ctx1) {
  374. var $1;
  375. $1=_st($Lesson())._title_contents_("Loops","\x22Loops are high-level collection iterators, implemented as regular methods.\x22\x0a\x0a\x22Basic loops:\x0a to:do:\x0a to:by:do\x22\x0a\x0a1 to: 100 do:\x0a [:i | Transcript show: i asString; cr ].\x0a\x0a1 to: 100 by: 3 do: [:i | Transcript show: i asString; cr].\x0a\x0a100 to: 0 by: -2 do: \x0a [:i | Transcript show: i asString; cr].\x0a\x0a1 to: 1 do: [:i | ProfStef next].");
  376. return $1;
  377. }, function($ctx1) {$ctx1.fill(self,"loops",{},globals.SmalltalkSyntaxTutorial)})},
  378. args: [],
  379. source: "loops\x0a\x09^ Lesson\x0atitle: 'Loops' \x0acontents: \x0a'\x22Loops are high-level collection iterators, implemented as regular methods.\x22\x0a\x0a\x22Basic loops:\x0a to:do:\x0a to:by:do\x22\x0a\x0a1 to: 100 do:\x0a [:i | Transcript show: i asString; cr ].\x0a\x0a1 to: 100 by: 3 do: [:i | Transcript show: i asString; cr].\x0a\x0a100 to: 0 by: -2 do: \x0a [:i | Transcript show: i asString; cr].\x0a\x0a1 to: 1 do: [:i | ProfStef next].'",
  380. messageSends: ["title:contents:"],
  381. referencedClasses: ["Lesson"]
  382. }),
  383. globals.SmalltalkSyntaxTutorial);
  384. smalltalk.addMethod(
  385. smalltalk.method({
  386. selector: "mathematicalPrecedence",
  387. protocol: 'pages',
  388. fn: function (){
  389. var self=this;
  390. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st($Lesson())._title_contents_("Mathematical precedence","\x22Traditional precedence rules from mathematics do not follow in Smalltalk.\x22\x0a\x0a2 * 10 + 2.\x0a\x0a\x22Here the message * is sent to 2, which answers 20, then 20 receive the message +\x0a\x0aRemember that all messages always follow a simple left-to-right precedence rule, * without exceptions *.\x22\x0a\x0a2 + 2 * 10.\x0a\x0a2 + (2 * 10).\x0a\x0a8 - 5 / 2.\x0a\x0a(8 - 5) / 2.\x0a\x0a8 - (5 / 2).\x0a\x0aProfStef next.");
  394. return $1;
  395. }, function($ctx1) {$ctx1.fill(self,"mathematicalPrecedence",{},globals.SmalltalkSyntaxTutorial)})},
  396. args: [],
  397. source: "mathematicalPrecedence\x0a\x09^ Lesson\x0atitle: 'Mathematical precedence'\x0acontents: \x0a'\x22Traditional precedence rules from mathematics do not follow in Smalltalk.\x22\x0a\x0a2 * 10 + 2.\x0a\x0a\x22Here the message * is sent to 2, which answers 20, then 20 receive the message +\x0a\x0aRemember that all messages always follow a simple left-to-right precedence rule, * without exceptions *.\x22\x0a\x0a2 + 2 * 10.\x0a\x0a2 + (2 * 10).\x0a\x0a8 - 5 / 2.\x0a\x0a(8 - 5) / 2.\x0a\x0a8 - (5 / 2).\x0a\x0aProfStef next.'",
  398. messageSends: ["title:contents:"],
  399. referencedClasses: ["Lesson"]
  400. }),
  401. globals.SmalltalkSyntaxTutorial);
  402. smalltalk.addMethod(
  403. smalltalk.method({
  404. selector: "messageSyntaxBinary",
  405. protocol: 'pages',
  406. fn: function (){
  407. var self=this;
  408. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  409. return smalltalk.withContext(function($ctx1) {
  410. var $1;
  411. $1=_st($Lesson())._title_contents_("Message syntax: Binary messages","\x22Binary messages have the following form:\x0a anObject + anotherObject\x22\x0a\x0a3 * 2.\x0a\x0aDate today year = 2011.\x0a\x0afalse | false.\x0a\x0atrue & true.\x0a\x0atrue & false.\x0a\x0a10 @ 100.\x0a\x0a10 <= 12.\x0a\x0a'ab', 'cd'.\x0a\x0aProfStef next.");
  412. return $1;
  413. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxBinary",{},globals.SmalltalkSyntaxTutorial)})},
  414. args: [],
  415. source: "messageSyntaxBinary\x0a\x09^ Lesson\x0atitle: 'Message syntax: Binary messages' \x0acontents: \x0a'\x22Binary messages have the following form:\x0a anObject + anotherObject\x22\x0a\x0a3 * 2.\x0a\x0aDate today year = 2011.\x0a\x0afalse | false.\x0a\x0atrue & true.\x0a\x0atrue & false.\x0a\x0a10 @ 100.\x0a\x0a10 <= 12.\x0a\x0a''ab'', ''cd''.\x0a\x0aProfStef next.'",
  416. messageSends: ["title:contents:"],
  417. referencedClasses: ["Lesson"]
  418. }),
  419. globals.SmalltalkSyntaxTutorial);
  420. smalltalk.addMethod(
  421. smalltalk.method({
  422. selector: "messageSyntaxCascade",
  423. protocol: 'pages',
  424. fn: function (){
  425. var self=this;
  426. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  427. return smalltalk.withContext(function($ctx1) {
  428. var $1;
  429. $1=_st($Lesson())._title_contents_("Message syntax: Cascade","\x22; is the cascade operator. It's useful to send message to the SAME receiver\x0aOpen a Transcript (console):\x22\x0a\x0aTranscript open.\x0a\x0a\x22Then:\x22\x0a\x0aTranscript show: 'hello'.\x0aTranscript show: 'Smalltalk'.\x0aTranscript cr.\x0a\x0a\x22is equivalent to:\x22\x0a\x0aTranscript \x0a\x09 show: 'hello';\x0a\x09 show: 'Smalltalk' ;\x0a\x09 cr.\x0a\x0a\x22You can close the development tools by clicking on the red circle with a cross at the bottom left of the website.\x0aTry to go to the next lesson with a cascade of two 'next' messages:\x22\x0a\x0aProfStef");
  430. return $1;
  431. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxCascade",{},globals.SmalltalkSyntaxTutorial)})},
  432. args: [],
  433. source: "messageSyntaxCascade\x0a\x09^ Lesson\x0atitle: 'Message syntax: Cascade' \x0acontents: \x0a'\x22; is the cascade operator. It''s useful to send message to the SAME receiver\x0aOpen a Transcript (console):\x22\x0a\x0aTranscript open.\x0a\x0a\x22Then:\x22\x0a\x0aTranscript show: ''hello''.\x0aTranscript show: ''Smalltalk''.\x0aTranscript cr.\x0a\x0a\x22is equivalent to:\x22\x0a\x0aTranscript \x0a\x09 show: ''hello'';\x0a\x09 show: ''Smalltalk'' ;\x0a\x09 cr.\x0a\x0a\x22You can close the development tools by clicking on the red circle with a cross at the bottom left of the website.\x0aTry to go to the next lesson with a cascade of two ''next'' messages:\x22\x0a\x0aProfStef'.",
  434. messageSends: ["title:contents:"],
  435. referencedClasses: ["Lesson"]
  436. }),
  437. globals.SmalltalkSyntaxTutorial);
  438. smalltalk.addMethod(
  439. smalltalk.method({
  440. selector: "messageSyntaxCascadeShouldNotBeHere",
  441. protocol: 'pages',
  442. fn: function (){
  443. var self=this;
  444. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  445. return smalltalk.withContext(function($ctx1) {
  446. var $1;
  447. $1=_st($Lesson())._title_contents_("Lost ?","\x22Hey, you should not be here !! \x0a\x0aGo back and use a cascade !\x22\x0a\x0aProfStef previous.");
  448. return $1;
  449. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxCascadeShouldNotBeHere",{},globals.SmalltalkSyntaxTutorial)})},
  450. args: [],
  451. source: "messageSyntaxCascadeShouldNotBeHere\x0a\x09^ Lesson\x0atitle: 'Lost ?' \x0acontents: \x0a'\x22Hey, you should not be here !! \x0a\x0aGo back and use a cascade !\x22\x0a\x0aProfStef previous.'.",
  452. messageSends: ["title:contents:"],
  453. referencedClasses: ["Lesson"]
  454. }),
  455. globals.SmalltalkSyntaxTutorial);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "messageSyntaxExecutionOrder",
  459. protocol: 'pages',
  460. fn: function (){
  461. var self=this;
  462. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  463. return smalltalk.withContext(function($ctx1) {
  464. var $1;
  465. $1=_st($Lesson())._title_contents_("Message syntax: Execution order","\x22Unary messages are executed first, then binary messages and finally keyword messages:\x0a Unary > Binary > Keywords\x22\x0a\x0a2.5 + 3.8 rounded.\x0a\x0a3 max: 2 + 2.\x0a \x0a(0@0) class.\x0a\x0a0@0 x: 100.\x0a\x0a(0@0 x: 100) class.\x0a\x0a\x22Between messages of similar precedence, expressions are executed from left to right\x22\x0a\x0a-12345 negated asString reversed.\x0a\x0aProfStef next.");
  466. return $1;
  467. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxExecutionOrder",{},globals.SmalltalkSyntaxTutorial)})},
  468. args: [],
  469. source: "messageSyntaxExecutionOrder\x0a\x09^ Lesson\x0atitle: 'Message syntax: Execution order' \x0acontents: \x0a'\x22Unary messages are executed first, then binary messages and finally keyword messages:\x0a Unary > Binary > Keywords\x22\x0a\x0a2.5 + 3.8 rounded.\x0a\x0a3 max: 2 + 2.\x0a \x0a(0@0) class.\x0a\x0a0@0 x: 100.\x0a\x0a(0@0 x: 100) class.\x0a\x0a\x22Between messages of similar precedence, expressions are executed from left to right\x22\x0a\x0a-12345 negated asString reversed.\x0a\x0aProfStef next.'",
  470. messageSends: ["title:contents:"],
  471. referencedClasses: ["Lesson"]
  472. }),
  473. globals.SmalltalkSyntaxTutorial);
  474. smalltalk.addMethod(
  475. smalltalk.method({
  476. selector: "messageSyntaxExecutionOrderParentheses",
  477. protocol: 'pages',
  478. fn: function (){
  479. var self=this;
  480. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  481. return smalltalk.withContext(function($ctx1) {
  482. var $1;
  483. $1=_st($Lesson())._title_contents_("Message syntax: Parentheses","\x22Use parentheses to change order of evaluation\x22\x0a\x0a(2.5 + 3.8) rounded.\x0a\x0a(3 max: 2) + 2.\x0a\x0aProfStef next.");
  484. return $1;
  485. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxExecutionOrderParentheses",{},globals.SmalltalkSyntaxTutorial)})},
  486. args: [],
  487. source: "messageSyntaxExecutionOrderParentheses\x0a\x09^ Lesson\x0atitle: 'Message syntax: Parentheses'\x0acontents: \x0a'\x22Use parentheses to change order of evaluation\x22\x0a\x0a(2.5 + 3.8) rounded.\x0a\x0a(3 max: 2) + 2.\x0a\x0aProfStef next.'",
  488. messageSends: ["title:contents:"],
  489. referencedClasses: ["Lesson"]
  490. }),
  491. globals.SmalltalkSyntaxTutorial);
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "messageSyntaxKeyword",
  495. protocol: 'pages',
  496. fn: function (){
  497. var self=this;
  498. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  499. return smalltalk.withContext(function($ctx1) {
  500. var $1;
  501. $1=_st($Lesson())._title_contents_("Message syntax: Keyword messages","\x22Keyword Messages are messages with arguments. They have the following form:\x0a anObject akey: anotherObject akey2: anotherObject2\x22\x0a\x0a'Web development is a good deal of pain' copyFrom: 1 to: 30\x0a\x0a\x22The message is copyFrom:to: sent to the String 'Web development is a good deal of pain'\x22\x0a\x0a1 max: 3.\x0a\x0aArray with: 'hello' with: 2 with: Smalltalk.\x0a\x0a\x22The message is with:with:with: implemented on class Array. Note you can also write\x22\x0a\x0aArray\x0a\x09with: 'Hi there!'\x0a\x09with: 2\x0a\x09with: Smalltalk.\x0a\x09\x0aProfStef perform: 'next'.");
  502. return $1;
  503. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxKeyword",{},globals.SmalltalkSyntaxTutorial)})},
  504. args: [],
  505. source: "messageSyntaxKeyword\x0a\x09^ Lesson\x0atitle: 'Message syntax: Keyword messages' \x0acontents: \x0a'\x22Keyword Messages are messages with arguments. They have the following form:\x0a anObject akey: anotherObject akey2: anotherObject2\x22\x0a\x0a''Web development is a good deal of pain'' copyFrom: 1 to: 30\x0a\x0a\x22The message is copyFrom:to: sent to the String ''Web development is a good deal of pain''\x22\x0a\x0a1 max: 3.\x0a\x0aArray with: ''hello'' with: 2 with: Smalltalk.\x0a\x0a\x22The message is with:with:with: implemented on class Array. Note you can also write\x22\x0a\x0aArray\x0a\x09with: ''Hi there!''\x0a\x09with: 2\x0a\x09with: Smalltalk.\x0a\x09\x0aProfStef perform: ''next''.'",
  506. messageSends: ["title:contents:"],
  507. referencedClasses: ["Lesson"]
  508. }),
  509. globals.SmalltalkSyntaxTutorial);
  510. smalltalk.addMethod(
  511. smalltalk.method({
  512. selector: "messageSyntaxUnary",
  513. protocol: 'pages',
  514. fn: function (){
  515. var self=this;
  516. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  517. return smalltalk.withContext(function($ctx1) {
  518. var $1;
  519. $1=_st($Lesson())._title_contents_("Message syntax: Unary messages","\x22Messages are sent to objects. There are three types of message: Unary, Binary and Keyword.\x0a\x0aUnary messages have the following form:\x0a anObject aMessage \x0a\x0aYou've already sent unary messages. For example:\x22\x0a\x0a1 class.\x0a\x0afalse not.\x0a\x0aDate today.\x0a\x0aNumber pi.\x0a\x0a\x22And of course: \x22\x0a\x0aProfStef next.");
  520. return $1;
  521. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxUnary",{},globals.SmalltalkSyntaxTutorial)})},
  522. args: [],
  523. source: "messageSyntaxUnary\x0a\x09^ Lesson\x0atitle: 'Message syntax: Unary messages' \x0acontents: \x0a'\x22Messages are sent to objects. There are three types of message: Unary, Binary and Keyword.\x0a\x0aUnary messages have the following form:\x0a anObject aMessage \x0a\x0aYou''ve already sent unary messages. For example:\x22\x0a\x0a1 class.\x0a\x0afalse not.\x0a\x0aDate today.\x0a\x0aNumber pi.\x0a\x0a\x22And of course: \x22\x0a\x0aProfStef next.'",
  524. messageSends: ["title:contents:"],
  525. referencedClasses: ["Lesson"]
  526. }),
  527. globals.SmalltalkSyntaxTutorial);
  528. smalltalk.addMethod(
  529. smalltalk.method({
  530. selector: "pharoEnvironment",
  531. protocol: 'pages',
  532. fn: function (){
  533. var self=this;
  534. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  535. return smalltalk.withContext(function($ctx1) {
  536. var $1;
  537. $1=_st($Lesson())._title_contents_("Pharo environment","\x22Every Smalltalk system is full of objects.\x0aThere are windows, text, numbers, dates, colors, points and much more.\x0aYou can interact with objects in a much more direct way than is possible with other programming languages.\x0a\x0aEvery object understands the message 'explore'. As a result, you get an Explorer window that shows details about the object.\x22\x0a\x0aDate today explore.\x0a\x0a\x22This shows that the date object consists of a point in time (start) and a duration (one day long).\x22\x0a\x0aProfStef explore.\x0a\x0a\x22You see, ProfStef class has a lot of objects. Let's take a look at my code:\x22\x0a\x0aProfStef browse.\x0a\x0aProfStef next.");
  538. return $1;
  539. }, function($ctx1) {$ctx1.fill(self,"pharoEnvironment",{},globals.SmalltalkSyntaxTutorial)})},
  540. args: [],
  541. source: "pharoEnvironment\x0a\x09^ Lesson\x0atitle: 'Pharo environment' \x0acontents: \x0a'\x22Every Smalltalk system is full of objects.\x0aThere are windows, text, numbers, dates, colors, points and much more.\x0aYou can interact with objects in a much more direct way than is possible with other programming languages.\x0a\x0aEvery object understands the message ''explore''. As a result, you get an Explorer window that shows details about the object.\x22\x0a\x0aDate today explore.\x0a\x0a\x22This shows that the date object consists of a point in time (start) and a duration (one day long).\x22\x0a\x0aProfStef explore.\x0a\x0a\x22You see, ProfStef class has a lot of objects. Let''s take a look at my code:\x22\x0a\x0aProfStef browse.\x0a\x0aProfStef next.'",
  542. messageSends: ["title:contents:"],
  543. referencedClasses: ["Lesson"]
  544. }),
  545. globals.SmalltalkSyntaxTutorial);
  546. smalltalk.addMethod(
  547. smalltalk.method({
  548. selector: "printing",
  549. protocol: 'pages',
  550. fn: function (){
  551. var self=this;
  552. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  553. return smalltalk.withContext(function($ctx1) {
  554. var $1;
  555. $1=_st($Lesson())._title_contents_("Doing VS Printing: Printing","\x22Now you're a Do It master ! Let's talk about printing.\x0aIt's a Do It which prints the result next to the expression you've selected.\x0aFor example, select the text below, and click on 'PrintIt':\x22\x0a\x0a1 + 2.\x0a\x0a\x22As with 'DoIt', there is also a shortcut to execute this command.\x0a\x0aTry CTRL-p on the following expressions:\x22\x0a\x0aDate today.\x0a\x0a\x22The result is selected, so you can erase it using the backspace key. Try it !\x22\x0a\x0aDate today asDateString.\x0a\x0aDate today asTimeString.\x0a\x0aProfStef next.");
  556. return $1;
  557. }, function($ctx1) {$ctx1.fill(self,"printing",{},globals.SmalltalkSyntaxTutorial)})},
  558. args: [],
  559. source: "printing \x0a\x09^ Lesson\x0atitle: 'Doing VS Printing: Printing' \x0acontents: \x0a'\x22Now you''re a Do It master ! Let''s talk about printing.\x0aIt''s a Do It which prints the result next to the expression you''ve selected.\x0aFor example, select the text below, and click on ''PrintIt'':\x22\x0a\x0a1 + 2.\x0a\x0a\x22As with ''DoIt'', there is also a shortcut to execute this command.\x0a\x0aTry CTRL-p on the following expressions:\x22\x0a\x0aDate today.\x0a\x0a\x22The result is selected, so you can erase it using the backspace key. Try it !\x22\x0a\x0aDate today asDateString.\x0a\x0aDate today asTimeString.\x0a\x0aProfStef next.'",
  560. messageSends: ["title:contents:"],
  561. referencedClasses: ["Lesson"]
  562. }),
  563. globals.SmalltalkSyntaxTutorial);
  564. smalltalk.addMethod(
  565. smalltalk.method({
  566. selector: "reflection",
  567. protocol: 'pages',
  568. fn: function (){
  569. var self=this;
  570. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  571. return smalltalk.withContext(function($ctx1) {
  572. var $1;
  573. $1=_st($Lesson())._title_contents_("Reflection","\x22You can inspect and change the system at runtime.\x0a\x0aTake a look at the source code of the method #and: of the class Boolean:\x22\x0a\x0a(Boolean methodDictionary at: 'and:') source.\x0a\x0a\x22Or all the methods it sends:\x22\x0a\x0a(Boolean methodDictionary at: 'and:') messageSends.\x0a\x0a\x22Here's all the methods I implement:\x22\x0a\x0aProfStef methodDictionary.\x0a\x0a\x22Let's create a new method to go to the next lesson:\x22\x0a\x0a|newMethod|\x0anewMethod := Compiler new load: 'goToNextLesson ProfStef next.' forClass: ProfStef.\x0aProfStef class addCompiledMethod: newMethod\x0a\x0a\x22Wow! I can't wait to use my new method!\x22\x0a\x0aProfStef goToNextLesson.");
  574. return $1;
  575. }, function($ctx1) {$ctx1.fill(self,"reflection",{},globals.SmalltalkSyntaxTutorial)})},
  576. args: [],
  577. source: "reflection\x0a\x09^ Lesson\x0atitle: 'Reflection' \x0acontents: \x0a'\x22You can inspect and change the system at runtime.\x0a\x0aTake a look at the source code of the method #and: of the class Boolean:\x22\x0a\x0a(Boolean methodDictionary at: ''and:'') source.\x0a\x0a\x22Or all the methods it sends:\x22\x0a\x0a(Boolean methodDictionary at: ''and:'') messageSends.\x0a\x0a\x22Here''s all the methods I implement:\x22\x0a\x0aProfStef methodDictionary.\x0a\x0a\x22Let''s create a new method to go to the next lesson:\x22\x0a\x0a|newMethod|\x0anewMethod := Compiler new load: ''goToNextLesson ProfStef next.'' forClass: ProfStef.\x0aProfStef class addCompiledMethod: newMethod\x0a\x0a\x22Wow! I can''t wait to use my new method!\x22\x0a\x0aProfStef goToNextLesson.'",
  578. messageSends: ["title:contents:"],
  579. referencedClasses: ["Lesson"]
  580. }),
  581. globals.SmalltalkSyntaxTutorial);
  582. smalltalk.addMethod(
  583. smalltalk.method({
  584. selector: "reflectionContinued",
  585. protocol: 'pages',
  586. fn: function (){
  587. var self=this;
  588. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  589. return smalltalk.withContext(function($ctx1) {
  590. var $1;
  591. $1=_st($Lesson())._title_contents_("Reflection continued","\x22So cool, isn't it ? Before going further, let's remove this method:\x22\x0a\x0aProfStef class methodAt: #goToNextLesson.\x0a\x0aProfStef class removeCompiledMethod: (ProfStef class methodAt: #goToNextLesson).\x0a\x0aProfStef class methodAt: #goToNextLesson.\x0a\x0a\x0a\x22Then move forward:\x22\x0a\x0aProfStef perform:#next");
  592. return $1;
  593. }, function($ctx1) {$ctx1.fill(self,"reflectionContinued",{},globals.SmalltalkSyntaxTutorial)})},
  594. args: [],
  595. source: "reflectionContinued\x0a\x09^ Lesson\x0atitle: 'Reflection continued' \x0acontents: \x0a'\x22So cool, isn''t it ? Before going further, let''s remove this method:\x22\x0a\x0aProfStef class methodAt: #goToNextLesson.\x0a\x0aProfStef class removeCompiledMethod: (ProfStef class methodAt: #goToNextLesson).\x0a\x0aProfStef class methodAt: #goToNextLesson.\x0a\x0a\x0a\x22Then move forward:\x22\x0a\x0aProfStef perform:#next'",
  596. messageSends: ["title:contents:"],
  597. referencedClasses: ["Lesson"]
  598. }),
  599. globals.SmalltalkSyntaxTutorial);
  600. smalltalk.addMethod(
  601. smalltalk.method({
  602. selector: "tableOfContents",
  603. protocol: 'contents',
  604. fn: function (){
  605. var self=this;
  606. var $1;
  607. $1=["welcome", "doingVSPrinting", "printing", "basicTypesNumbers", "basicTypesString", "basicTypesArray", "basicTypesDynamicArray", "messageSyntaxUnary", "messageSyntaxBinary", "messageSyntaxKeyword", "messageSyntaxExecutionOrder", "messageSyntaxExecutionOrderParentheses", "mathematicalPrecedence", "messageSyntaxCascade", "messageSyntaxCascadeShouldNotBeHere", "blocks", "blocksAssignation", "conditionals", "loops", "iterators", "instanciation", "reflection", "reflectionContinued", "theEnd"];
  608. return $1;
  609. },
  610. args: [],
  611. source: "tableOfContents\x0a^ #(\x09'welcome'\x0a\x09'doingVSPrinting'\x0a\x09'printing'\x0a\x0a\x09'basicTypesNumbers'\x0a\x09\x22'basicTypesCharacters'\x22\x0a\x09'basicTypesString'\x0a\x09\x22'basicTypesSymbol'\x22\x0a\x09'basicTypesArray'\x0a\x09'basicTypesDynamicArray'\x0a\x0a\x09'messageSyntaxUnary'\x0a\x09'messageSyntaxBinary'\x0a\x09'messageSyntaxKeyword'\x0a\x09'messageSyntaxExecutionOrder'\x0a\x09'messageSyntaxExecutionOrderParentheses'\x0a\x09'mathematicalPrecedence'\x0a\x09'messageSyntaxCascade'\x0a\x09'messageSyntaxCascadeShouldNotBeHere'\x0a\x0a\x09'blocks'\x0a\x09'blocksAssignation'\x0a\x09'conditionals'\x0a\x09'loops'\x0a\x09'iterators'\x0a\x0a\x09'instanciation'\x0a\x0a\x09'reflection'\x0a\x09'reflectionContinued'\x0a\x09\x22'pharoEnvironment'\x22\x0a\x0a\x09\x22'debugger'\x22\x0a\x09'theEnd' )",
  612. messageSends: [],
  613. referencedClasses: []
  614. }),
  615. globals.SmalltalkSyntaxTutorial);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "theEnd",
  619. protocol: 'pages',
  620. fn: function (){
  621. var self=this;
  622. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  623. return smalltalk.withContext(function($ctx1) {
  624. var $1;
  625. $1=_st($Lesson())._title_contents_("Tutorial done !","\x22This tutorial is done. Enjoy programming Smalltalk with Amber. \x0a\x0aYou can run this tutorial again by evaluating: ProfStef go.\x0a\x0aSee you soon !\x22\x0a");
  626. return $1;
  627. }, function($ctx1) {$ctx1.fill(self,"theEnd",{},globals.SmalltalkSyntaxTutorial)})},
  628. args: [],
  629. source: "theEnd\x0a\x09^ Lesson\x0atitle: 'Tutorial done !' \x0acontents: \x0a'\x22This tutorial is done. Enjoy programming Smalltalk with Amber. \x0a\x0aYou can run this tutorial again by evaluating: ProfStef go.\x0a\x0aSee you soon !\x22\x0a'",
  630. messageSends: ["title:contents:"],
  631. referencedClasses: ["Lesson"]
  632. }),
  633. globals.SmalltalkSyntaxTutorial);
  634. smalltalk.addMethod(
  635. smalltalk.method({
  636. selector: "welcome",
  637. protocol: 'pages',
  638. fn: function (){
  639. var self=this;
  640. function $Lesson(){return globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  641. return smalltalk.withContext(function($ctx1) {
  642. var $1;
  643. $1=_st($Lesson())._title_contents_("Welcome"," \x22Hello! I'm Professor Stef. \x0a\x0aYou must want me to help you learn Smalltalk.\x0a\x0aSo let's go to the first lesson. Select the text below and click on the 'DoIt' button\x22\x0a\x0aProfStef next.");
  644. return $1;
  645. }, function($ctx1) {$ctx1.fill(self,"welcome",{},globals.SmalltalkSyntaxTutorial)})},
  646. args: [],
  647. source: "welcome\x0a\x09^ Lesson\x0atitle: 'Welcome' \x0acontents: \x0a' \x22Hello! I''m Professor Stef. \x0a\x0aYou must want me to help you learn Smalltalk.\x0a\x0aSo let''s go to the first lesson. Select the text below and click on the ''DoIt'' button\x22\x0a\x0aProfStef next.'",
  648. messageSends: ["title:contents:"],
  649. referencedClasses: ["Lesson"]
  650. }),
  651. globals.SmalltalkSyntaxTutorial);
  652. smalltalk.addClass('Lesson', globals.Object, ['title', 'contents'], 'TrySmalltalk');
  653. smalltalk.addMethod(
  654. smalltalk.method({
  655. selector: "contents",
  656. protocol: 'accessing',
  657. fn: function (){
  658. var self=this;
  659. return smalltalk.withContext(function($ctx1) {
  660. var $2,$1,$receiver;
  661. $2=self["@contents"];
  662. if(($receiver = $2) == null || $receiver.isNil){
  663. self["@contents"]="";
  664. $1=self["@contents"];
  665. } else {
  666. $1=$2;
  667. };
  668. return $1;
  669. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Lesson)})},
  670. args: [],
  671. source: "contents\x0a\x09^ contents ifNil: [contents := '']",
  672. messageSends: ["ifNil:"],
  673. referencedClasses: []
  674. }),
  675. globals.Lesson);
  676. smalltalk.addMethod(
  677. smalltalk.method({
  678. selector: "contents:",
  679. protocol: 'accessing',
  680. fn: function (aString){
  681. var self=this;
  682. self["@contents"]=aString;
  683. return self},
  684. args: ["aString"],
  685. source: "contents: aString\x0a\x09contents := aString",
  686. messageSends: [],
  687. referencedClasses: []
  688. }),
  689. globals.Lesson);
  690. smalltalk.addMethod(
  691. smalltalk.method({
  692. selector: "title",
  693. protocol: 'accessing',
  694. fn: function (){
  695. var self=this;
  696. return smalltalk.withContext(function($ctx1) {
  697. var $2,$1,$receiver;
  698. $2=self["@title"];
  699. if(($receiver = $2) == null || $receiver.isNil){
  700. self["@title"]="";
  701. $1=self["@title"];
  702. } else {
  703. $1=$2;
  704. };
  705. return $1;
  706. }, function($ctx1) {$ctx1.fill(self,"title",{},globals.Lesson)})},
  707. args: [],
  708. source: "title\x0a\x09^ title ifNil: [title := '']",
  709. messageSends: ["ifNil:"],
  710. referencedClasses: []
  711. }),
  712. globals.Lesson);
  713. smalltalk.addMethod(
  714. smalltalk.method({
  715. selector: "title:",
  716. protocol: 'accessing',
  717. fn: function (aString){
  718. var self=this;
  719. self["@title"]=aString;
  720. return self},
  721. args: ["aString"],
  722. source: "title: aString\x0a\x09title := aString",
  723. messageSends: [],
  724. referencedClasses: []
  725. }),
  726. globals.Lesson);
  727. smalltalk.addMethod(
  728. smalltalk.method({
  729. selector: "title:contents:",
  730. protocol: 'instance creation',
  731. fn: function (aTitle,someContents){
  732. var self=this;
  733. return smalltalk.withContext(function($ctx1) {
  734. var $2,$3,$1;
  735. $2=self._new();
  736. _st($2)._title_(aTitle);
  737. $3=_st($2)._contents_(someContents);
  738. $1=$3;
  739. return $1;
  740. }, function($ctx1) {$ctx1.fill(self,"title:contents:",{aTitle:aTitle,someContents:someContents},globals.Lesson.klass)})},
  741. args: ["aTitle", "someContents"],
  742. source: "title: aTitle contents: someContents\x0a\x09^ (self new)\x0a\x09\x09title: aTitle;\x0a\x09\x09contents: someContents",
  743. messageSends: ["title:", "new", "contents:"],
  744. referencedClasses: []
  745. }),
  746. globals.Lesson.klass);
  747. smalltalk.addClass('ProfStef', globals.Object, ['tutorialPlayer', 'widget'], 'TrySmalltalk');
  748. globals.ProfStef.comment="A ProfStef is the Smalltalk teacher. To start the tutorial, evaluate:\x0aProfStef go.\x0a\x0aTo go to the next lesson evaluate:\x0aProfStef next.\x0a\x0aTo execute your own tutorial:\x0aProfStef goOn: MyOwnTutorial\x0a\x0aTo see a table of contents with all defined tutorials:\x0aProfStef contents";
  749. smalltalk.addMethod(
  750. smalltalk.method({
  751. selector: "first",
  752. protocol: 'navigation',
  753. fn: function (){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) {
  756. var $1;
  757. _st(self._tutorialPlayer())._first();
  758. $1=self._showCurrentLesson();
  759. return $1;
  760. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.ProfStef)})},
  761. args: [],
  762. source: "first\x0a\x09self tutorialPlayer first.\x0a\x09^ self showCurrentLesson.",
  763. messageSends: ["first", "tutorialPlayer", "showCurrentLesson"],
  764. referencedClasses: []
  765. }),
  766. globals.ProfStef);
  767. smalltalk.addMethod(
  768. smalltalk.method({
  769. selector: "next",
  770. protocol: 'navigation',
  771. fn: function (){
  772. var self=this;
  773. return smalltalk.withContext(function($ctx1) {
  774. var $1;
  775. _st(self._tutorialPlayer())._next();
  776. $1=self._showCurrentLesson();
  777. return $1;
  778. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.ProfStef)})},
  779. args: [],
  780. source: "next\x0a\x09self tutorialPlayer next.\x0a\x09^ self showCurrentLesson.",
  781. messageSends: ["next", "tutorialPlayer", "showCurrentLesson"],
  782. referencedClasses: []
  783. }),
  784. globals.ProfStef);
  785. smalltalk.addMethod(
  786. smalltalk.method({
  787. selector: "previous",
  788. protocol: 'navigation',
  789. fn: function (){
  790. var self=this;
  791. return smalltalk.withContext(function($ctx1) {
  792. var $1;
  793. _st(self._tutorialPlayer())._previous();
  794. $1=self._showCurrentLesson();
  795. return $1;
  796. }, function($ctx1) {$ctx1.fill(self,"previous",{},globals.ProfStef)})},
  797. args: [],
  798. source: "previous\x0a\x09self tutorialPlayer previous.\x0a\x09^ self showCurrentLesson.",
  799. messageSends: ["previous", "tutorialPlayer", "showCurrentLesson"],
  800. referencedClasses: []
  801. }),
  802. globals.ProfStef);
  803. smalltalk.addMethod(
  804. smalltalk.method({
  805. selector: "progress",
  806. protocol: 'accessing',
  807. fn: function (){
  808. var self=this;
  809. return smalltalk.withContext(function($ctx1) {
  810. var $3,$2,$1;
  811. $3=_st("(".__comma(self._tutorialPositionString())).__comma("/");
  812. $ctx1.sendIdx[","]=3;
  813. $2=_st($3).__comma(self._tutorialSizeString());
  814. $ctx1.sendIdx[","]=2;
  815. $1=_st($2).__comma(")");
  816. $ctx1.sendIdx[","]=1;
  817. return $1;
  818. }, function($ctx1) {$ctx1.fill(self,"progress",{},globals.ProfStef)})},
  819. args: [],
  820. source: "progress\x0a\x09^ '(', self tutorialPositionString, '/', self tutorialSizeString, ')'.",
  821. messageSends: [",", "tutorialPositionString", "tutorialSizeString"],
  822. referencedClasses: []
  823. }),
  824. globals.ProfStef);
  825. smalltalk.addMethod(
  826. smalltalk.method({
  827. selector: "showCurrentLesson",
  828. protocol: 'accessing',
  829. fn: function (){
  830. var self=this;
  831. var lesson;
  832. return smalltalk.withContext(function($ctx1) {
  833. var $1,$2;
  834. lesson=_st(self._tutorialPlayer())._currentLesson();
  835. _st(self["@widget"])._contents_(_st(lesson)._contents());
  836. $1=self["@widget"];
  837. $2=_st(_st(_st(lesson)._title()).__comma(" ")).__comma(self._progress());
  838. $ctx1.sendIdx[","]=1;
  839. _st($1)._setTitle_($2);
  840. return self}, function($ctx1) {$ctx1.fill(self,"showCurrentLesson",{lesson:lesson},globals.ProfStef)})},
  841. args: [],
  842. source: "showCurrentLesson\x0a\x09| lesson |\x0a\x09lesson := self tutorialPlayer currentLesson.\x0a\x09widget contents: lesson contents.\x0a\x09widget setTitle: lesson title , ' ' , self progress.",
  843. messageSends: ["currentLesson", "tutorialPlayer", "contents:", "contents", "setTitle:", ",", "title", "progress"],
  844. referencedClasses: []
  845. }),
  846. globals.ProfStef);
  847. smalltalk.addMethod(
  848. smalltalk.method({
  849. selector: "tutorialPlayer",
  850. protocol: 'accessing',
  851. fn: function (){
  852. var self=this;
  853. function $TutorialPlayer(){return globals.TutorialPlayer||(typeof TutorialPlayer=="undefined"?nil:TutorialPlayer)}
  854. return smalltalk.withContext(function($ctx1) {
  855. var $2,$1,$receiver;
  856. $2=self["@tutorialPlayer"];
  857. if(($receiver = $2) == null || $receiver.isNil){
  858. self["@tutorialPlayer"]=_st($TutorialPlayer())._new();
  859. $1=self["@tutorialPlayer"];
  860. } else {
  861. $1=$2;
  862. };
  863. return $1;
  864. }, function($ctx1) {$ctx1.fill(self,"tutorialPlayer",{},globals.ProfStef)})},
  865. args: [],
  866. source: "tutorialPlayer\x0a\x09^ tutorialPlayer ifNil: [tutorialPlayer := TutorialPlayer new]",
  867. messageSends: ["ifNil:", "new"],
  868. referencedClasses: ["TutorialPlayer"]
  869. }),
  870. globals.ProfStef);
  871. smalltalk.addMethod(
  872. smalltalk.method({
  873. selector: "tutorialPositionString",
  874. protocol: 'accessing',
  875. fn: function (){
  876. var self=this;
  877. return smalltalk.withContext(function($ctx1) {
  878. var $1;
  879. $1=_st(_st(self._tutorialPlayer())._tutorialPosition())._asString();
  880. return $1;
  881. }, function($ctx1) {$ctx1.fill(self,"tutorialPositionString",{},globals.ProfStef)})},
  882. args: [],
  883. source: "tutorialPositionString\x0a\x09^ self tutorialPlayer tutorialPosition asString.",
  884. messageSends: ["asString", "tutorialPosition", "tutorialPlayer"],
  885. referencedClasses: []
  886. }),
  887. globals.ProfStef);
  888. smalltalk.addMethod(
  889. smalltalk.method({
  890. selector: "tutorialSizeString",
  891. protocol: 'accessing',
  892. fn: function (){
  893. var self=this;
  894. return smalltalk.withContext(function($ctx1) {
  895. var $1;
  896. $1=_st(_st(self._tutorialPlayer())._size())._asString();
  897. return $1;
  898. }, function($ctx1) {$ctx1.fill(self,"tutorialSizeString",{},globals.ProfStef)})},
  899. args: [],
  900. source: "tutorialSizeString\x0a\x09^ self tutorialPlayer size asString",
  901. messageSends: ["asString", "size", "tutorialPlayer"],
  902. referencedClasses: []
  903. }),
  904. globals.ProfStef);
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "widget:",
  908. protocol: 'accessing',
  909. fn: function (aWidget){
  910. var self=this;
  911. self["@widget"]=aWidget;
  912. return self},
  913. args: ["aWidget"],
  914. source: "widget: aWidget\x0a\x09widget := aWidget",
  915. messageSends: [],
  916. referencedClasses: []
  917. }),
  918. globals.ProfStef);
  919. globals.ProfStef.klass.iVarNames = ['instance'];
  920. smalltalk.addMethod(
  921. smalltalk.method({
  922. selector: "default",
  923. protocol: 'initialize',
  924. fn: function (){
  925. var self=this;
  926. return smalltalk.withContext(function($ctx1) {
  927. var $2,$1,$receiver;
  928. $2=self["@instance"];
  929. if(($receiver = $2) == null || $receiver.isNil){
  930. self["@instance"]=self._new();
  931. $1=self["@instance"];
  932. } else {
  933. $1=$2;
  934. };
  935. return $1;
  936. }, function($ctx1) {$ctx1.fill(self,"default",{},globals.ProfStef.klass)})},
  937. args: [],
  938. source: "default \x0a\x09^ instance ifNil: [instance := self new]",
  939. messageSends: ["ifNil:", "new"],
  940. referencedClasses: []
  941. }),
  942. globals.ProfStef.klass);
  943. smalltalk.addMethod(
  944. smalltalk.method({
  945. selector: "first",
  946. protocol: 'navigation',
  947. fn: function (){
  948. var self=this;
  949. return smalltalk.withContext(function($ctx1) {
  950. var $1;
  951. $1=_st(self._default())._first();
  952. return $1;
  953. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.ProfStef.klass)})},
  954. args: [],
  955. source: "first\x0a\x09^ self default first.",
  956. messageSends: ["first", "default"],
  957. referencedClasses: []
  958. }),
  959. globals.ProfStef.klass);
  960. smalltalk.addMethod(
  961. smalltalk.method({
  962. selector: "go",
  963. protocol: 'navigation',
  964. fn: function (){
  965. var self=this;
  966. return smalltalk.withContext(function($ctx1) {
  967. self._first();
  968. return self}, function($ctx1) {$ctx1.fill(self,"go",{},globals.ProfStef.klass)})},
  969. args: [],
  970. source: "go\x0a\x09self first.",
  971. messageSends: ["first"],
  972. referencedClasses: []
  973. }),
  974. globals.ProfStef.klass);
  975. smalltalk.addMethod(
  976. smalltalk.method({
  977. selector: "next",
  978. protocol: 'navigation',
  979. fn: function (){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. var $1;
  983. $1=_st(self._default())._next();
  984. return $1;
  985. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.ProfStef.klass)})},
  986. args: [],
  987. source: "next\x0a\x09^ self default next.",
  988. messageSends: ["next", "default"],
  989. referencedClasses: []
  990. }),
  991. globals.ProfStef.klass);
  992. smalltalk.addMethod(
  993. smalltalk.method({
  994. selector: "previous",
  995. protocol: 'navigation',
  996. fn: function (){
  997. var self=this;
  998. return smalltalk.withContext(function($ctx1) {
  999. var $1;
  1000. $1=_st(self._default())._previous();
  1001. return $1;
  1002. }, function($ctx1) {$ctx1.fill(self,"previous",{},globals.ProfStef.klass)})},
  1003. args: [],
  1004. source: "previous\x0a\x09^ self default previous.",
  1005. messageSends: ["previous", "default"],
  1006. referencedClasses: []
  1007. }),
  1008. globals.ProfStef.klass);
  1009. smalltalk.addClass('TrySmalltalkWidget', globals.Widget, ['workspace', 'contents', 'header'], 'TrySmalltalk');
  1010. smalltalk.addMethod(
  1011. smalltalk.method({
  1012. selector: "contents",
  1013. protocol: 'accessing',
  1014. fn: function (){
  1015. var self=this;
  1016. return smalltalk.withContext(function($ctx1) {
  1017. var $1;
  1018. $1=_st(self._workspace())._val();
  1019. return $1;
  1020. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.TrySmalltalkWidget)})},
  1021. args: [],
  1022. source: "contents\x0a\x09^self workspace val",
  1023. messageSends: ["val", "workspace"],
  1024. referencedClasses: []
  1025. }),
  1026. globals.TrySmalltalkWidget);
  1027. smalltalk.addMethod(
  1028. smalltalk.method({
  1029. selector: "contents:",
  1030. protocol: 'accessing',
  1031. fn: function (aString){
  1032. var self=this;
  1033. return smalltalk.withContext(function($ctx1) {
  1034. _st(self._workspace())._val_(aString);
  1035. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},globals.TrySmalltalkWidget)})},
  1036. args: ["aString"],
  1037. source: "contents: aString\x0a\x09self workspace val: aString",
  1038. messageSends: ["val:", "workspace"],
  1039. referencedClasses: []
  1040. }),
  1041. globals.TrySmalltalkWidget);
  1042. smalltalk.addMethod(
  1043. smalltalk.method({
  1044. selector: "renderButtonsOn:",
  1045. protocol: 'rendering',
  1046. fn: function (html){
  1047. var self=this;
  1048. return smalltalk.withContext(function($ctx1) {
  1049. var $1,$3,$2,$4,$6,$5,$7,$8;
  1050. $1=_st(html)._button();
  1051. $ctx1.sendIdx["button"]=1;
  1052. _st($1)._with_("DoIt");
  1053. $ctx1.sendIdx["with:"]=1;
  1054. _st($1)._title_("ctrl+d");
  1055. $ctx1.sendIdx["title:"]=1;
  1056. $2=_st($1)._onClick_((function(){
  1057. return smalltalk.withContext(function($ctx2) {
  1058. $3=self._workspace();
  1059. $ctx2.sendIdx["workspace"]=1;
  1060. return _st($3)._doIt();
  1061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1062. $ctx1.sendIdx["onClick:"]=1;
  1063. $4=_st(html)._button();
  1064. $ctx1.sendIdx["button"]=2;
  1065. _st($4)._with_("PrintIt");
  1066. $ctx1.sendIdx["with:"]=2;
  1067. _st($4)._title_("ctrl+p");
  1068. $ctx1.sendIdx["title:"]=2;
  1069. $5=_st($4)._onClick_((function(){
  1070. return smalltalk.withContext(function($ctx2) {
  1071. $6=self._workspace();
  1072. $ctx2.sendIdx["workspace"]=2;
  1073. return _st($6)._printIt();
  1074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1075. $ctx1.sendIdx["onClick:"]=2;
  1076. $7=_st(html)._button();
  1077. _st($7)._with_("InspectIt");
  1078. _st($7)._title_("ctrl+i");
  1079. $8=_st($7)._onClick_((function(){
  1080. return smalltalk.withContext(function($ctx2) {
  1081. return _st(self._workspace())._inspectIt();
  1082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1083. return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.TrySmalltalkWidget)})},
  1084. args: ["html"],
  1085. source: "renderButtonsOn: html\x0a html button\x0a\x09with: 'DoIt';\x0a\x09title: 'ctrl+d';\x0a\x09onClick: [self workspace doIt].\x0a html button\x0a\x09with: 'PrintIt';\x0a\x09title: 'ctrl+p';\x0a\x09onClick: [self workspace printIt].\x0a html button\x0a\x09with: 'InspectIt';\x0a\x09title: 'ctrl+i';\x0a\x09onClick: [self workspace inspectIt]",
  1086. messageSends: ["with:", "button", "title:", "onClick:", "doIt", "workspace", "printIt", "inspectIt"],
  1087. referencedClasses: []
  1088. }),
  1089. globals.TrySmalltalkWidget);
  1090. smalltalk.addMethod(
  1091. smalltalk.method({
  1092. selector: "renderOn:",
  1093. protocol: 'rendering',
  1094. fn: function (html){
  1095. var self=this;
  1096. function $ProfStef(){return globals.ProfStef||(typeof ProfStef=="undefined"?nil:ProfStef)}
  1097. return smalltalk.withContext(function($ctx1) {
  1098. var $1,$2,$3,$4;
  1099. $1=_st(html)._div();
  1100. _st($1)._class_("profStef");
  1101. _st($1)._with_((function(){
  1102. return smalltalk.withContext(function($ctx2) {
  1103. self["@header"]=_st(html)._h2();
  1104. return self["@header"];
  1105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1106. $ctx1.sendIdx["with:"]=1;
  1107. _st($1)._with_((function(){
  1108. return smalltalk.withContext(function($ctx2) {
  1109. return _st(self._workspace())._renderOn_(html);
  1110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1111. $ctx1.sendIdx["with:"]=2;
  1112. $2=_st($1)._with_((function(){
  1113. return smalltalk.withContext(function($ctx2) {
  1114. return self._renderButtonsOn_(html);
  1115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1116. $3=_st($ProfStef())._default();
  1117. _st($3)._widget_(self);
  1118. $4=_st($3)._showCurrentLesson();
  1119. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},globals.TrySmalltalkWidget)})},
  1120. args: ["html"],
  1121. source: "renderOn: html\x0a\x09html div \x0a\x09\x09class: 'profStef'; \x0a\x09\x09with: [header := html h2];\x0a\x09\x09with: [self workspace renderOn: html];\x0a\x09\x09with: [self renderButtonsOn: html].\x0a ProfStef default \x0a\x09\x09widget: self;\x0a\x09\x09showCurrentLesson",
  1122. messageSends: ["class:", "div", "with:", "h2", "renderOn:", "workspace", "renderButtonsOn:", "widget:", "default", "showCurrentLesson"],
  1123. referencedClasses: ["ProfStef"]
  1124. }),
  1125. globals.TrySmalltalkWidget);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "setTitle:",
  1129. protocol: 'accessing',
  1130. fn: function (aString){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) {
  1133. _st(self["@header"])._contents_((function(html){
  1134. return smalltalk.withContext(function($ctx2) {
  1135. return _st(html)._with_(aString);
  1136. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)})}));
  1137. return self}, function($ctx1) {$ctx1.fill(self,"setTitle:",{aString:aString},globals.TrySmalltalkWidget)})},
  1138. args: ["aString"],
  1139. source: "setTitle: aString\x0a\x09header contents: [:html | html with: aString]",
  1140. messageSends: ["contents:", "with:"],
  1141. referencedClasses: []
  1142. }),
  1143. globals.TrySmalltalkWidget);
  1144. smalltalk.addMethod(
  1145. smalltalk.method({
  1146. selector: "workspace",
  1147. protocol: 'accessing',
  1148. fn: function (){
  1149. var self=this;
  1150. function $SourceArea(){return globals.SourceArea||(typeof SourceArea=="undefined"?nil:SourceArea)}
  1151. return smalltalk.withContext(function($ctx1) {
  1152. var $2,$1,$receiver;
  1153. $2=self["@workspace"];
  1154. if(($receiver = $2) == null || $receiver.isNil){
  1155. self["@workspace"]=_st($SourceArea())._new();
  1156. $1=self["@workspace"];
  1157. } else {
  1158. $1=$2;
  1159. };
  1160. return $1;
  1161. }, function($ctx1) {$ctx1.fill(self,"workspace",{},globals.TrySmalltalkWidget)})},
  1162. args: [],
  1163. source: "workspace\x0a\x09^ workspace ifNil: [\x0a \x09workspace := SourceArea new]",
  1164. messageSends: ["ifNil:", "new"],
  1165. referencedClasses: ["SourceArea"]
  1166. }),
  1167. globals.TrySmalltalkWidget);
  1168. smalltalk.addMethod(
  1169. smalltalk.method({
  1170. selector: "open",
  1171. protocol: 'initialize',
  1172. fn: function (){
  1173. var self=this;
  1174. return smalltalk.withContext(function($ctx1) {
  1175. _st(self._new())._appendToJQuery_("body"._asJQuery());
  1176. return self}, function($ctx1) {$ctx1.fill(self,"open",{},globals.TrySmalltalkWidget.klass)})},
  1177. args: [],
  1178. source: "open\x0a\x09self new appendToJQuery: 'body' asJQuery.",
  1179. messageSends: ["appendToJQuery:", "new", "asJQuery"],
  1180. referencedClasses: []
  1181. }),
  1182. globals.TrySmalltalkWidget.klass);
  1183. smalltalk.addClass('TutorialPlayer', globals.Object, ['tutorialPosition', 'tutorial'], 'TrySmalltalk');
  1184. globals.TutorialPlayer.comment="I can navigate through an AbstractTutorial subclass. With #next and #previous you can go forward and backward through the tutorial.";
  1185. smalltalk.addMethod(
  1186. smalltalk.method({
  1187. selector: "currentLesson",
  1188. protocol: 'accessing',
  1189. fn: function (){
  1190. var self=this;
  1191. return smalltalk.withContext(function($ctx1) {
  1192. var $1;
  1193. $1=_st(self._tutorial())._lessonAt_(self._tutorialPosition());
  1194. return $1;
  1195. }, function($ctx1) {$ctx1.fill(self,"currentLesson",{},globals.TutorialPlayer)})},
  1196. args: [],
  1197. source: "currentLesson\x0a\x09^ self tutorial lessonAt: self tutorialPosition.",
  1198. messageSends: ["lessonAt:", "tutorial", "tutorialPosition"],
  1199. referencedClasses: []
  1200. }),
  1201. globals.TutorialPlayer);
  1202. smalltalk.addMethod(
  1203. smalltalk.method({
  1204. selector: "first",
  1205. protocol: 'navigation',
  1206. fn: function (){
  1207. var self=this;
  1208. return smalltalk.withContext(function($ctx1) {
  1209. var $1;
  1210. self._rewind();
  1211. $1=self._currentLesson();
  1212. return $1;
  1213. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.TutorialPlayer)})},
  1214. args: [],
  1215. source: "first\x0a\x09self rewind.\x0a\x09^ self currentLesson",
  1216. messageSends: ["rewind", "currentLesson"],
  1217. referencedClasses: []
  1218. }),
  1219. globals.TutorialPlayer);
  1220. smalltalk.addMethod(
  1221. smalltalk.method({
  1222. selector: "last",
  1223. protocol: 'navigation',
  1224. fn: function (){
  1225. var self=this;
  1226. return smalltalk.withContext(function($ctx1) {
  1227. var $1;
  1228. self["@tutorialPosition"]=self._size();
  1229. $1=self._currentLesson();
  1230. return $1;
  1231. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.TutorialPlayer)})},
  1232. args: [],
  1233. source: "last\x0a\x09tutorialPosition := self size.\x0a\x09^ self currentLesson",
  1234. messageSends: ["size", "currentLesson"],
  1235. referencedClasses: []
  1236. }),
  1237. globals.TutorialPlayer);
  1238. smalltalk.addMethod(
  1239. smalltalk.method({
  1240. selector: "next",
  1241. protocol: 'navigation',
  1242. fn: function (){
  1243. var self=this;
  1244. return smalltalk.withContext(function($ctx1) {
  1245. var $1,$2;
  1246. $1=_st(self._tutorialPosition()).__lt(self._size());
  1247. if(smalltalk.assert($1)){
  1248. self["@tutorialPosition"]=_st(self["@tutorialPosition"]).__plus((1));
  1249. self["@tutorialPosition"];
  1250. };
  1251. $2=self._currentLesson();
  1252. return $2;
  1253. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.TutorialPlayer)})},
  1254. args: [],
  1255. source: "next\x0a\x09self tutorialPosition < self size\x0a\x09\x09ifTrue: [tutorialPosition := tutorialPosition + 1].\x0a\x09^ self currentLesson",
  1256. messageSends: ["ifTrue:", "<", "tutorialPosition", "size", "+", "currentLesson"],
  1257. referencedClasses: []
  1258. }),
  1259. globals.TutorialPlayer);
  1260. smalltalk.addMethod(
  1261. smalltalk.method({
  1262. selector: "previous",
  1263. protocol: 'navigation',
  1264. fn: function (){
  1265. var self=this;
  1266. return smalltalk.withContext(function($ctx1) {
  1267. var $1,$2;
  1268. $1=_st(self["@tutorialPosition"]).__gt((1));
  1269. if(smalltalk.assert($1)){
  1270. self["@tutorialPosition"]=_st(self["@tutorialPosition"]).__minus((1));
  1271. self["@tutorialPosition"];
  1272. };
  1273. $2=self._currentLesson();
  1274. return $2;
  1275. }, function($ctx1) {$ctx1.fill(self,"previous",{},globals.TutorialPlayer)})},
  1276. args: [],
  1277. source: "previous\x0a\x09tutorialPosition > 1 ifTrue: [tutorialPosition := tutorialPosition - 1].\x0a\x09^ self currentLesson",
  1278. messageSends: ["ifTrue:", ">", "-", "currentLesson"],
  1279. referencedClasses: []
  1280. }),
  1281. globals.TutorialPlayer);
  1282. smalltalk.addMethod(
  1283. smalltalk.method({
  1284. selector: "rewind",
  1285. protocol: 'navigation',
  1286. fn: function (){
  1287. var self=this;
  1288. self["@tutorialPosition"]=(1);
  1289. return self},
  1290. args: [],
  1291. source: "rewind\x0a\x09tutorialPosition := 1.",
  1292. messageSends: [],
  1293. referencedClasses: []
  1294. }),
  1295. globals.TutorialPlayer);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "size",
  1299. protocol: 'accessing',
  1300. fn: function (){
  1301. var self=this;
  1302. return smalltalk.withContext(function($ctx1) {
  1303. var $1;
  1304. $1=_st(self._tutorial())._size();
  1305. return $1;
  1306. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.TutorialPlayer)})},
  1307. args: [],
  1308. source: "size\x0a\x09^ self tutorial size",
  1309. messageSends: ["size", "tutorial"],
  1310. referencedClasses: []
  1311. }),
  1312. globals.TutorialPlayer);
  1313. smalltalk.addMethod(
  1314. smalltalk.method({
  1315. selector: "tutorial",
  1316. protocol: 'accessing',
  1317. fn: function (){
  1318. var self=this;
  1319. function $SmalltalkSyntaxTutorial(){return globals.SmalltalkSyntaxTutorial||(typeof SmalltalkSyntaxTutorial=="undefined"?nil:SmalltalkSyntaxTutorial)}
  1320. return smalltalk.withContext(function($ctx1) {
  1321. var $2,$1,$receiver;
  1322. $2=self["@tutorial"];
  1323. if(($receiver = $2) == null || $receiver.isNil){
  1324. self["@tutorial"]=_st($SmalltalkSyntaxTutorial())._new();
  1325. $1=self["@tutorial"];
  1326. } else {
  1327. $1=$2;
  1328. };
  1329. return $1;
  1330. }, function($ctx1) {$ctx1.fill(self,"tutorial",{},globals.TutorialPlayer)})},
  1331. args: [],
  1332. source: "tutorial\x0a\x09^ tutorial ifNil: [tutorial := SmalltalkSyntaxTutorial new]",
  1333. messageSends: ["ifNil:", "new"],
  1334. referencedClasses: ["SmalltalkSyntaxTutorial"]
  1335. }),
  1336. globals.TutorialPlayer);
  1337. smalltalk.addMethod(
  1338. smalltalk.method({
  1339. selector: "tutorial:",
  1340. protocol: 'accessing',
  1341. fn: function (aTutorial){
  1342. var self=this;
  1343. self["@tutorial"]=aTutorial;
  1344. return self},
  1345. args: ["aTutorial"],
  1346. source: "tutorial: aTutorial\x0a\x09tutorial := aTutorial",
  1347. messageSends: [],
  1348. referencedClasses: []
  1349. }),
  1350. globals.TutorialPlayer);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "tutorialPosition",
  1354. protocol: 'accessing',
  1355. fn: function (){
  1356. var self=this;
  1357. return smalltalk.withContext(function($ctx1) {
  1358. var $2,$1,$receiver;
  1359. $2=self["@tutorialPosition"];
  1360. if(($receiver = $2) == null || $receiver.isNil){
  1361. self._rewind();
  1362. $1=self["@tutorialPosition"];
  1363. } else {
  1364. $1=$2;
  1365. };
  1366. return $1;
  1367. }, function($ctx1) {$ctx1.fill(self,"tutorialPosition",{},globals.TutorialPlayer)})},
  1368. args: [],
  1369. source: "tutorialPosition \x0a\x09^ tutorialPosition ifNil: [\x0a\x09\x09self rewind.\x0a\x09\x09tutorialPosition.\x0a\x09].",
  1370. messageSends: ["ifNil:", "rewind"],
  1371. referencedClasses: []
  1372. }),
  1373. globals.TutorialPlayer);
  1374. smalltalk.addMethod(
  1375. smalltalk.method({
  1376. selector: "tutorialPosition:",
  1377. protocol: 'accessing',
  1378. fn: function (aTutorialPosition){
  1379. var self=this;
  1380. self["@tutorialPosition"]=aTutorialPosition;
  1381. return self},
  1382. args: ["aTutorialPosition"],
  1383. source: "tutorialPosition: aTutorialPosition \x0a\x09tutorialPosition := aTutorialPosition",
  1384. messageSends: [],
  1385. referencedClasses: []
  1386. }),
  1387. globals.TutorialPlayer);
  1388. });