| Tags: | smalltalk, syntax | | Current Music: | Feng Shui » Enter The Kingdom (4:34) » Music For The Harmonious Spirit | | Time: | 09:22 pm |
|
| t.rotate (a, v); //Original t rotate (a, v); //Who needs dot? t rotate a, v; //Who needs brackets?
To evolve the syntax further, we need to know what the two parameters a and v represent. Let’s assume the entire example is meant to “rotate by angle a around vector v.” Then the next step might be
t rotate by a around v; //Who needs commas? How do we tell what the components are? We know, because we evolved the example, that “t” is a variable, “rotate” is the name of the method, “by” is a separator, “a” is a variable, “around” is a separator, and finally “v” is a variable. To eliminate potential ambiguity, we can establish a convention: add colons after separators. Then we get
t rotate by: a around: v; //Who needs ambiguity? Finally, let’s insist that the separators be part of the method name; i.e., let’s require that the name of the method be “rotate by: around:” and let’s get rid of the spaces to get “rotateby:around:” as the name and finally, let’s capitalize internal words just for readability to get “rotateBy:around:”. Then our example could be written
t rotateBy: a around: v //This is Smalltalk
| comments: Leave a comment  |
| Tags: | dev, javascript, obfuscator, syntax, tools | | Current Music: | Mouse on mars — [Glam #06] Rerelese Hysteresis (4:07) | | Subject: | TrickyScripter | dean.edwards.name: star-light syntax-highlighter and packer | | Time: | 05:05 pm |
|
| TrickyScripter | dean.edwards.name: star-light syntax-highlighter and packer
→ star-ligth, созданный dean.edwards.name — это очередной ;) скрипт для раскраски синтаксиса (несколько языков).
Удивило меня тем, как он это делает. Пишите нечто вроде:
<pre class="javascript"> → здесь некий яваскрипт </pre> И всё! Далее он все сделает сам, причем на лету.
В таблице стилей мы видим такой вот код:
pre.js, pre.javascript { behavior: url(star-js.htc) url(star-light.htc); -moz-binding: url(bindings.xml#star-js.htc|star-light.htc); } А файл star-light.htc — это xml страница с js кодом, который и раскрашивает. Довольно необычно. Первый раз вижу такое.
Далее у нас идут две утилиты: обфускаторы/компрессоры js кода.
( Read more... ) | comments: 1 comment or Leave a comment  |
| |