You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruby, similar to Python, has the notion of a "meta-class" called the singleton class. This can be seen in methods such as def self.foo;end and def foo;end where the former is defined against the singleton. Similarly in fields, where @@ fields are defined against the singleton class.
When instantiating classes, Foo.new is a call to the singleton class that allocates memory and calls the respective class' initialize method.
To model this, we need:
To create classes and modules in pairs, where one is Foo (the "regular" class) and the other is Foo<class> (the singleton class)
Define members for @@ fields under Foo<class>
Define members with dynamicTypeHintFullNames set to the corresponding self methods and under Foo<class>. Foo<class> should have empty bindings to these self methods. An empty binding is one with name=="" and signature==""
During object instantiations, e.g. Foo.new, add Foo<class> to the receiver's dynamic type hints, and Foo as the return type of Call(new). The call linker may add an edge directly from Foo.new to Foo.initialize.
Figure out Ruby field instantiation method names, similar to Java's <clinit> and use more Ruby-specific names for the constructor cycle.
The text was updated successfully, but these errors were encountered:
1. Created classes and modules in pairs, where one is `Foo` (the "regular" class) and the other is `Foo<class>` (the singleton class). `module` singletons get the `final` keyword.
2. Define members for `@@` fields under `Foo<class>`
3. Define members with `dynamicTypeHintFullName`s set to the corresponding `self` methods and under `Foo<class>`. `Foo<class>` should have empty bindings to these `self` methods. An empty binding is one with `name==""` and `signature==""`
4. During object instantiations, e.g. `Foo.new`, add `Foo<class>` to the receiver's dynamic type hints, and `Foo` as the return type of `Call(new)`. The call linker may add an edge directly from `Foo.new` to `Foo.initialize`.
Resolves#4652
1. Created classes and modules in pairs, where one is `Foo` (the "regular" class) and the other is `Foo<class>` (the singleton class). `module` singletons get the `final` keyword.
2. Define members for `@@` fields under `Foo<class>`
3. Define members with `dynamicTypeHintFullName`s set to the corresponding `self` methods and under `Foo<class>`. `Foo<class>` should have empty bindings to these `self` methods. An empty binding is one with `name==""` and `signature==""`
4. During object instantiations, e.g. `Foo.new`, add `Foo<class>` to the receiver's dynamic type hints, and `Foo` as the return type of `Call(new)`. The call linker may add an edge directly from `Foo.new` to `Foo.initialize`.
cc @AndreiDreyerResolves#4652
Ruby, similar to Python, has the notion of a "meta-class" called the singleton class. This can be seen in methods such as
def self.foo;end
anddef foo;end
where the former is defined against the singleton. Similarly in fields, where@@
fields are defined against the singleton class.When instantiating classes,
Foo.new
is a call to the singleton class that allocates memory and calls the respective class'initialize
method.To model this, we need:
Foo
(the "regular" class) and the other isFoo<class>
(the singleton class)@@
fields underFoo<class>
dynamicTypeHintFullName
s set to the correspondingself
methods and underFoo<class>
.Foo<class>
should have empty bindings to theseself
methods. An empty binding is one withname==""
andsignature==""
Foo.new
, addFoo<class>
to the receiver's dynamic type hints, andFoo
as the return type ofCall(new)
. The call linker may add an edge directly fromFoo.new
toFoo.initialize
.<clinit>
and use more Ruby-specific names for the constructor cycle.The text was updated successfully, but these errors were encountered: