Posted on 2007-02-06 13:35
dennis 閱讀(264)
評論(0) 編輯 收藏 所屬分類:
動態語言
來自railscn的討論:
http://www.railscn.com/viewtopic.php?t=2289
?
1
.
eval
?
"
obj?=?#{str}.new
"
???
#
只能在irb中使用
2
.
obj?
=
?
eval
?
"
obj?=?#{str}.new
"
?
3
.
obj?
=
?
eval
(str)
.
new
4
.
c?
=
?Object
.
const_get(
"
Array
"
)?
??s?
=
?c
.
new
?
相比于java的class.forName,與javascript等腳本語言一致,更為簡單和輕量級?