TrySmalltalk.js 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041
  1. define("amber-trysmalltalk/TrySmalltalk", ["amber/boot", "amber_core/Kernel-Objects", "amber/web/Web"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('TrySmalltalk');
  4. $core.packages["TrySmalltalk"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["TrySmalltalk"].transport = {"type":"amd","amdNamespace":"amber-trysmalltalk"};
  6. $core.addClass('AbstractTutorial', $globals.Object, [], 'TrySmalltalk');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $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.";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "indexOfLesson:",
  13. protocol: 'accessing',
  14. fn: function (aSelector){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $1;
  20. $1=$recv(self._tableOfContents())._indexOf_(aSelector);
  21. return $1;
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. }, function($ctx1) {$ctx1.fill(self,"indexOfLesson:",{aSelector:aSelector},$globals.AbstractTutorial)});
  24. //>>excludeEnd("ctx");
  25. },
  26. //>>excludeStart("ide", pragmas.excludeIdeData);
  27. args: ["aSelector"],
  28. source: "indexOfLesson: aSelector\x0a\x09^self tableOfContents indexOf: aSelector.",
  29. referencedClasses: [],
  30. //>>excludeEnd("ide");
  31. messageSends: ["indexOf:", "tableOfContents"]
  32. }),
  33. $globals.AbstractTutorial);
  34. $core.addMethod(
  35. $core.method({
  36. selector: "lessonAt:",
  37. protocol: 'accessing',
  38. fn: function (anInteger){
  39. var self=this;
  40. var lessonSelector;
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx1) {
  43. //>>excludeEnd("ctx");
  44. var $1;
  45. lessonSelector=$recv(self._tableOfContents())._at_(anInteger);
  46. $1=self._perform_(lessonSelector);
  47. return $1;
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. }, function($ctx1) {$ctx1.fill(self,"lessonAt:",{anInteger:anInteger,lessonSelector:lessonSelector},$globals.AbstractTutorial)});
  50. //>>excludeEnd("ctx");
  51. },
  52. //>>excludeStart("ide", pragmas.excludeIdeData);
  53. args: ["anInteger"],
  54. source: "lessonAt: anInteger\x0a\x09| lessonSelector |\x0a\x09lessonSelector := self tableOfContents at: anInteger.\x0a\x09^ self perform: lessonSelector.",
  55. referencedClasses: [],
  56. //>>excludeEnd("ide");
  57. messageSends: ["at:", "tableOfContents", "perform:"]
  58. }),
  59. $globals.AbstractTutorial);
  60. $core.addMethod(
  61. $core.method({
  62. selector: "size",
  63. protocol: 'accessing',
  64. fn: function (){
  65. var self=this;
  66. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  67. return $core.withContext(function($ctx1) {
  68. //>>excludeEnd("ctx");
  69. var $1;
  70. $1=$recv(self._tableOfContents())._size();
  71. return $1;
  72. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  73. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AbstractTutorial)});
  74. //>>excludeEnd("ctx");
  75. },
  76. //>>excludeStart("ide", pragmas.excludeIdeData);
  77. args: [],
  78. source: "size\x0a\x09^ self tableOfContents size",
  79. referencedClasses: [],
  80. //>>excludeEnd("ide");
  81. messageSends: ["size", "tableOfContents"]
  82. }),
  83. $globals.AbstractTutorial);
  84. $core.addMethod(
  85. $core.method({
  86. selector: "tableOfContents",
  87. protocol: 'accessing',
  88. fn: function (){
  89. var self=this;
  90. var $1;
  91. $1=["welcome", "testLesson", "theEnd"];
  92. return $1;
  93. },
  94. //>>excludeStart("ide", pragmas.excludeIdeData);
  95. args: [],
  96. source: "tableOfContents\x0a^ #(\x0a 'welcome'\x0a 'testLesson'\x0a 'theEnd'\x0a)",
  97. referencedClasses: [],
  98. //>>excludeEnd("ide");
  99. messageSends: []
  100. }),
  101. $globals.AbstractTutorial);
  102. $core.addMethod(
  103. $core.method({
  104. selector: "testLesson",
  105. protocol: 'pages',
  106. fn: function (){
  107. var self=this;
  108. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  110. return $core.withContext(function($ctx1) {
  111. //>>excludeEnd("ctx");
  112. var $1;
  113. $1=$recv($Lesson())._title_contents_("Test Lesson","\x22This lesson is a test\x22");
  114. return $1;
  115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  116. }, function($ctx1) {$ctx1.fill(self,"testLesson",{},$globals.AbstractTutorial)});
  117. //>>excludeEnd("ctx");
  118. },
  119. //>>excludeStart("ide", pragmas.excludeIdeData);
  120. args: [],
  121. source: "testLesson\x0a\x09^ Lesson\x0a\x09\x09title: 'Test Lesson' \x0a\x09\x09contents: '\x22This lesson is a test\x22'",
  122. referencedClasses: ["Lesson"],
  123. //>>excludeEnd("ide");
  124. messageSends: ["title:contents:"]
  125. }),
  126. $globals.AbstractTutorial);
  127. $core.addMethod(
  128. $core.method({
  129. selector: "theEnd",
  130. protocol: 'pages',
  131. fn: function (){
  132. var self=this;
  133. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  135. return $core.withContext(function($ctx1) {
  136. //>>excludeEnd("ctx");
  137. var $1;
  138. $1=$recv($Lesson())._title_contents_("The End","\x22And that'd be pretty much it :)\x22");
  139. return $1;
  140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  141. }, function($ctx1) {$ctx1.fill(self,"theEnd",{},$globals.AbstractTutorial)});
  142. //>>excludeEnd("ctx");
  143. },
  144. //>>excludeStart("ide", pragmas.excludeIdeData);
  145. args: [],
  146. source: "theEnd\x0a\x09^ Lesson\x0a\x09\x09title: 'The End' \x0a\x09\x09contents: '\x22And that''d be pretty much it :)\x22'",
  147. referencedClasses: ["Lesson"],
  148. //>>excludeEnd("ide");
  149. messageSends: ["title:contents:"]
  150. }),
  151. $globals.AbstractTutorial);
  152. $core.addMethod(
  153. $core.method({
  154. selector: "welcome",
  155. protocol: 'pages',
  156. fn: function (){
  157. var self=this;
  158. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  160. return $core.withContext(function($ctx1) {
  161. //>>excludeEnd("ctx");
  162. var $1;
  163. $1=$recv($Lesson())._title_contents_("Welcome","\x22Hi, this is a test tutorial.\x22");
  164. return $1;
  165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  166. }, function($ctx1) {$ctx1.fill(self,"welcome",{},$globals.AbstractTutorial)});
  167. //>>excludeEnd("ctx");
  168. },
  169. //>>excludeStart("ide", pragmas.excludeIdeData);
  170. args: [],
  171. source: "welcome\x0a\x09^ Lesson\x0a\x09\x09title: 'Welcome' \x0a\x09\x09contents: '\x22Hi, this is a test tutorial.\x22'",
  172. referencedClasses: ["Lesson"],
  173. //>>excludeEnd("ide");
  174. messageSends: ["title:contents:"]
  175. }),
  176. $globals.AbstractTutorial);
  177. $core.addClass('SmalltalkSyntaxTutorial', $globals.AbstractTutorial, [], 'TrySmalltalk');
  178. //>>excludeStart("ide", pragmas.excludeIdeData);
  179. $globals.SmalltalkSyntaxTutorial.comment="The default ProfStef tutorial to learn Smalltalk syntax";
  180. //>>excludeEnd("ide");
  181. $core.addMethod(
  182. $core.method({
  183. selector: "basicTypesArray",
  184. protocol: 'pages',
  185. fn: function (){
  186. var self=this;
  187. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. return $core.withContext(function($ctx1) {
  190. //>>excludeEnd("ctx");
  191. var $1;
  192. $1=$recv($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.");
  193. return $1;
  194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  195. }, function($ctx1) {$ctx1.fill(self,"basicTypesArray",{},$globals.SmalltalkSyntaxTutorial)});
  196. //>>excludeEnd("ctx");
  197. },
  198. //>>excludeStart("ide", pragmas.excludeIdeData);
  199. args: [],
  200. 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.'",
  201. referencedClasses: ["Lesson"],
  202. //>>excludeEnd("ide");
  203. messageSends: ["title:contents:"]
  204. }),
  205. $globals.SmalltalkSyntaxTutorial);
  206. $core.addMethod(
  207. $core.method({
  208. selector: "basicTypesCharacters",
  209. protocol: 'pages',
  210. fn: function (){
  211. var self=this;
  212. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  214. return $core.withContext(function($ctx1) {
  215. //>>excludeEnd("ctx");
  216. var $1;
  217. $1=$recv($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.");
  218. return $1;
  219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  220. }, function($ctx1) {$ctx1.fill(self,"basicTypesCharacters",{},$globals.SmalltalkSyntaxTutorial)});
  221. //>>excludeEnd("ctx");
  222. },
  223. //>>excludeStart("ide", pragmas.excludeIdeData);
  224. args: [],
  225. 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.'",
  226. referencedClasses: ["Lesson"],
  227. //>>excludeEnd("ide");
  228. messageSends: ["title:contents:"]
  229. }),
  230. $globals.SmalltalkSyntaxTutorial);
  231. $core.addMethod(
  232. $core.method({
  233. selector: "basicTypesDynamicArray",
  234. protocol: 'pages',
  235. fn: function (){
  236. var self=this;
  237. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  239. return $core.withContext(function($ctx1) {
  240. //>>excludeEnd("ctx");
  241. var $1;
  242. $1=$recv($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.");
  243. return $1;
  244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  245. }, function($ctx1) {$ctx1.fill(self,"basicTypesDynamicArray",{},$globals.SmalltalkSyntaxTutorial)});
  246. //>>excludeEnd("ctx");
  247. },
  248. //>>excludeStart("ide", pragmas.excludeIdeData);
  249. args: [],
  250. 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.'",
  251. referencedClasses: ["Lesson"],
  252. //>>excludeEnd("ide");
  253. messageSends: ["title:contents:"]
  254. }),
  255. $globals.SmalltalkSyntaxTutorial);
  256. $core.addMethod(
  257. $core.method({
  258. selector: "basicTypesNumbers",
  259. protocol: 'pages',
  260. fn: function (){
  261. var self=this;
  262. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  264. return $core.withContext(function($ctx1) {
  265. //>>excludeEnd("ctx");
  266. var $1;
  267. $1=$recv($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.");
  268. return $1;
  269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  270. }, function($ctx1) {$ctx1.fill(self,"basicTypesNumbers",{},$globals.SmalltalkSyntaxTutorial)});
  271. //>>excludeEnd("ctx");
  272. },
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. 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.'",
  276. referencedClasses: ["Lesson"],
  277. //>>excludeEnd("ide");
  278. messageSends: ["title:contents:"]
  279. }),
  280. $globals.SmalltalkSyntaxTutorial);
  281. $core.addMethod(
  282. $core.method({
  283. selector: "basicTypesString",
  284. protocol: 'pages',
  285. fn: function (){
  286. var self=this;
  287. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. return $core.withContext(function($ctx1) {
  290. //>>excludeEnd("ctx");
  291. var $1;
  292. $1=$recv($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.");
  293. return $1;
  294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  295. }, function($ctx1) {$ctx1.fill(self,"basicTypesString",{},$globals.SmalltalkSyntaxTutorial)});
  296. //>>excludeEnd("ctx");
  297. },
  298. //>>excludeStart("ide", pragmas.excludeIdeData);
  299. args: [],
  300. 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.'",
  301. referencedClasses: ["Lesson"],
  302. //>>excludeEnd("ide");
  303. messageSends: ["title:contents:"]
  304. }),
  305. $globals.SmalltalkSyntaxTutorial);
  306. $core.addMethod(
  307. $core.method({
  308. selector: "basicTypesSymbol",
  309. protocol: 'pages',
  310. fn: function (){
  311. var self=this;
  312. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  314. return $core.withContext(function($ctx1) {
  315. //>>excludeEnd("ctx");
  316. var $1;
  317. $1=$recv($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.");
  318. return $1;
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. }, function($ctx1) {$ctx1.fill(self,"basicTypesSymbol",{},$globals.SmalltalkSyntaxTutorial)});
  321. //>>excludeEnd("ctx");
  322. },
  323. //>>excludeStart("ide", pragmas.excludeIdeData);
  324. args: [],
  325. 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.'",
  326. referencedClasses: ["Lesson"],
  327. //>>excludeEnd("ide");
  328. messageSends: ["title:contents:"]
  329. }),
  330. $globals.SmalltalkSyntaxTutorial);
  331. $core.addMethod(
  332. $core.method({
  333. selector: "blocks",
  334. protocol: 'pages',
  335. fn: function (){
  336. var self=this;
  337. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  339. return $core.withContext(function($ctx1) {
  340. //>>excludeEnd("ctx");
  341. var $1;
  342. $1=$recv($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.");
  343. return $1;
  344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  345. }, function($ctx1) {$ctx1.fill(self,"blocks",{},$globals.SmalltalkSyntaxTutorial)});
  346. //>>excludeEnd("ctx");
  347. },
  348. //>>excludeStart("ide", pragmas.excludeIdeData);
  349. args: [],
  350. 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.'",
  351. referencedClasses: ["Lesson"],
  352. //>>excludeEnd("ide");
  353. messageSends: ["title:contents:"]
  354. }),
  355. $globals.SmalltalkSyntaxTutorial);
  356. $core.addMethod(
  357. $core.method({
  358. selector: "blocksAssignation",
  359. protocol: 'pages',
  360. fn: function (){
  361. var self=this;
  362. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  364. return $core.withContext(function($ctx1) {
  365. //>>excludeEnd("ctx");
  366. var $1;
  367. $1=$recv($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.");
  368. return $1;
  369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  370. }, function($ctx1) {$ctx1.fill(self,"blocksAssignation",{},$globals.SmalltalkSyntaxTutorial)});
  371. //>>excludeEnd("ctx");
  372. },
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. args: [],
  375. 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.'",
  376. referencedClasses: ["Lesson"],
  377. //>>excludeEnd("ide");
  378. messageSends: ["title:contents:"]
  379. }),
  380. $globals.SmalltalkSyntaxTutorial);
  381. $core.addMethod(
  382. $core.method({
  383. selector: "conditionals",
  384. protocol: 'pages',
  385. fn: function (){
  386. var self=this;
  387. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  389. return $core.withContext(function($ctx1) {
  390. //>>excludeEnd("ctx");
  391. var $1;
  392. $1=$recv($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].");
  393. return $1;
  394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  395. }, function($ctx1) {$ctx1.fill(self,"conditionals",{},$globals.SmalltalkSyntaxTutorial)});
  396. //>>excludeEnd("ctx");
  397. },
  398. //>>excludeStart("ide", pragmas.excludeIdeData);
  399. args: [],
  400. 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].'.",
  401. referencedClasses: ["Lesson"],
  402. //>>excludeEnd("ide");
  403. messageSends: ["title:contents:"]
  404. }),
  405. $globals.SmalltalkSyntaxTutorial);
  406. $core.addMethod(
  407. $core.method({
  408. selector: "debugger",
  409. protocol: 'pages',
  410. fn: function (){
  411. var self=this;
  412. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  414. return $core.withContext(function($ctx1) {
  415. //>>excludeEnd("ctx");
  416. var $1;
  417. $1=$recv($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 ");
  418. return $1;
  419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  420. }, function($ctx1) {$ctx1.fill(self,"debugger",{},$globals.SmalltalkSyntaxTutorial)});
  421. //>>excludeEnd("ctx");
  422. },
  423. //>>excludeStart("ide", pragmas.excludeIdeData);
  424. args: [],
  425. 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 '",
  426. referencedClasses: ["Lesson"],
  427. //>>excludeEnd("ide");
  428. messageSends: ["title:contents:"]
  429. }),
  430. $globals.SmalltalkSyntaxTutorial);
  431. $core.addMethod(
  432. $core.method({
  433. selector: "doingVSPrinting",
  434. protocol: 'pages',
  435. fn: function (){
  436. var self=this;
  437. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  439. return $core.withContext(function($ctx1) {
  440. //>>excludeEnd("ctx");
  441. var $1;
  442. $1=$recv($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.");
  443. return $1;
  444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  445. }, function($ctx1) {$ctx1.fill(self,"doingVSPrinting",{},$globals.SmalltalkSyntaxTutorial)});
  446. //>>excludeEnd("ctx");
  447. },
  448. //>>excludeStart("ide", pragmas.excludeIdeData);
  449. args: [],
  450. 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.'",
  451. referencedClasses: ["Lesson"],
  452. //>>excludeEnd("ide");
  453. messageSends: ["title:contents:"]
  454. }),
  455. $globals.SmalltalkSyntaxTutorial);
  456. $core.addMethod(
  457. $core.method({
  458. selector: "instantiation",
  459. protocol: 'pages',
  460. fn: function (){
  461. var self=this;
  462. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. return $core.withContext(function($ctx1) {
  465. //>>excludeEnd("ctx");
  466. var $1;
  467. $1=$recv($Lesson())._title_contents_("Instantiation","\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");
  468. return $1;
  469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  470. }, function($ctx1) {$ctx1.fill(self,"instantiation",{},$globals.SmalltalkSyntaxTutorial)});
  471. //>>excludeEnd("ctx");
  472. },
  473. //>>excludeStart("ide", pragmas.excludeIdeData);
  474. args: [],
  475. source: "instantiation\x0a\x09^ Lesson\x0atitle: 'Instantiation' \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'",
  476. referencedClasses: ["Lesson"],
  477. //>>excludeEnd("ide");
  478. messageSends: ["title:contents:"]
  479. }),
  480. $globals.SmalltalkSyntaxTutorial);
  481. $core.addMethod(
  482. $core.method({
  483. selector: "iterators",
  484. protocol: 'pages',
  485. fn: function (){
  486. var self=this;
  487. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx1) {
  490. //>>excludeEnd("ctx");
  491. var $1;
  492. $1=$recv($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 classes select: [:eachClass | eachClass name = 'ProfStef']) do: [:eachProfstef | eachProfstef next].");
  493. return $1;
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. }, function($ctx1) {$ctx1.fill(self,"iterators",{},$globals.SmalltalkSyntaxTutorial)});
  496. //>>excludeEnd("ctx");
  497. },
  498. //>>excludeStart("ide", pragmas.excludeIdeData);
  499. args: [],
  500. 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 classes select: [:eachClass | eachClass name = ''ProfStef'']) do: [:eachProfstef | eachProfstef next].'",
  501. referencedClasses: ["Lesson"],
  502. //>>excludeEnd("ide");
  503. messageSends: ["title:contents:"]
  504. }),
  505. $globals.SmalltalkSyntaxTutorial);
  506. $core.addMethod(
  507. $core.method({
  508. selector: "loops",
  509. protocol: 'pages',
  510. fn: function (){
  511. var self=this;
  512. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  514. return $core.withContext(function($ctx1) {
  515. //>>excludeEnd("ctx");
  516. var $1;
  517. $1=$recv($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].");
  518. return $1;
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. }, function($ctx1) {$ctx1.fill(self,"loops",{},$globals.SmalltalkSyntaxTutorial)});
  521. //>>excludeEnd("ctx");
  522. },
  523. //>>excludeStart("ide", pragmas.excludeIdeData);
  524. args: [],
  525. 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].'",
  526. referencedClasses: ["Lesson"],
  527. //>>excludeEnd("ide");
  528. messageSends: ["title:contents:"]
  529. }),
  530. $globals.SmalltalkSyntaxTutorial);
  531. $core.addMethod(
  532. $core.method({
  533. selector: "mathematicalPrecedence",
  534. protocol: 'pages',
  535. fn: function (){
  536. var self=this;
  537. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  539. return $core.withContext(function($ctx1) {
  540. //>>excludeEnd("ctx");
  541. var $1;
  542. $1=$recv($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.");
  543. return $1;
  544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  545. }, function($ctx1) {$ctx1.fill(self,"mathematicalPrecedence",{},$globals.SmalltalkSyntaxTutorial)});
  546. //>>excludeEnd("ctx");
  547. },
  548. //>>excludeStart("ide", pragmas.excludeIdeData);
  549. args: [],
  550. 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.'",
  551. referencedClasses: ["Lesson"],
  552. //>>excludeEnd("ide");
  553. messageSends: ["title:contents:"]
  554. }),
  555. $globals.SmalltalkSyntaxTutorial);
  556. $core.addMethod(
  557. $core.method({
  558. selector: "messageSyntaxBinary",
  559. protocol: 'pages',
  560. fn: function (){
  561. var self=this;
  562. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  564. return $core.withContext(function($ctx1) {
  565. //>>excludeEnd("ctx");
  566. var $1;
  567. $1=$recv($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.");
  568. return $1;
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxBinary",{},$globals.SmalltalkSyntaxTutorial)});
  571. //>>excludeEnd("ctx");
  572. },
  573. //>>excludeStart("ide", pragmas.excludeIdeData);
  574. args: [],
  575. 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.'",
  576. referencedClasses: ["Lesson"],
  577. //>>excludeEnd("ide");
  578. messageSends: ["title:contents:"]
  579. }),
  580. $globals.SmalltalkSyntaxTutorial);
  581. $core.addMethod(
  582. $core.method({
  583. selector: "messageSyntaxCascade",
  584. protocol: 'pages',
  585. fn: function (){
  586. var self=this;
  587. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  589. return $core.withContext(function($ctx1) {
  590. //>>excludeEnd("ctx");
  591. var $1;
  592. $1=$recv($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");
  593. return $1;
  594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  595. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxCascade",{},$globals.SmalltalkSyntaxTutorial)});
  596. //>>excludeEnd("ctx");
  597. },
  598. //>>excludeStart("ide", pragmas.excludeIdeData);
  599. args: [],
  600. 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'.",
  601. referencedClasses: ["Lesson"],
  602. //>>excludeEnd("ide");
  603. messageSends: ["title:contents:"]
  604. }),
  605. $globals.SmalltalkSyntaxTutorial);
  606. $core.addMethod(
  607. $core.method({
  608. selector: "messageSyntaxCascadeShouldNotBeHere",
  609. protocol: 'pages',
  610. fn: function (){
  611. var self=this;
  612. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  614. return $core.withContext(function($ctx1) {
  615. //>>excludeEnd("ctx");
  616. var $1;
  617. $1=$recv($Lesson())._title_contents_("Lost ?","\x22Hey, you should not be here !! \x0a\x0aGo back and use a cascade !\x22\x0a\x0aProfStef previous.");
  618. return $1;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxCascadeShouldNotBeHere",{},$globals.SmalltalkSyntaxTutorial)});
  621. //>>excludeEnd("ctx");
  622. },
  623. //>>excludeStart("ide", pragmas.excludeIdeData);
  624. args: [],
  625. 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.'.",
  626. referencedClasses: ["Lesson"],
  627. //>>excludeEnd("ide");
  628. messageSends: ["title:contents:"]
  629. }),
  630. $globals.SmalltalkSyntaxTutorial);
  631. $core.addMethod(
  632. $core.method({
  633. selector: "messageSyntaxExecutionOrder",
  634. protocol: 'pages',
  635. fn: function (){
  636. var self=this;
  637. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  639. return $core.withContext(function($ctx1) {
  640. //>>excludeEnd("ctx");
  641. var $1;
  642. $1=$recv($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.");
  643. return $1;
  644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  645. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxExecutionOrder",{},$globals.SmalltalkSyntaxTutorial)});
  646. //>>excludeEnd("ctx");
  647. },
  648. //>>excludeStart("ide", pragmas.excludeIdeData);
  649. args: [],
  650. 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.'",
  651. referencedClasses: ["Lesson"],
  652. //>>excludeEnd("ide");
  653. messageSends: ["title:contents:"]
  654. }),
  655. $globals.SmalltalkSyntaxTutorial);
  656. $core.addMethod(
  657. $core.method({
  658. selector: "messageSyntaxExecutionOrderParentheses",
  659. protocol: 'pages',
  660. fn: function (){
  661. var self=this;
  662. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  664. return $core.withContext(function($ctx1) {
  665. //>>excludeEnd("ctx");
  666. var $1;
  667. $1=$recv($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.");
  668. return $1;
  669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  670. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxExecutionOrderParentheses",{},$globals.SmalltalkSyntaxTutorial)});
  671. //>>excludeEnd("ctx");
  672. },
  673. //>>excludeStart("ide", pragmas.excludeIdeData);
  674. args: [],
  675. 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.'",
  676. referencedClasses: ["Lesson"],
  677. //>>excludeEnd("ide");
  678. messageSends: ["title:contents:"]
  679. }),
  680. $globals.SmalltalkSyntaxTutorial);
  681. $core.addMethod(
  682. $core.method({
  683. selector: "messageSyntaxKeyword",
  684. protocol: 'pages',
  685. fn: function (){
  686. var self=this;
  687. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  689. return $core.withContext(function($ctx1) {
  690. //>>excludeEnd("ctx");
  691. var $1;
  692. $1=$recv($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'.");
  693. return $1;
  694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  695. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxKeyword",{},$globals.SmalltalkSyntaxTutorial)});
  696. //>>excludeEnd("ctx");
  697. },
  698. //>>excludeStart("ide", pragmas.excludeIdeData);
  699. args: [],
  700. 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''.'",
  701. referencedClasses: ["Lesson"],
  702. //>>excludeEnd("ide");
  703. messageSends: ["title:contents:"]
  704. }),
  705. $globals.SmalltalkSyntaxTutorial);
  706. $core.addMethod(
  707. $core.method({
  708. selector: "messageSyntaxUnary",
  709. protocol: 'pages',
  710. fn: function (){
  711. var self=this;
  712. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  714. return $core.withContext(function($ctx1) {
  715. //>>excludeEnd("ctx");
  716. var $1;
  717. $1=$recv($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.");
  718. return $1;
  719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  720. }, function($ctx1) {$ctx1.fill(self,"messageSyntaxUnary",{},$globals.SmalltalkSyntaxTutorial)});
  721. //>>excludeEnd("ctx");
  722. },
  723. //>>excludeStart("ide", pragmas.excludeIdeData);
  724. args: [],
  725. 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.'",
  726. referencedClasses: ["Lesson"],
  727. //>>excludeEnd("ide");
  728. messageSends: ["title:contents:"]
  729. }),
  730. $globals.SmalltalkSyntaxTutorial);
  731. $core.addMethod(
  732. $core.method({
  733. selector: "pharoEnvironment",
  734. protocol: 'pages',
  735. fn: function (){
  736. var self=this;
  737. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  739. return $core.withContext(function($ctx1) {
  740. //>>excludeEnd("ctx");
  741. var $1;
  742. $1=$recv($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.");
  743. return $1;
  744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  745. }, function($ctx1) {$ctx1.fill(self,"pharoEnvironment",{},$globals.SmalltalkSyntaxTutorial)});
  746. //>>excludeEnd("ctx");
  747. },
  748. //>>excludeStart("ide", pragmas.excludeIdeData);
  749. args: [],
  750. 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.'",
  751. referencedClasses: ["Lesson"],
  752. //>>excludeEnd("ide");
  753. messageSends: ["title:contents:"]
  754. }),
  755. $globals.SmalltalkSyntaxTutorial);
  756. $core.addMethod(
  757. $core.method({
  758. selector: "printing",
  759. protocol: 'pages',
  760. fn: function (){
  761. var self=this;
  762. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  764. return $core.withContext(function($ctx1) {
  765. //>>excludeEnd("ctx");
  766. var $1;
  767. $1=$recv($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.");
  768. return $1;
  769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  770. }, function($ctx1) {$ctx1.fill(self,"printing",{},$globals.SmalltalkSyntaxTutorial)});
  771. //>>excludeEnd("ctx");
  772. },
  773. //>>excludeStart("ide", pragmas.excludeIdeData);
  774. args: [],
  775. 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.'",
  776. referencedClasses: ["Lesson"],
  777. //>>excludeEnd("ide");
  778. messageSends: ["title:contents:"]
  779. }),
  780. $globals.SmalltalkSyntaxTutorial);
  781. $core.addMethod(
  782. $core.method({
  783. selector: "reflection",
  784. protocol: 'pages',
  785. fn: function (){
  786. var self=this;
  787. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. return $core.withContext(function($ctx1) {
  790. //>>excludeEnd("ctx");
  791. var $1;
  792. $1=$recv($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\x0a\x09install: 'goToNextLesson ProfStef next.'\x0a\x09forClass: ProfStef\x0a\x09protocol: 'navigation'.\x0aProfStef class addCompiledMethod: newMethod\x0a\x0a\x22Wow! I can't wait to use my new method!\x22\x0a\x0aProfStef goToNextLesson.");
  793. return $1;
  794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  795. }, function($ctx1) {$ctx1.fill(self,"reflection",{},$globals.SmalltalkSyntaxTutorial)});
  796. //>>excludeEnd("ctx");
  797. },
  798. //>>excludeStart("ide", pragmas.excludeIdeData);
  799. args: [],
  800. 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\x0a\x09install: ''goToNextLesson ProfStef next.''\x0a\x09forClass: ProfStef\x0a\x09protocol: ''navigation''.\x0aProfStef class addCompiledMethod: newMethod\x0a\x0a\x22Wow! I can''t wait to use my new method!\x22\x0a\x0aProfStef goToNextLesson.'",
  801. referencedClasses: ["Lesson"],
  802. //>>excludeEnd("ide");
  803. messageSends: ["title:contents:"]
  804. }),
  805. $globals.SmalltalkSyntaxTutorial);
  806. $core.addMethod(
  807. $core.method({
  808. selector: "reflectionContinued",
  809. protocol: 'pages',
  810. fn: function (){
  811. var self=this;
  812. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  814. return $core.withContext(function($ctx1) {
  815. //>>excludeEnd("ctx");
  816. var $1;
  817. $1=$recv($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");
  818. return $1;
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. }, function($ctx1) {$ctx1.fill(self,"reflectionContinued",{},$globals.SmalltalkSyntaxTutorial)});
  821. //>>excludeEnd("ctx");
  822. },
  823. //>>excludeStart("ide", pragmas.excludeIdeData);
  824. args: [],
  825. 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'",
  826. referencedClasses: ["Lesson"],
  827. //>>excludeEnd("ide");
  828. messageSends: ["title:contents:"]
  829. }),
  830. $globals.SmalltalkSyntaxTutorial);
  831. $core.addMethod(
  832. $core.method({
  833. selector: "tableOfContents",
  834. protocol: 'contents',
  835. fn: function (){
  836. var self=this;
  837. var $1;
  838. $1=["welcome", "doingVSPrinting", "printing", "basicTypesNumbers", "basicTypesString", "basicTypesArray", "basicTypesDynamicArray", "messageSyntaxUnary", "messageSyntaxBinary", "messageSyntaxKeyword", "messageSyntaxExecutionOrder", "messageSyntaxExecutionOrderParentheses", "mathematicalPrecedence", "messageSyntaxCascade", "messageSyntaxCascadeShouldNotBeHere", "blocks", "blocksAssignation", "conditionals", "loops", "iterators", "instantiation", "reflection", "reflectionContinued", "theEnd"];
  839. return $1;
  840. },
  841. //>>excludeStart("ide", pragmas.excludeIdeData);
  842. args: [],
  843. 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'instantiation'\x0a\x0a\x09'reflection'\x0a\x09'reflectionContinued'\x0a\x09\x22'pharoEnvironment'\x22\x0a\x0a\x09\x22'debugger'\x22\x0a\x09'theEnd' )",
  844. referencedClasses: [],
  845. //>>excludeEnd("ide");
  846. messageSends: []
  847. }),
  848. $globals.SmalltalkSyntaxTutorial);
  849. $core.addMethod(
  850. $core.method({
  851. selector: "theEnd",
  852. protocol: 'pages',
  853. fn: function (){
  854. var self=this;
  855. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  857. return $core.withContext(function($ctx1) {
  858. //>>excludeEnd("ctx");
  859. var $1;
  860. $1=$recv($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");
  861. return $1;
  862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  863. }, function($ctx1) {$ctx1.fill(self,"theEnd",{},$globals.SmalltalkSyntaxTutorial)});
  864. //>>excludeEnd("ctx");
  865. },
  866. //>>excludeStart("ide", pragmas.excludeIdeData);
  867. args: [],
  868. 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'",
  869. referencedClasses: ["Lesson"],
  870. //>>excludeEnd("ide");
  871. messageSends: ["title:contents:"]
  872. }),
  873. $globals.SmalltalkSyntaxTutorial);
  874. $core.addMethod(
  875. $core.method({
  876. selector: "welcome",
  877. protocol: 'pages',
  878. fn: function (){
  879. var self=this;
  880. function $Lesson(){return $globals.Lesson||(typeof Lesson=="undefined"?nil:Lesson)}
  881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  882. return $core.withContext(function($ctx1) {
  883. //>>excludeEnd("ctx");
  884. var $1;
  885. $1=$recv($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.");
  886. return $1;
  887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  888. }, function($ctx1) {$ctx1.fill(self,"welcome",{},$globals.SmalltalkSyntaxTutorial)});
  889. //>>excludeEnd("ctx");
  890. },
  891. //>>excludeStart("ide", pragmas.excludeIdeData);
  892. args: [],
  893. 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.'",
  894. referencedClasses: ["Lesson"],
  895. //>>excludeEnd("ide");
  896. messageSends: ["title:contents:"]
  897. }),
  898. $globals.SmalltalkSyntaxTutorial);
  899. $core.addClass('Lesson', $globals.Object, ['title', 'contents'], 'TrySmalltalk');
  900. $core.addMethod(
  901. $core.method({
  902. selector: "contents",
  903. protocol: 'accessing',
  904. fn: function (){
  905. var self=this;
  906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  907. return $core.withContext(function($ctx1) {
  908. //>>excludeEnd("ctx");
  909. var $2,$1,$receiver;
  910. $2=self["@contents"];
  911. if(($receiver = $2) == null || $receiver.isNil){
  912. self["@contents"]="";
  913. $1=self["@contents"];
  914. } else {
  915. $1=$2;
  916. };
  917. return $1;
  918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  919. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Lesson)});
  920. //>>excludeEnd("ctx");
  921. },
  922. //>>excludeStart("ide", pragmas.excludeIdeData);
  923. args: [],
  924. source: "contents\x0a\x09^ contents ifNil: [contents := '']",
  925. referencedClasses: [],
  926. //>>excludeEnd("ide");
  927. messageSends: ["ifNil:"]
  928. }),
  929. $globals.Lesson);
  930. $core.addMethod(
  931. $core.method({
  932. selector: "contents:",
  933. protocol: 'accessing',
  934. fn: function (aString){
  935. var self=this;
  936. self["@contents"]=aString;
  937. return self;
  938. },
  939. //>>excludeStart("ide", pragmas.excludeIdeData);
  940. args: ["aString"],
  941. source: "contents: aString\x0a\x09contents := aString",
  942. referencedClasses: [],
  943. //>>excludeEnd("ide");
  944. messageSends: []
  945. }),
  946. $globals.Lesson);
  947. $core.addMethod(
  948. $core.method({
  949. selector: "title",
  950. protocol: 'accessing',
  951. fn: function (){
  952. var self=this;
  953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  954. return $core.withContext(function($ctx1) {
  955. //>>excludeEnd("ctx");
  956. var $2,$1,$receiver;
  957. $2=self["@title"];
  958. if(($receiver = $2) == null || $receiver.isNil){
  959. self["@title"]="";
  960. $1=self["@title"];
  961. } else {
  962. $1=$2;
  963. };
  964. return $1;
  965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  966. }, function($ctx1) {$ctx1.fill(self,"title",{},$globals.Lesson)});
  967. //>>excludeEnd("ctx");
  968. },
  969. //>>excludeStart("ide", pragmas.excludeIdeData);
  970. args: [],
  971. source: "title\x0a\x09^ title ifNil: [title := '']",
  972. referencedClasses: [],
  973. //>>excludeEnd("ide");
  974. messageSends: ["ifNil:"]
  975. }),
  976. $globals.Lesson);
  977. $core.addMethod(
  978. $core.method({
  979. selector: "title:",
  980. protocol: 'accessing',
  981. fn: function (aString){
  982. var self=this;
  983. self["@title"]=aString;
  984. return self;
  985. },
  986. //>>excludeStart("ide", pragmas.excludeIdeData);
  987. args: ["aString"],
  988. source: "title: aString\x0a\x09title := aString",
  989. referencedClasses: [],
  990. //>>excludeEnd("ide");
  991. messageSends: []
  992. }),
  993. $globals.Lesson);
  994. $core.addMethod(
  995. $core.method({
  996. selector: "title:contents:",
  997. protocol: 'instance creation',
  998. fn: function (aTitle,someContents){
  999. var self=this;
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. return $core.withContext(function($ctx1) {
  1002. //>>excludeEnd("ctx");
  1003. var $2,$3,$1;
  1004. $2=self._new();
  1005. $recv($2)._title_(aTitle);
  1006. $3=$recv($2)._contents_(someContents);
  1007. $1=$3;
  1008. return $1;
  1009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1010. }, function($ctx1) {$ctx1.fill(self,"title:contents:",{aTitle:aTitle,someContents:someContents},$globals.Lesson.klass)});
  1011. //>>excludeEnd("ctx");
  1012. },
  1013. //>>excludeStart("ide", pragmas.excludeIdeData);
  1014. args: ["aTitle", "someContents"],
  1015. source: "title: aTitle contents: someContents\x0a\x09^ (self new)\x0a\x09\x09title: aTitle;\x0a\x09\x09contents: someContents",
  1016. referencedClasses: [],
  1017. //>>excludeEnd("ide");
  1018. messageSends: ["title:", "new", "contents:"]
  1019. }),
  1020. $globals.Lesson.klass);
  1021. $core.addClass('ProfStef', $globals.Object, ['tutorialPlayer', 'widget'], 'TrySmalltalk');
  1022. //>>excludeStart("ide", pragmas.excludeIdeData);
  1023. $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";
  1024. //>>excludeEnd("ide");
  1025. $core.addMethod(
  1026. $core.method({
  1027. selector: "first",
  1028. protocol: 'navigation',
  1029. fn: function (){
  1030. var self=this;
  1031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1032. return $core.withContext(function($ctx1) {
  1033. //>>excludeEnd("ctx");
  1034. var $1;
  1035. $recv(self._tutorialPlayer())._first();
  1036. $1=self._showCurrentLesson();
  1037. return $1;
  1038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1039. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.ProfStef)});
  1040. //>>excludeEnd("ctx");
  1041. },
  1042. //>>excludeStart("ide", pragmas.excludeIdeData);
  1043. args: [],
  1044. source: "first\x0a\x09self tutorialPlayer first.\x0a\x09^ self showCurrentLesson.",
  1045. referencedClasses: [],
  1046. //>>excludeEnd("ide");
  1047. messageSends: ["first", "tutorialPlayer", "showCurrentLesson"]
  1048. }),
  1049. $globals.ProfStef);
  1050. $core.addMethod(
  1051. $core.method({
  1052. selector: "next",
  1053. protocol: 'navigation',
  1054. fn: function (){
  1055. var self=this;
  1056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1057. return $core.withContext(function($ctx1) {
  1058. //>>excludeEnd("ctx");
  1059. var $1;
  1060. $recv(self._tutorialPlayer())._next();
  1061. $1=self._showCurrentLesson();
  1062. return $1;
  1063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1064. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProfStef)});
  1065. //>>excludeEnd("ctx");
  1066. },
  1067. //>>excludeStart("ide", pragmas.excludeIdeData);
  1068. args: [],
  1069. source: "next\x0a\x09self tutorialPlayer next.\x0a\x09^ self showCurrentLesson.",
  1070. referencedClasses: [],
  1071. //>>excludeEnd("ide");
  1072. messageSends: ["next", "tutorialPlayer", "showCurrentLesson"]
  1073. }),
  1074. $globals.ProfStef);
  1075. $core.addMethod(
  1076. $core.method({
  1077. selector: "previous",
  1078. protocol: 'navigation',
  1079. fn: function (){
  1080. var self=this;
  1081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1082. return $core.withContext(function($ctx1) {
  1083. //>>excludeEnd("ctx");
  1084. var $1;
  1085. $recv(self._tutorialPlayer())._previous();
  1086. $1=self._showCurrentLesson();
  1087. return $1;
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. }, function($ctx1) {$ctx1.fill(self,"previous",{},$globals.ProfStef)});
  1090. //>>excludeEnd("ctx");
  1091. },
  1092. //>>excludeStart("ide", pragmas.excludeIdeData);
  1093. args: [],
  1094. source: "previous\x0a\x09self tutorialPlayer previous.\x0a\x09^ self showCurrentLesson.",
  1095. referencedClasses: [],
  1096. //>>excludeEnd("ide");
  1097. messageSends: ["previous", "tutorialPlayer", "showCurrentLesson"]
  1098. }),
  1099. $globals.ProfStef);
  1100. $core.addMethod(
  1101. $core.method({
  1102. selector: "progress",
  1103. protocol: 'accessing',
  1104. fn: function (){
  1105. var self=this;
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. return $core.withContext(function($ctx1) {
  1108. //>>excludeEnd("ctx");
  1109. var $3,$2,$1;
  1110. $3=$recv("(".__comma(self._tutorialPositionString())).__comma("/");
  1111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1112. $ctx1.sendIdx[","]=3;
  1113. //>>excludeEnd("ctx");
  1114. $2=$recv($3).__comma(self._tutorialSizeString());
  1115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1116. $ctx1.sendIdx[","]=2;
  1117. //>>excludeEnd("ctx");
  1118. $1=$recv($2).__comma(")");
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. $ctx1.sendIdx[","]=1;
  1121. //>>excludeEnd("ctx");
  1122. return $1;
  1123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1124. }, function($ctx1) {$ctx1.fill(self,"progress",{},$globals.ProfStef)});
  1125. //>>excludeEnd("ctx");
  1126. },
  1127. //>>excludeStart("ide", pragmas.excludeIdeData);
  1128. args: [],
  1129. source: "progress\x0a\x09^ '(', self tutorialPositionString, '/', self tutorialSizeString, ')'.",
  1130. referencedClasses: [],
  1131. //>>excludeEnd("ide");
  1132. messageSends: [",", "tutorialPositionString", "tutorialSizeString"]
  1133. }),
  1134. $globals.ProfStef);
  1135. $core.addMethod(
  1136. $core.method({
  1137. selector: "showCurrentLesson",
  1138. protocol: 'accessing',
  1139. fn: function (){
  1140. var self=this;
  1141. var lesson;
  1142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1143. return $core.withContext(function($ctx1) {
  1144. //>>excludeEnd("ctx");
  1145. var $1,$2;
  1146. lesson=$recv(self._tutorialPlayer())._currentLesson();
  1147. $recv(self["@widget"])._contents_($recv(lesson)._contents());
  1148. $1=self["@widget"];
  1149. $2=$recv($recv($recv(lesson)._title()).__comma(" ")).__comma(self._progress());
  1150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1151. $ctx1.sendIdx[","]=1;
  1152. //>>excludeEnd("ctx");
  1153. $recv($1)._setTitle_($2);
  1154. return self;
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. }, function($ctx1) {$ctx1.fill(self,"showCurrentLesson",{lesson:lesson},$globals.ProfStef)});
  1157. //>>excludeEnd("ctx");
  1158. },
  1159. //>>excludeStart("ide", pragmas.excludeIdeData);
  1160. args: [],
  1161. source: "showCurrentLesson\x0a\x09| lesson |\x0a\x09lesson := self tutorialPlayer currentLesson.\x0a\x09widget contents: lesson contents.\x0a\x09widget setTitle: lesson title , ' ' , self progress.",
  1162. referencedClasses: [],
  1163. //>>excludeEnd("ide");
  1164. messageSends: ["currentLesson", "tutorialPlayer", "contents:", "contents", "setTitle:", ",", "title", "progress"]
  1165. }),
  1166. $globals.ProfStef);
  1167. $core.addMethod(
  1168. $core.method({
  1169. selector: "tutorialPlayer",
  1170. protocol: 'accessing',
  1171. fn: function (){
  1172. var self=this;
  1173. function $TutorialPlayer(){return $globals.TutorialPlayer||(typeof TutorialPlayer=="undefined"?nil:TutorialPlayer)}
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. return $core.withContext(function($ctx1) {
  1176. //>>excludeEnd("ctx");
  1177. var $2,$1,$receiver;
  1178. $2=self["@tutorialPlayer"];
  1179. if(($receiver = $2) == null || $receiver.isNil){
  1180. self["@tutorialPlayer"]=$recv($TutorialPlayer())._new();
  1181. $1=self["@tutorialPlayer"];
  1182. } else {
  1183. $1=$2;
  1184. };
  1185. return $1;
  1186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1187. }, function($ctx1) {$ctx1.fill(self,"tutorialPlayer",{},$globals.ProfStef)});
  1188. //>>excludeEnd("ctx");
  1189. },
  1190. //>>excludeStart("ide", pragmas.excludeIdeData);
  1191. args: [],
  1192. source: "tutorialPlayer\x0a\x09^ tutorialPlayer ifNil: [tutorialPlayer := TutorialPlayer new]",
  1193. referencedClasses: ["TutorialPlayer"],
  1194. //>>excludeEnd("ide");
  1195. messageSends: ["ifNil:", "new"]
  1196. }),
  1197. $globals.ProfStef);
  1198. $core.addMethod(
  1199. $core.method({
  1200. selector: "tutorialPositionString",
  1201. protocol: 'accessing',
  1202. fn: function (){
  1203. var self=this;
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. return $core.withContext(function($ctx1) {
  1206. //>>excludeEnd("ctx");
  1207. var $1;
  1208. $1=$recv($recv(self._tutorialPlayer())._tutorialPosition())._asString();
  1209. return $1;
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx1) {$ctx1.fill(self,"tutorialPositionString",{},$globals.ProfStef)});
  1212. //>>excludeEnd("ctx");
  1213. },
  1214. //>>excludeStart("ide", pragmas.excludeIdeData);
  1215. args: [],
  1216. source: "tutorialPositionString\x0a\x09^ self tutorialPlayer tutorialPosition asString.",
  1217. referencedClasses: [],
  1218. //>>excludeEnd("ide");
  1219. messageSends: ["asString", "tutorialPosition", "tutorialPlayer"]
  1220. }),
  1221. $globals.ProfStef);
  1222. $core.addMethod(
  1223. $core.method({
  1224. selector: "tutorialSizeString",
  1225. protocol: 'accessing',
  1226. fn: function (){
  1227. var self=this;
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. return $core.withContext(function($ctx1) {
  1230. //>>excludeEnd("ctx");
  1231. var $1;
  1232. $1=$recv($recv(self._tutorialPlayer())._size())._asString();
  1233. return $1;
  1234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1235. }, function($ctx1) {$ctx1.fill(self,"tutorialSizeString",{},$globals.ProfStef)});
  1236. //>>excludeEnd("ctx");
  1237. },
  1238. //>>excludeStart("ide", pragmas.excludeIdeData);
  1239. args: [],
  1240. source: "tutorialSizeString\x0a\x09^ self tutorialPlayer size asString",
  1241. referencedClasses: [],
  1242. //>>excludeEnd("ide");
  1243. messageSends: ["asString", "size", "tutorialPlayer"]
  1244. }),
  1245. $globals.ProfStef);
  1246. $core.addMethod(
  1247. $core.method({
  1248. selector: "widget:",
  1249. protocol: 'accessing',
  1250. fn: function (aWidget){
  1251. var self=this;
  1252. self["@widget"]=aWidget;
  1253. return self;
  1254. },
  1255. //>>excludeStart("ide", pragmas.excludeIdeData);
  1256. args: ["aWidget"],
  1257. source: "widget: aWidget\x0a\x09widget := aWidget",
  1258. referencedClasses: [],
  1259. //>>excludeEnd("ide");
  1260. messageSends: []
  1261. }),
  1262. $globals.ProfStef);
  1263. $globals.ProfStef.klass.iVarNames = ['instance'];
  1264. $core.addMethod(
  1265. $core.method({
  1266. selector: "default",
  1267. protocol: 'initialize',
  1268. fn: function (){
  1269. var self=this;
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx1) {
  1272. //>>excludeEnd("ctx");
  1273. var $2,$1,$receiver;
  1274. $2=self["@instance"];
  1275. if(($receiver = $2) == null || $receiver.isNil){
  1276. self["@instance"]=self._new();
  1277. $1=self["@instance"];
  1278. } else {
  1279. $1=$2;
  1280. };
  1281. return $1;
  1282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1283. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ProfStef.klass)});
  1284. //>>excludeEnd("ctx");
  1285. },
  1286. //>>excludeStart("ide", pragmas.excludeIdeData);
  1287. args: [],
  1288. source: "default \x0a\x09^ instance ifNil: [instance := self new]",
  1289. referencedClasses: [],
  1290. //>>excludeEnd("ide");
  1291. messageSends: ["ifNil:", "new"]
  1292. }),
  1293. $globals.ProfStef.klass);
  1294. $core.addMethod(
  1295. $core.method({
  1296. selector: "first",
  1297. protocol: 'navigation',
  1298. fn: function (){
  1299. var self=this;
  1300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1301. return $core.withContext(function($ctx1) {
  1302. //>>excludeEnd("ctx");
  1303. var $1;
  1304. $1=$recv(self._default())._first();
  1305. return $1;
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.ProfStef.klass)});
  1308. //>>excludeEnd("ctx");
  1309. },
  1310. //>>excludeStart("ide", pragmas.excludeIdeData);
  1311. args: [],
  1312. source: "first\x0a\x09^ self default first.",
  1313. referencedClasses: [],
  1314. //>>excludeEnd("ide");
  1315. messageSends: ["first", "default"]
  1316. }),
  1317. $globals.ProfStef.klass);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "go",
  1321. protocol: 'navigation',
  1322. fn: function (){
  1323. var self=this;
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return $core.withContext(function($ctx1) {
  1326. //>>excludeEnd("ctx");
  1327. self._first();
  1328. return self;
  1329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1330. }, function($ctx1) {$ctx1.fill(self,"go",{},$globals.ProfStef.klass)});
  1331. //>>excludeEnd("ctx");
  1332. },
  1333. //>>excludeStart("ide", pragmas.excludeIdeData);
  1334. args: [],
  1335. source: "go\x0a\x09self first.",
  1336. referencedClasses: [],
  1337. //>>excludeEnd("ide");
  1338. messageSends: ["first"]
  1339. }),
  1340. $globals.ProfStef.klass);
  1341. $core.addMethod(
  1342. $core.method({
  1343. selector: "next",
  1344. protocol: 'navigation',
  1345. fn: function (){
  1346. var self=this;
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. return $core.withContext(function($ctx1) {
  1349. //>>excludeEnd("ctx");
  1350. var $1;
  1351. $1=$recv(self._default())._next();
  1352. return $1;
  1353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1354. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProfStef.klass)});
  1355. //>>excludeEnd("ctx");
  1356. },
  1357. //>>excludeStart("ide", pragmas.excludeIdeData);
  1358. args: [],
  1359. source: "next\x0a\x09^ self default next.",
  1360. referencedClasses: [],
  1361. //>>excludeEnd("ide");
  1362. messageSends: ["next", "default"]
  1363. }),
  1364. $globals.ProfStef.klass);
  1365. $core.addMethod(
  1366. $core.method({
  1367. selector: "previous",
  1368. protocol: 'navigation',
  1369. fn: function (){
  1370. var self=this;
  1371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1372. return $core.withContext(function($ctx1) {
  1373. //>>excludeEnd("ctx");
  1374. var $1;
  1375. $1=$recv(self._default())._previous();
  1376. return $1;
  1377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1378. }, function($ctx1) {$ctx1.fill(self,"previous",{},$globals.ProfStef.klass)});
  1379. //>>excludeEnd("ctx");
  1380. },
  1381. //>>excludeStart("ide", pragmas.excludeIdeData);
  1382. args: [],
  1383. source: "previous\x0a\x09^ self default previous.",
  1384. referencedClasses: [],
  1385. //>>excludeEnd("ide");
  1386. messageSends: ["previous", "default"]
  1387. }),
  1388. $globals.ProfStef.klass);
  1389. $core.addClass('TrySmalltalkWidget', $globals.Widget, ['workspace', 'contents', 'header'], 'TrySmalltalk');
  1390. $core.addMethod(
  1391. $core.method({
  1392. selector: "contents",
  1393. protocol: 'accessing',
  1394. fn: function (){
  1395. var self=this;
  1396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1397. return $core.withContext(function($ctx1) {
  1398. //>>excludeEnd("ctx");
  1399. var $1;
  1400. $1=$recv(self._workspace())._val();
  1401. return $1;
  1402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1403. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.TrySmalltalkWidget)});
  1404. //>>excludeEnd("ctx");
  1405. },
  1406. //>>excludeStart("ide", pragmas.excludeIdeData);
  1407. args: [],
  1408. source: "contents\x0a\x09^self workspace val",
  1409. referencedClasses: [],
  1410. //>>excludeEnd("ide");
  1411. messageSends: ["val", "workspace"]
  1412. }),
  1413. $globals.TrySmalltalkWidget);
  1414. $core.addMethod(
  1415. $core.method({
  1416. selector: "contents:",
  1417. protocol: 'accessing',
  1418. fn: function (aString){
  1419. var self=this;
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. return $core.withContext(function($ctx1) {
  1422. //>>excludeEnd("ctx");
  1423. $recv(self._workspace())._val_(aString);
  1424. return self;
  1425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1426. }, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},$globals.TrySmalltalkWidget)});
  1427. //>>excludeEnd("ctx");
  1428. },
  1429. //>>excludeStart("ide", pragmas.excludeIdeData);
  1430. args: ["aString"],
  1431. source: "contents: aString\x0a\x09self workspace val: aString",
  1432. referencedClasses: [],
  1433. //>>excludeEnd("ide");
  1434. messageSends: ["val:", "workspace"]
  1435. }),
  1436. $globals.TrySmalltalkWidget);
  1437. $core.addMethod(
  1438. $core.method({
  1439. selector: "renderButtonsOn:",
  1440. protocol: 'rendering',
  1441. fn: function (html){
  1442. var self=this;
  1443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1444. return $core.withContext(function($ctx1) {
  1445. //>>excludeEnd("ctx");
  1446. var $1,$3,$2,$4,$6,$5,$7,$8;
  1447. $1=$recv(html)._button();
  1448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1449. $ctx1.sendIdx["button"]=1;
  1450. //>>excludeEnd("ctx");
  1451. $recv($1)._with_("DoIt");
  1452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1453. $ctx1.sendIdx["with:"]=1;
  1454. //>>excludeEnd("ctx");
  1455. $recv($1)._title_("ctrl+d");
  1456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1457. $ctx1.sendIdx["title:"]=1;
  1458. //>>excludeEnd("ctx");
  1459. $2=$recv($1)._onClick_((function(){
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return $core.withContext(function($ctx2) {
  1462. //>>excludeEnd("ctx");
  1463. $3=self._workspace();
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. $ctx2.sendIdx["workspace"]=1;
  1466. //>>excludeEnd("ctx");
  1467. return $recv($3)._doIt();
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1470. //>>excludeEnd("ctx");
  1471. }));
  1472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1473. $ctx1.sendIdx["onClick:"]=1;
  1474. //>>excludeEnd("ctx");
  1475. $4=$recv(html)._button();
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. $ctx1.sendIdx["button"]=2;
  1478. //>>excludeEnd("ctx");
  1479. $recv($4)._with_("PrintIt");
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. $ctx1.sendIdx["with:"]=2;
  1482. //>>excludeEnd("ctx");
  1483. $recv($4)._title_("ctrl+p");
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. $ctx1.sendIdx["title:"]=2;
  1486. //>>excludeEnd("ctx");
  1487. $5=$recv($4)._onClick_((function(){
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. return $core.withContext(function($ctx2) {
  1490. //>>excludeEnd("ctx");
  1491. $6=self._workspace();
  1492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1493. $ctx2.sendIdx["workspace"]=2;
  1494. //>>excludeEnd("ctx");
  1495. return $recv($6)._printIt();
  1496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1498. //>>excludeEnd("ctx");
  1499. }));
  1500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1501. $ctx1.sendIdx["onClick:"]=2;
  1502. //>>excludeEnd("ctx");
  1503. $7=$recv(html)._button();
  1504. $recv($7)._with_("InspectIt");
  1505. $recv($7)._title_("ctrl+i");
  1506. $8=$recv($7)._onClick_((function(){
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx2) {
  1509. //>>excludeEnd("ctx");
  1510. return $recv(self._workspace())._inspectIt();
  1511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1512. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  1513. //>>excludeEnd("ctx");
  1514. }));
  1515. return self;
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},$globals.TrySmalltalkWidget)});
  1518. //>>excludeEnd("ctx");
  1519. },
  1520. //>>excludeStart("ide", pragmas.excludeIdeData);
  1521. args: ["html"],
  1522. 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]",
  1523. referencedClasses: [],
  1524. //>>excludeEnd("ide");
  1525. messageSends: ["with:", "button", "title:", "onClick:", "doIt", "workspace", "printIt", "inspectIt"]
  1526. }),
  1527. $globals.TrySmalltalkWidget);
  1528. $core.addMethod(
  1529. $core.method({
  1530. selector: "renderOn:",
  1531. protocol: 'rendering',
  1532. fn: function (html){
  1533. var self=this;
  1534. function $ProfStef(){return $globals.ProfStef||(typeof ProfStef=="undefined"?nil:ProfStef)}
  1535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1536. return $core.withContext(function($ctx1) {
  1537. //>>excludeEnd("ctx");
  1538. var $1,$2,$3,$4;
  1539. $1=$recv(html)._div();
  1540. $recv($1)._class_("profStef");
  1541. $recv($1)._with_((function(){
  1542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1543. return $core.withContext(function($ctx2) {
  1544. //>>excludeEnd("ctx");
  1545. self["@header"]=$recv(html)._h2();
  1546. return self["@header"];
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1549. //>>excludeEnd("ctx");
  1550. }));
  1551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1552. $ctx1.sendIdx["with:"]=1;
  1553. //>>excludeEnd("ctx");
  1554. $recv($1)._with_((function(){
  1555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1556. return $core.withContext(function($ctx2) {
  1557. //>>excludeEnd("ctx");
  1558. return $recv(self._workspace())._renderOn_(html);
  1559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1561. //>>excludeEnd("ctx");
  1562. }));
  1563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1564. $ctx1.sendIdx["with:"]=2;
  1565. //>>excludeEnd("ctx");
  1566. $2=$recv($1)._with_((function(){
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. return $core.withContext(function($ctx2) {
  1569. //>>excludeEnd("ctx");
  1570. return self._renderButtonsOn_(html);
  1571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  1573. //>>excludeEnd("ctx");
  1574. }));
  1575. $3=$recv($ProfStef())._default();
  1576. $recv($3)._widget_(self);
  1577. $4=$recv($3)._showCurrentLesson();
  1578. return self;
  1579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1580. }, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},$globals.TrySmalltalkWidget)});
  1581. //>>excludeEnd("ctx");
  1582. },
  1583. //>>excludeStart("ide", pragmas.excludeIdeData);
  1584. args: ["html"],
  1585. 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",
  1586. referencedClasses: ["ProfStef"],
  1587. //>>excludeEnd("ide");
  1588. messageSends: ["class:", "div", "with:", "h2", "renderOn:", "workspace", "renderButtonsOn:", "widget:", "default", "showCurrentLesson"]
  1589. }),
  1590. $globals.TrySmalltalkWidget);
  1591. $core.addMethod(
  1592. $core.method({
  1593. selector: "setTitle:",
  1594. protocol: 'accessing',
  1595. fn: function (aString){
  1596. var self=this;
  1597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1598. return $core.withContext(function($ctx1) {
  1599. //>>excludeEnd("ctx");
  1600. $recv(self["@header"])._contents_((function(html){
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. return $core.withContext(function($ctx2) {
  1603. //>>excludeEnd("ctx");
  1604. return $recv(html)._with_(aString);
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. }, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)});
  1607. //>>excludeEnd("ctx");
  1608. }));
  1609. return self;
  1610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1611. }, function($ctx1) {$ctx1.fill(self,"setTitle:",{aString:aString},$globals.TrySmalltalkWidget)});
  1612. //>>excludeEnd("ctx");
  1613. },
  1614. //>>excludeStart("ide", pragmas.excludeIdeData);
  1615. args: ["aString"],
  1616. source: "setTitle: aString\x0a\x09header contents: [:html | html with: aString]",
  1617. referencedClasses: [],
  1618. //>>excludeEnd("ide");
  1619. messageSends: ["contents:", "with:"]
  1620. }),
  1621. $globals.TrySmalltalkWidget);
  1622. $core.addMethod(
  1623. $core.method({
  1624. selector: "workspace",
  1625. protocol: 'accessing',
  1626. fn: function (){
  1627. var self=this;
  1628. function $SourceArea(){return $globals.SourceArea||(typeof SourceArea=="undefined"?nil:SourceArea)}
  1629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1630. return $core.withContext(function($ctx1) {
  1631. //>>excludeEnd("ctx");
  1632. var $2,$1,$receiver;
  1633. $2=self["@workspace"];
  1634. if(($receiver = $2) == null || $receiver.isNil){
  1635. self["@workspace"]=$recv($SourceArea())._new();
  1636. $1=self["@workspace"];
  1637. } else {
  1638. $1=$2;
  1639. };
  1640. return $1;
  1641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1642. }, function($ctx1) {$ctx1.fill(self,"workspace",{},$globals.TrySmalltalkWidget)});
  1643. //>>excludeEnd("ctx");
  1644. },
  1645. //>>excludeStart("ide", pragmas.excludeIdeData);
  1646. args: [],
  1647. source: "workspace\x0a\x09^ workspace ifNil: [\x0a \x09workspace := SourceArea new]",
  1648. referencedClasses: ["SourceArea"],
  1649. //>>excludeEnd("ide");
  1650. messageSends: ["ifNil:", "new"]
  1651. }),
  1652. $globals.TrySmalltalkWidget);
  1653. $core.addMethod(
  1654. $core.method({
  1655. selector: "open",
  1656. protocol: 'initialize',
  1657. fn: function (){
  1658. var self=this;
  1659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1660. return $core.withContext(function($ctx1) {
  1661. //>>excludeEnd("ctx");
  1662. $recv(self._new())._appendToJQuery_("body"._asJQuery());
  1663. return self;
  1664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1665. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.TrySmalltalkWidget.klass)});
  1666. //>>excludeEnd("ctx");
  1667. },
  1668. //>>excludeStart("ide", pragmas.excludeIdeData);
  1669. args: [],
  1670. source: "open\x0a\x09self new appendToJQuery: 'body' asJQuery.",
  1671. referencedClasses: [],
  1672. //>>excludeEnd("ide");
  1673. messageSends: ["appendToJQuery:", "new", "asJQuery"]
  1674. }),
  1675. $globals.TrySmalltalkWidget.klass);
  1676. $core.addClass('TutorialPlayer', $globals.Object, ['tutorialPosition', 'tutorial'], 'TrySmalltalk');
  1677. //>>excludeStart("ide", pragmas.excludeIdeData);
  1678. $globals.TutorialPlayer.comment="I can navigate through an AbstractTutorial subclass. With #next and #previous you can go forward and backward through the tutorial.";
  1679. //>>excludeEnd("ide");
  1680. $core.addMethod(
  1681. $core.method({
  1682. selector: "currentLesson",
  1683. protocol: 'accessing',
  1684. fn: function (){
  1685. var self=this;
  1686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1687. return $core.withContext(function($ctx1) {
  1688. //>>excludeEnd("ctx");
  1689. var $1;
  1690. $1=$recv(self._tutorial())._lessonAt_(self._tutorialPosition());
  1691. return $1;
  1692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1693. }, function($ctx1) {$ctx1.fill(self,"currentLesson",{},$globals.TutorialPlayer)});
  1694. //>>excludeEnd("ctx");
  1695. },
  1696. //>>excludeStart("ide", pragmas.excludeIdeData);
  1697. args: [],
  1698. source: "currentLesson\x0a\x09^ self tutorial lessonAt: self tutorialPosition.",
  1699. referencedClasses: [],
  1700. //>>excludeEnd("ide");
  1701. messageSends: ["lessonAt:", "tutorial", "tutorialPosition"]
  1702. }),
  1703. $globals.TutorialPlayer);
  1704. $core.addMethod(
  1705. $core.method({
  1706. selector: "first",
  1707. protocol: 'navigation',
  1708. fn: function (){
  1709. var self=this;
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. return $core.withContext(function($ctx1) {
  1712. //>>excludeEnd("ctx");
  1713. var $1;
  1714. self._rewind();
  1715. $1=self._currentLesson();
  1716. return $1;
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.TutorialPlayer)});
  1719. //>>excludeEnd("ctx");
  1720. },
  1721. //>>excludeStart("ide", pragmas.excludeIdeData);
  1722. args: [],
  1723. source: "first\x0a\x09self rewind.\x0a\x09^ self currentLesson",
  1724. referencedClasses: [],
  1725. //>>excludeEnd("ide");
  1726. messageSends: ["rewind", "currentLesson"]
  1727. }),
  1728. $globals.TutorialPlayer);
  1729. $core.addMethod(
  1730. $core.method({
  1731. selector: "last",
  1732. protocol: 'navigation',
  1733. fn: function (){
  1734. var self=this;
  1735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1736. return $core.withContext(function($ctx1) {
  1737. //>>excludeEnd("ctx");
  1738. var $1;
  1739. self["@tutorialPosition"]=self._size();
  1740. $1=self._currentLesson();
  1741. return $1;
  1742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1743. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.TutorialPlayer)});
  1744. //>>excludeEnd("ctx");
  1745. },
  1746. //>>excludeStart("ide", pragmas.excludeIdeData);
  1747. args: [],
  1748. source: "last\x0a\x09tutorialPosition := self size.\x0a\x09^ self currentLesson",
  1749. referencedClasses: [],
  1750. //>>excludeEnd("ide");
  1751. messageSends: ["size", "currentLesson"]
  1752. }),
  1753. $globals.TutorialPlayer);
  1754. $core.addMethod(
  1755. $core.method({
  1756. selector: "next",
  1757. protocol: 'navigation',
  1758. fn: function (){
  1759. var self=this;
  1760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1761. return $core.withContext(function($ctx1) {
  1762. //>>excludeEnd("ctx");
  1763. var $1,$2;
  1764. $1=$recv(self._tutorialPosition()).__lt(self._size());
  1765. if($core.assert($1)){
  1766. self["@tutorialPosition"]=$recv(self["@tutorialPosition"]).__plus((1));
  1767. self["@tutorialPosition"];
  1768. };
  1769. $2=self._currentLesson();
  1770. return $2;
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.TutorialPlayer)});
  1773. //>>excludeEnd("ctx");
  1774. },
  1775. //>>excludeStart("ide", pragmas.excludeIdeData);
  1776. args: [],
  1777. source: "next\x0a\x09self tutorialPosition < self size\x0a\x09\x09ifTrue: [tutorialPosition := tutorialPosition + 1].\x0a\x09^ self currentLesson",
  1778. referencedClasses: [],
  1779. //>>excludeEnd("ide");
  1780. messageSends: ["ifTrue:", "<", "tutorialPosition", "size", "+", "currentLesson"]
  1781. }),
  1782. $globals.TutorialPlayer);
  1783. $core.addMethod(
  1784. $core.method({
  1785. selector: "previous",
  1786. protocol: 'navigation',
  1787. fn: function (){
  1788. var self=this;
  1789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1790. return $core.withContext(function($ctx1) {
  1791. //>>excludeEnd("ctx");
  1792. var $1,$2;
  1793. $1=$recv(self["@tutorialPosition"]).__gt((1));
  1794. if($core.assert($1)){
  1795. self["@tutorialPosition"]=$recv(self["@tutorialPosition"]).__minus((1));
  1796. self["@tutorialPosition"];
  1797. };
  1798. $2=self._currentLesson();
  1799. return $2;
  1800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1801. }, function($ctx1) {$ctx1.fill(self,"previous",{},$globals.TutorialPlayer)});
  1802. //>>excludeEnd("ctx");
  1803. },
  1804. //>>excludeStart("ide", pragmas.excludeIdeData);
  1805. args: [],
  1806. source: "previous\x0a\x09tutorialPosition > 1 ifTrue: [tutorialPosition := tutorialPosition - 1].\x0a\x09^ self currentLesson",
  1807. referencedClasses: [],
  1808. //>>excludeEnd("ide");
  1809. messageSends: ["ifTrue:", ">", "-", "currentLesson"]
  1810. }),
  1811. $globals.TutorialPlayer);
  1812. $core.addMethod(
  1813. $core.method({
  1814. selector: "rewind",
  1815. protocol: 'navigation',
  1816. fn: function (){
  1817. var self=this;
  1818. self["@tutorialPosition"]=(1);
  1819. return self;
  1820. },
  1821. //>>excludeStart("ide", pragmas.excludeIdeData);
  1822. args: [],
  1823. source: "rewind\x0a\x09tutorialPosition := 1.",
  1824. referencedClasses: [],
  1825. //>>excludeEnd("ide");
  1826. messageSends: []
  1827. }),
  1828. $globals.TutorialPlayer);
  1829. $core.addMethod(
  1830. $core.method({
  1831. selector: "size",
  1832. protocol: 'accessing',
  1833. fn: function (){
  1834. var self=this;
  1835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1836. return $core.withContext(function($ctx1) {
  1837. //>>excludeEnd("ctx");
  1838. var $1;
  1839. $1=$recv(self._tutorial())._size();
  1840. return $1;
  1841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1842. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.TutorialPlayer)});
  1843. //>>excludeEnd("ctx");
  1844. },
  1845. //>>excludeStart("ide", pragmas.excludeIdeData);
  1846. args: [],
  1847. source: "size\x0a\x09^ self tutorial size",
  1848. referencedClasses: [],
  1849. //>>excludeEnd("ide");
  1850. messageSends: ["size", "tutorial"]
  1851. }),
  1852. $globals.TutorialPlayer);
  1853. $core.addMethod(
  1854. $core.method({
  1855. selector: "tutorial",
  1856. protocol: 'accessing',
  1857. fn: function (){
  1858. var self=this;
  1859. function $SmalltalkSyntaxTutorial(){return $globals.SmalltalkSyntaxTutorial||(typeof SmalltalkSyntaxTutorial=="undefined"?nil:SmalltalkSyntaxTutorial)}
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. return $core.withContext(function($ctx1) {
  1862. //>>excludeEnd("ctx");
  1863. var $2,$1,$receiver;
  1864. $2=self["@tutorial"];
  1865. if(($receiver = $2) == null || $receiver.isNil){
  1866. self["@tutorial"]=$recv($SmalltalkSyntaxTutorial())._new();
  1867. $1=self["@tutorial"];
  1868. } else {
  1869. $1=$2;
  1870. };
  1871. return $1;
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. }, function($ctx1) {$ctx1.fill(self,"tutorial",{},$globals.TutorialPlayer)});
  1874. //>>excludeEnd("ctx");
  1875. },
  1876. //>>excludeStart("ide", pragmas.excludeIdeData);
  1877. args: [],
  1878. source: "tutorial\x0a\x09^ tutorial ifNil: [tutorial := SmalltalkSyntaxTutorial new]",
  1879. referencedClasses: ["SmalltalkSyntaxTutorial"],
  1880. //>>excludeEnd("ide");
  1881. messageSends: ["ifNil:", "new"]
  1882. }),
  1883. $globals.TutorialPlayer);
  1884. $core.addMethod(
  1885. $core.method({
  1886. selector: "tutorial:",
  1887. protocol: 'accessing',
  1888. fn: function (aTutorial){
  1889. var self=this;
  1890. self["@tutorial"]=aTutorial;
  1891. return self;
  1892. },
  1893. //>>excludeStart("ide", pragmas.excludeIdeData);
  1894. args: ["aTutorial"],
  1895. source: "tutorial: aTutorial\x0a\x09tutorial := aTutorial",
  1896. referencedClasses: [],
  1897. //>>excludeEnd("ide");
  1898. messageSends: []
  1899. }),
  1900. $globals.TutorialPlayer);
  1901. $core.addMethod(
  1902. $core.method({
  1903. selector: "tutorialPosition",
  1904. protocol: 'accessing',
  1905. fn: function (){
  1906. var self=this;
  1907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1908. return $core.withContext(function($ctx1) {
  1909. //>>excludeEnd("ctx");
  1910. var $2,$1,$receiver;
  1911. $2=self["@tutorialPosition"];
  1912. if(($receiver = $2) == null || $receiver.isNil){
  1913. self._rewind();
  1914. $1=self["@tutorialPosition"];
  1915. } else {
  1916. $1=$2;
  1917. };
  1918. return $1;
  1919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1920. }, function($ctx1) {$ctx1.fill(self,"tutorialPosition",{},$globals.TutorialPlayer)});
  1921. //>>excludeEnd("ctx");
  1922. },
  1923. //>>excludeStart("ide", pragmas.excludeIdeData);
  1924. args: [],
  1925. source: "tutorialPosition \x0a\x09^ tutorialPosition ifNil: [\x0a\x09\x09self rewind.\x0a\x09\x09tutorialPosition.\x0a\x09].",
  1926. referencedClasses: [],
  1927. //>>excludeEnd("ide");
  1928. messageSends: ["ifNil:", "rewind"]
  1929. }),
  1930. $globals.TutorialPlayer);
  1931. $core.addMethod(
  1932. $core.method({
  1933. selector: "tutorialPosition:",
  1934. protocol: 'accessing',
  1935. fn: function (aTutorialPosition){
  1936. var self=this;
  1937. self["@tutorialPosition"]=aTutorialPosition;
  1938. return self;
  1939. },
  1940. //>>excludeStart("ide", pragmas.excludeIdeData);
  1941. args: ["aTutorialPosition"],
  1942. source: "tutorialPosition: aTutorialPosition \x0a\x09tutorialPosition := aTutorialPosition",
  1943. referencedClasses: [],
  1944. //>>excludeEnd("ide");
  1945. messageSends: []
  1946. }),
  1947. $globals.TutorialPlayer);
  1948. });