对Ruby来说,I m相当新,迄今为止,对如何使用是我最大的疼痛点之一。 如果我正确阅读文件,这些文件几乎完全不透明。 要了解约束物体内的范围,你必须携带Ruby-doc.org/Depts/Kernel.html#M005922“rel=“noretinger”>,使用约束装置。
也许我只是一个来自不同学校的纯净师,但一般说来,我很乐于修补建筑。 在一般情况下,鉴于具有约束力的物体,是否可采取任何下列措施:
- List the identifiers in scope in the context the binding represents, or retrieve a hash of the contents.
- Set the value of a local variable in the binding equal to that of some local variable in an external context. Ideally, this should work generally, even if the value is an object reference, file handle, or some other complex entity.
- (extension 2:) Given a hash, set locals in the binding for each entry.
- Better yet, given a hash build a binding with only the basic language constructs and the names in the hash in scope.
基本上,我想知道其中哪些是可能的,如何实现那些目标。 我认为,每种解决办法都将是相当密切的,这就是为什么我把所有这一切放在一个单一问题上。
另一种做法是,在具有约束力的情形下,与Perl s eval BLOCK syntax相似的,是否采用已成等法。