ClojureScript 点访问格式

这份资料找的我想吐,赶快来收藏一下。让你写出无与伦比的代码的葵花宝典。
当前提供的格式

(.p o) ;=> 属性访问 (.m o <args>) ;=> 方法调用 带参数 (. o p) ;=> 属性访问 (. o p <args>) ;=> 方法调用 带参数 (. o (m)) ;=> 方法调用 (. o (m <args>)) ;=> 方法调用 带参数

将来可能支持的:

(.p o)           ;=> 属性访问 p是属性

(.p o)           ;=> 方法调用 p是方法

(.m o <args>)    ;=> 方法调用

(. o p)          ;=> 属性访问 p是属性

(. o p)          ;=> 方法调用 p是方法

(. o p <args>)   ;=> 方法调用

(. o (m))        ;=> 方法调用

(. o (m <args>)) ;=> 方法调用

The divergence between the Clojure and ClojureScript way is due to first-class functions. That is, in JavaScript a property can be a field or a function or a method. There is currently no way to distinguish between the desire to call a method and retrieve a function as a property except through syntax. This ticket would shorten the gap between Clojure and ClojureScript in the following way (ClojureScript proposal below)(原话就这样了,我也不翻译了。):

(.m o)           ;=> a method call

(.m o <args>)    ;=> a method call

(. o m)          ;=> a method call

(. o m <args>)   ;=> a method call

(. o (m))        ;=> a method call

(. o (m <args>)) ;=> a method call

(.-p o)          ;=> a property access

(. o -p)         ;=> a property access

说实话,看的我有点晕,附上原文地址:
网页



posted @ 2013-04-08 14:49  snakevash  阅读(281)  评论(0编辑  收藏  举报