Extend system class with new constructors

Is the above line still a valid/accurate statement?

Self inside a static method is identical to the type it’s defined in (or extended). As a special rule, for inline methods it’s what it was originally called on.

@mh a lot of stuff is inlining specific, not sure if we need a dedicated syntax syntax.

1 Like

So the document is NOT accurate?

Without inline, and inside a static method, is self identical to typeOf(self), or not?

It does NOT seem to be identical as the attached sample project shows, which contradicts to what the document says.

ConsoleApplication1.7z (25.2 KB)

1 Like

@mh sounds like the documentation needs a tweak here. it refers to the ‘current type’, not typeof().

Yep, its one off several pages that have bene sitting in “status: tech-review” for a while now, for you ;).

will fix.

it is kinda correct though. for example “locking self” in static method is same as “locking typeOf(self)” in a non-static?

the full docs read

In static members (defined with the static modifier or the class method/class property, class var or class event prefix), self refers to the (platform-specific) meta-class that describes the current type. This can be assumed to be unique for each type, and distinct for separate types, and allowed for polymorphism (i.e. in descendant class, self will refer to the descendant meta-class:

self inside a static member is identical to typeOf(self) in an instance method.