惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

博客园 - jjxstudio

关于silverlight 前景的讨论,不吐不快 没有说说新的async ctp吗? 新blog地址 青春咖啡馆 2010 计划 axapta 断开的记录集 django 1.1 south 理解zope3 的适配器 准备放弃django openerp新的web-client openerp view design elements中的col和colspan - jjxstudio 上下文 怎样才算是一个好的windows forms 应用程序框架? 自定义django admin 之一 django admin search_fields 今天的折腾 杭州:一个python的工作机会 ironpython的下一个版本
a中的this和element
jjxstudio · 2009-05-02 · via 博客园 - jjxstudio

在qiuhao上我回复一个网友的贴子,但觉的这里可以展开的点很多。

在窗体编程中,element 通常就是指formrun 也就是我们看到的form

你在为哪个对象编写代码,this就是哪个对象,比方说你为formbuttoncontrol写click方法,则this就是指这个按钮,如果我们覆盖form的init方法,那么里面的this其实就是element

深入探讨这个就是ax的代码生成机制有关了,ax为了达到分层的目的,没有采用现在编程中的事件机制,而是用继承的方式,当创建一个窗体,增加一个按钮时,其实就是生成一个类

class Form1 extends SysSetupFormRun{

   private Form1 element=this;

   public Button1 Button1; //如果Button1的authdeclartion为yes,则会声明这行

     super();

     //这里this 是form1范围,也就是element,两者一样

  }

  class Button1 extends FormButtonControl{

       super();

       //你的代码

      print classId2Name(classIdGet(this)));

     print element.name();

   }

}

}

看这个生成的代码,就会了解ax 中this,element的具体指向了

不过上面代码仅是个人推测,但这种编码在java语言中是会通过的,c#就不行,因为对内部类的处理机制不一样,而且c#也不允许Form1 element=this这样的变量声明, 这其实告诉我们,对比语言时得确有个此长彼短的问题。不能简单的评定谁好谁坏。

上次,有网友问我,我的blog上说所的填空式代码生成是什么意思。其实我所说的就是ax的代码生成机制,在ax中,只有方法覆盖是编程者接触的(参见加黑的部分),其它地方是编程者所不触及的。这通过提供类似ax aot的窗口可以实现。填充式代码生成更易于达到封闭代码,减少出错点,提高效率的目的