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

推荐订阅源

GbyAI
GbyAI
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
D
Docker
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
美团技术团队
V
V2EX
Last Week in AI
Last Week in AI
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
B
Blog RSS Feed
博客园_首页
B
Blog
博客园 - 叶小钗
I
InfoQ
WordPress大学
WordPress大学
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
A
About on SuperTechFans
The GitHub Blog
The GitHub Blog
The Register - Security
The Register - Security
MyScale Blog
MyScale Blog
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
Latest news
Latest news
W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News and Events Feed by Topic
S
Secure Thoughts
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News

博客园 - 阿飞外传

简单rails开发环境 关于MDA的长期等待 Is MOF the kernel language of MDA langs family graduated 语言内实例表示机制 类型信息隐藏 MOF自描述 图模式-续 符号软件工程(SSE) next MDA? Algebra operator declaration 's UML profile 应用元建模读书笔记 再谈实例化和图转换 EclipseUML2.0::Class的接口 主题与模型 MDA轮廓 UML::Element的代数规范 UML::InstanceValue是元类吗 MDA is a big reflection i need a job CGN的IP之父访谈的两句话 A sample of writing a loop in Action Semantic codes
ruby-core
阿飞外传 · 2006-09-21 · via 博客园 - 阿飞外传

包中的是ruby的核心类(算是M2+M3级)
外面的User是M1级。 虚线是instance_of关系
具有金穗带构架,Object.instance_of?(Class) = true, Class.ancestors.include?(Object) = true

不是很明白,中间杀出个程咬金:Module

总体原则是,核心类簇中继承链中的叶类作为实例化关系的祖先, 即Class

一些特征:
1)特定于某对象的方法(单例类实例的方法)
  str = "sdfsdf"
  def str.foo
    puts "a per object method"
  end

2)DSL特征,在Module类中增加方法,以便用户类在定义时调用。

class Module
  @@doc = {}
  def doc(str)
    @@doc[self.name] = str
  end
  def Moduel.doc(aClass)
    aClass = aClass.name if aClass.class <= Module
    @@doc[aClass]
  end
end

class User
  doc "here is the doc for user"
end
 
3)条件定义

def foo
  if $DEBUG
    def foo
      puts "debug version"
    end
   else
  end
end 

4)匿名类

class User
   @class_val = 123
   class <<self
     def aClassMethod
       puts @class_val
     end
   end
end