Paste: mutually referential properties

Author: j
Mode: text
Date: Tue, 19 Oct 2010 09:33:44
Plain Text |
procedure FriendType;
procedure FriendType?;

[T | FriendType?(T)]
friendType(static T) = recordWithProperties(
    (
        (FriendType?, true),
        (FriendType, T),
    ),
);

record Foo = friendType(Bar);
record Bar = friendType(Foo);

main() = TypeSize(Foo);

Annotation: real case in objc

Author: j
Mode: text
Date: Tue, 19 Oct 2010 09:36:04
Plain Text |
record NSObject = externalClass(Void,
    ClassMethods(
        (#"alloc", Id),
        (#"class", Id), // XXX Class
    ),
    InstanceMethods(
        (#"init", Id),
        (#"description", NSString),
        (#"retain", Id),
        (#"release", Id),
        (#"autorelease", Id),
        (#"class", Id),
    ),
);

record NSString = externalClass(NSObject,
    ClassMethods(
        (#"stringWithUTF8String:", Id, Pointer[CChar]),
        (#"stringWithFormat:", Id, NSString),
    ),
    InstanceMethods(
        (#"UTF8String", Pointer[CChar]),
    ),
);

New Annotation

Summary:
Author:
Mode:
Body: