Browse Source

Syntactic sugar for 1-element array changed to ~.

'#' would confuse Smalltalkers to suggest a Symbol
which would in Amber work same as a String.
Herbert Vojčík 9 years ago
parent
commit
1e7b47499d
4 changed files with 11 additions and 11 deletions
  1. 1 1
      example-counter/counter.html
  2. 7 7
      example-todo/todo.html
  3. 2 2
      src/Lyst.js
  4. 1 1
      src/Lyst.st

+ 1 - 1
example-counter/counter.html

@@ -33,7 +33,7 @@
     </script>
 </head>
 <body>
-<h2 data-trap="App #value"></h2>
+<h2 data-trap="App ~value"></h2>
 <button data-trap="App: (signal increment) whenClicked">++</button>
 <button data-trap="App: (signal decrement) whenClicked">--</button>
 </body>

+ 7 - 7
example-todo/todo.html

@@ -1,7 +1,7 @@
 <!doctype html>
 <html data-trap="App: path">
 <head>
-    <title data-trap="#title"></title>
+    <title data-trap="~title"></title>
     <style>
         [data-trap] {
             display: none
@@ -31,13 +31,13 @@
     </script>
 </head>
 <body>
-<h2 data-trap="#title"></h2>
+<h2 data-trap="~title"></h2>
 
-<div data-trap=": (guard (#todos #notNil)) xontent" data-xontent>
-    <span data-trap="#remaining"></span> of <span data-trap="#todos #size"></span> remaning
+<div data-trap=": (guard (~todos ~notNil)) xontent" data-xontent>
+    <span data-trap="~remaining"></span> of <span data-trap="~todos ~size"></span> remaning
     [ <a href="" data-trap=": (signal archive) whenClicked">archive</a> ]
     <ul>
-        <script type="application/x-beacon" data-trap="#todos: loopZ xontent" data-xontent="until end"></script>
+        <script type="application/x-beacon" data-trap="~todos: loopZ xontent" data-xontent="until end"></script>
         <li>
             <label>
                 <input type="checkbox" data-trap="done: inputChecked"/>
@@ -46,10 +46,10 @@
         </li>
     </ul>
     <form data-trap=": (signal addTodo) whenSubmitted">
-        <input type="text" data-trap="#todoText: inputValue" size="30" placeholder="add new todo here"/>
+        <input type="text" data-trap="~todoText: inputValue" size="30" placeholder="add new todo here"/>
         <input type="submit" class="btn-primary" value="add"/>
     </form>
 </div>
-<p data-trap=": (guard (#todos #isNil)) xontent" data-xontent>Loading (fake 2 sec pause)...</p>
+<p data-trap=": (guard (~todos ~isNil)) xontent" data-xontent>Loading (fake 2 sec pause)...</p>
 </body>
 </html>

+ 2 - 2
src/Lyst.js

@@ -134,7 +134,7 @@ $8=$recv($recv(inner)._notEmpty())._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-return $recv($recv(inner)._first()).__eq("#");
+return $recv($recv(inner)._first()).__eq("~");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx3.sendIdx["="]=3;
 //>>excludeEnd("ctx");
@@ -198,7 +198,7 @@ return $12;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["message"],
-source: "parse: message\x0a\x09| result stack anArray |\x0a\x09anArray := message tokenize: ' '.\x0a\x09result := #().\x0a\x09stack := { result }.\x0a\x09anArray do: [ :each |\x0a\x09\x09| asNum inner close |\x0a\x09\x09close := 0.\x0a\x09\x09inner := each.\x0a\x09\x09[ inner notEmpty and: [ inner first = '(' ]] whileTrue: [ inner := inner allButFirst. stack add: (stack last add: #()) ].\x0a\x09\x09[ inner notEmpty and: [ inner last = ')' ]] whileTrue: [ inner := inner allButLast. close := close + 1 ].\x0a\x09\x09(inner notEmpty and: [ inner first = '#' ]) ifTrue: [ inner := { inner allButFirst } ].\x0a\x09\x09asNum := inner isString ifTrue: [ (inner ifEmpty: [ 'NaN' ]) asNumber ] ifFalse: [ inner ].\x0a\x09\x09asNum = asNum ifTrue: [ stack last add: asNum ] ifFalse: [\x0a\x09\x09\x09inner ifNotEmpty: [ stack last add: inner ] ].\x0a\x09\x09close timesRepeat: [ stack removeLast ] ].\x0a\x09^ result",
+source: "parse: message\x0a\x09| result stack anArray |\x0a\x09anArray := message tokenize: ' '.\x0a\x09result := #().\x0a\x09stack := { result }.\x0a\x09anArray do: [ :each |\x0a\x09\x09| asNum inner close |\x0a\x09\x09close := 0.\x0a\x09\x09inner := each.\x0a\x09\x09[ inner notEmpty and: [ inner first = '(' ]] whileTrue: [ inner := inner allButFirst. stack add: (stack last add: #()) ].\x0a\x09\x09[ inner notEmpty and: [ inner last = ')' ]] whileTrue: [ inner := inner allButLast. close := close + 1 ].\x0a\x09\x09(inner notEmpty and: [ inner first = '~' ]) ifTrue: [ inner := { inner allButFirst } ].\x0a\x09\x09asNum := inner isString ifTrue: [ (inner ifEmpty: [ 'NaN' ]) asNumber ] ifFalse: [ inner ].\x0a\x09\x09asNum = asNum ifTrue: [ stack last add: asNum ] ifFalse: [\x0a\x09\x09\x09inner ifNotEmpty: [ stack last add: inner ] ].\x0a\x09\x09close timesRepeat: [ stack removeLast ] ].\x0a\x09^ result",
 referencedClasses: [],
 //>>excludeEnd("ide");
 messageSends: ["tokenize:", "do:", "whileTrue:", "and:", "notEmpty", "=", "first", "allButFirst", "add:", "last", "allButLast", "+", "ifTrue:", "ifTrue:ifFalse:", "isString", "asNumber", "ifEmpty:", "ifNotEmpty:", "timesRepeat:", "removeLast"]

+ 1 - 1
src/Lyst.st

@@ -16,7 +16,7 @@ parse: message
 		inner := each.
 		[ inner notEmpty and: [ inner first = '(' ]] whileTrue: [ inner := inner allButFirst. stack add: (stack last add: #()) ].
 		[ inner notEmpty and: [ inner last = ')' ]] whileTrue: [ inner := inner allButLast. close := close + 1 ].
-		(inner notEmpty and: [ inner first = '#' ]) ifTrue: [ inner := { inner allButFirst } ].
+		(inner notEmpty and: [ inner first = '~' ]) ifTrue: [ inner := { inner allButFirst } ].
 		asNum := inner isString ifTrue: [ (inner ifEmpty: [ 'NaN' ]) asNumber ] ifFalse: [ inner ].
 		asNum = asNum ifTrue: [ stack last add: asNum ] ifFalse: [
 			inner ifNotEmpty: [ stack last add: inner ] ].