Closed Bug 609185 Opened 16 years ago Closed 16 years ago

Should it be GCList<Foo*> or GCList<Foo>?

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stejohns, Assigned: stejohns)

Details

Attachments

(1 file)

The old List<> classes required an explicit pointer type, so the new GCList/RCList classes followed suit. However, the SafeGC work will be using GCRef<> in a form that forbids the *, meaning that GCList and GCRef will have weirdly differing declaration semantics. Perhaps we should change GCList/RCList to follow GCRef now, before too much conversion in Flash/AIR makes changes difficult? Opinions welcomed.
...and also WeakRefList.
Attached patch Patch — — Splinter Review
Patch that converts GCList, RCList, WeakRefList. Do we prefer this style or the status quo? I don't care much, but consistency is useful, so whatever GCRef/GCMember is gonna do, these should too...
Assignee: nobody → stejohns
Attachment #487787 - Flags: review?(lhansen)
Attachment #487787 - Flags: feedback?(bgetlin)
Attachment #487787 - Flags: feedback?(treilly)
After doing it both ways you definitely want GCList<Foo>. It gives your template more power, there's not much you can do when T= Foo* but when T=Foo you can use T in more interesting ways. For safegc we're moving from WriteBarrier<Foo*> to GCMember<Foo> and code won't compile if Foo doesn't derive from a GC class.
OK then... now I just need an R+ :-)
Attachment #487787 - Flags: feedback?(treilly) → feedback+
(In reply to comment #3) > After doing it both ways you definitely want GCList<Foo>. It gives your > template more power, there's not much you can do when T= Foo* but when T=Foo > you can use T in more interesting ways. For safegc we're moving from > WriteBarrier<Foo*> to GCMember<Foo> and code won't compile if Foo doesn't > derive from a GC class. +1
Comment on attachment 487787 [details] [diff] [review] Patch I like it and I can't think of any downsides except that of course, the other List types require the use of '*' when that's what you mean, so there's some space for error if one is converted to the other (not terribly likely). One additional reason to like it is that it closes the gap between how we'd see such a list in AS3 (namely, List<Fnord>) and in C++ (namely, GCList<Fnord>) - assuming AS3 had generic types :-)
Attachment #487787 - Flags: review?(lhansen) → review+
I worried for a minute about losing the ability to deal with plain values, e.g. struct Point { float x,y; }; GCList<Point> But thats nonsense right? (Points are not gc objects). And, plain List<> should still support non-pointer types. List<Point> and List<Point*> hopefully are both valid. I don't have a strong opinion about naming, but I'll say this anyway at the risk of being blacklisted. Since * would be implied, and the elements of the lists behave like individual GCRef<T>, should we call it GCRefList<T>? (ditto RCRefList).
(In reply to comment #7) > But thats nonsense right? (Points are not gc objects). And, plain List<> > should still support non-pointer types. List<> is no more, but DataList<Point> should work. > List<Point> and List<Point*> hopefully are both valid. DataList<Point*> explicitly will *not* work, you must use UnmanagedPointerList<Point*>. You might ask why this is, when the underlying representation is the same? Answer is that existing List<> usage in Flash/AIR code exhibited a lot of copy/paste errors with various pointer types; I felt that making the distinction between managed lists (GCList/RCList/WeakRefList) and unmanaged BE CAREFUL CRASHY DANGER LIES here lists (UnmanagedPointerList) was worth making painfully explicit. > lists behave like individual GCRef<T>, should we call it GCRefList<T>? (ditto > RCRefList). Once that lands, I'd be happy to entertain that change.
TR 5493:0082f4b772d1
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Attachment #487787 - Flags: feedback?(bgetlin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: