trait Weapon {
val strength: Int
}
scalac後javapで表示
$ javap -c Weapon
Compiled from "test.scala"
public interface Weapon {
public abstract int strength();
trait Weapon {
val strength: Int
}
scalac後javapで表示
$ javap -c Weapon
Compiled from "test.scala"
public interface Weapon {
public abstract int strength();
//例えば非同期処理のcallback関数などにあえて関数名をつけるのはどうだろう? | |
someAjaxFunction("parmaeter", | |
function 販売価格の取得に成功した時(calculatedSalesPrice){ | |
console.log(calculatedSalesPrice); | |
}, | |
function なんかエラー(e){ | |
console.log(e); | |
} | |
); | |
//変更前 |
class Dynamic: | |
def __setattr__(self, name, value): | |
self.__dict__[name] = value | |
def __getattr__(self, name): | |
return self.__dict__[name] | |
d = Dynamic() | |
d.hoge = 'bar' | |
d.neko = 'nyan' |
var person = require("./Person") | |
var p = new person.Person('John'); | |
p.show(); | |
console.log("direct access: " + p.name); |
https://gist.github.com/3746850 result.
def main():
x1=1
x2=1
def func1():
y1=x1+10 # x1 is in "enclosing function's scope"
def main(): | |
x1=1 | |
x2=1 | |
def func1(): | |
y1=x1+10 | |
print 'func1', x1,y1 | |
def func2(): | |
y2=x2+10 |
てすと