A good programming language is expressive. That means I can easily turn the thoughts of my head into code. A good programming language is easy to read. It's important for code to be read because code lives. Others edit it, extend it, learn from it. A good programming language is fast.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the terms "late binding", "dynamic binding", "polymorphism" kind of blur together for me | |
//here is an example of this concept in Go | |
package main | |
import "fmt" | |
type Animal interface { | |
Say() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run this code at http://golang.org/ | |
package main | |
import "fmt" | |
type Person struct { | |
age int | |
name, fav_band string | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# link with an extra property .__meta | |
# or each object has a .__uid that links | |
# if you are going to have an extra property anyway, why not make it the meta property. | |
meta = {} | |
get = (scope, variable) -> | |
if scope.__meta.get? | |
return scope.__meta.get scope, variable | |
else | |
return scope[variable] |
- Tail Recursion optimization. (Allow loops with recursion.)
- explicit scope access. How do I add variables to the scope?
window[varname] = val
,scope[varname] = val
Similar to thethis
variable is like an extra parameter that is the object that has the function. Thescope
could represent the current scope. (has all closure variables) - Being able to explicitly assign a function to a scope. Explicit closures.
- Proxies, or something similar. (some sort of meta syntax) possibly http://brendaneich.com/2010/11/proxy-inception/
Maybe something like
__noSuchMethod__
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/noSuchMethod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <sstream> | |
using namespace std; | |
typedef struct record{ | |
int key; | |
int data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
typedef struct record{ | |
int key; | |
int data; | |
} record; | |
record* new_record() { | |
record *ret; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready () -> | |
#alert screen.height | |
audioElement = document.createElement('audio'); | |
audioElement.setAttribute 'src', 'audio/star_good.m4a' | |
audioElement.addEventListener 'canplay', () -> | |
alert 'canplay' | |
audioElement.controls = false | |
document.body.appendChild audioElement | |
audioElement.oncanplay = () -> | |
console.log "can play" |