Optimizing AI for immediate response in Smart CCTV
LiveScript Coffee
1. L I V E S C R I P T
( O R / [ C O F F E E ] | [ L I V E ] S C R I P T / G )
R O C K I N G Y O U R W O R L D . J S
Copyright 2014 - Synthesis Software Technology
http://www.synthesis.co.za
11. S P O T T H E B U G !
var car = {
state: "off",
start: function() {
this.state = "starting";
setTimeout(function() {
this.state = "started"
}, 1000);
}
};
car.start();
12. P R O T O T Y P A L O O S T Y L E
var Person = function(name) {
return {
name: name,
getname: function() {
return this.name.toUpperCase();
}
}
}
var peter = new Person("Peter");
peter.getname();
var luke = { name: “Luke” };
luke.getname = peter.getname;
luke.getname();
var crazy = peter.getname;
crazy(); // ??
17. F A T T Y G O O D N E S S
fix coffee’s weirdly-ness (like ‘=‘and list comps)
spicy curry and nice
ninja |> <| >> << operators
async backcalls
A N D B A T T E R I E S !
prelude
more scary compiled js
could be a gateway drug… >:-0
D O W N S I D E S O V E R C O F F E E ?
It’s everywhere - every single computer in the world runs at least a couple JS interpreters
It’s multi-paradigm: OO, functional, dynamic, asynchronous
It’s equally loved and hated by developers everywhere
But it’s massively WTF too - lots of crazy stuff in there
It’s everywhere - every single computer in the world runs at least a couple JS interpreters
It’s multi-paradigm: OO, functional, dynamic, asynchronous
It’s equally loved and hated by developers everywhere
But it’s massively WTF too - lots of crazy stuff in there
But whatever - they do actually follow a fairly reasonable convention, just sometimes a bit surprising
The evil “with” keyword:
with (z) {
y = 10; // good luck knowing if z.y or global y is being set
}
Confusion and badly used generally
“undefined” meaning the absence of a definition (similar to void)
“null” meaning defined, but set to the absence of a value (similar to null)
“==“ operator coercing null to undefined and vice versa, munging their meanings, whereas “===“ works as a better equality operator in most cases
Silver bullet languages! Fix all js issues!
Except Typescript, which fixes a whole class of “issues” that don’t exist :)
var issues (coffeescript has to keep track of variables)
do a class example with using -> and => bound functions
fixed scoping issue, use := to assign to the global