Skip to content
Permalink
Browse files

README

  • Loading branch information...
shanebdavis committed Mar 24, 2019
1 parent 32656ed commit 1e4986fde86f0976fbc4a7d1084e61d49b24c4b7
Showing with 43 additions and 2 deletions.
  1. +3 −1 README.md
  2. +40 −1 TODO-SCRATCH.md
@@ -6,7 +6,9 @@ I believe less is more. It is the first principle of design and foundation of ju

[![logo](https://raw.githubusercontent.com/wiki/shanebdavis/caffeine-script/Why-CaffeineScript-InfoGraphic.png)](https://raw.githubusercontent.com/wiki/shanebdavis/caffeine-script/Why-CaffeineScript-InfoGraphic-Large.png)

CaffeineScript, with the help of ArtSuite, takes **3x** less code to write this complete implementation of Tic-Tac-Toe. In general, CaffeineScript is **2.5-3x** more efficient than JSX, TypeScript or JavaScript. Imagine seeing 3x as much code on screen at once. Imagine having 3x less code to write. Imagine having 3x less code to change when you need to refactor. Imagine having 3x less code to debug.
CaffeineScript, with the help of ArtSuite, takes **3x** less code to write this complete implementation of Tic-Tac-Toe. In general, CaffeineScript is **2.5-3x** more efficient than JSX, TypeScript or JavaScript. You can see 3x as much code on screen at once, solve problems with 3x less code, and have 3x less code to change when you need to refactor. Perhaps most important of all, you could have 3x less code to debug.

Code size matters. Less is more.

TicTacToe source:
* [CaffeineScript source](https://github.com/imikimi/art-suite-demos/blob/master/source/Art.SuiteDemos/Demos/TicTacToe/Main.caf)
@@ -35,15 +35,54 @@ Syntax Highlighting



# To Sort
```
find {}
# should probably return undefined...
# Why? well, we'd like to distinguish between finding and not finding:
find a in b when a == null
```
```
# IDEA: this:
if find v, k in record when allowedFields[k]
object v, k in record when allowedFields[k]
# could be:
object-if-find v, k in record when allowedFields[k]
# array-version:
array-if-find v, k in record when allowedFields[k]
# I don't quite like that syntax, but the idea is:
# For either 'object' or 'array', return null instead of
# an empty {} or [] - if empty it would be.
# This is an optional mode; most the time I want
# that empty {} or [] so other things don't break.
# OOPS - and interesting. THIS is actually correct:
if (find v, k in record when v? && allowedFields[k])?
object v, k in record when allowedFields[k]
# If when we find the first k in allowedFields, and v == 0,
# the if will be false; ack! In fact, I'd like to have even v == null be OK
# I really like the idea of object-if-find now. It would be just like object,
# except it would vivify the return-object upon the first key it finds that
# passes 'when'.
```

```
# IDEA alias opportunity: found == find
# It's nice when combined with 'if'
if found v in records when v.foo?
...
# hey, that'z nize!
if found records with .foo?
...
# or if we do the object-if syntax:
object-if-found records with allowedFields[..] # .. == second param which is the key
# To Sort
# I kinda like it since it's more declarative-feeling vs imparative.
```
# SHOULD COMPILE
if !response.isRootRequest ||

0 comments on commit 1e4986f

Please sign in to comment.
You can’t perform that action at this time.