zoukankan      html  css  js  c++  java
  • 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

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


  • 相关阅读:
    cocos2dx 3.0 飞机大战
    cocos2dx 3.0 触摸机制
    cocos2d-x 3.0 rc0 + flappybird 学习心得
    cocos2dx 3.0 +VS2012 环境搭建
    cocos2dx 内存管理(3)---CCPoolManager浅析
    cocos2dx 内存管理机制(2)
    Cocos2dx 入门小游戏实例
    myBaits入门
    Java8:函数式编程、Stream
    Java基础巩固
  • 原文地址:https://www.cnblogs.com/snakevash/p/3007473.html
Copyright © 2011-2022 走看看