My take on polymorphism #13
Loading…
Reference in New Issue
No description provided.
Delete Branch "polymorphism-take-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
So, this is very close to what @carlosmn had. I just abstracted the common
Object
code into theobject.go
file and added a global helper that sets the finalizers for all allocations, so we can re-use it all over the code base.@carlosmn, how do you feel about it?
Looks good. I like
lookupType
.I wonder if there's a way we can have one finalizer for all types. Underneath it's just
git_object_free
anyway.Like this?
Yeah, that's awesome, the common parts belong to the basic object.
Why did you remove the pointer receivers for the functions? Putting them back doesn't show any errors when compiling or running the tests.
There is actually a deeper problem with removing the pointer-receivers. runtime.SetFinalizer expects a pointer-receiver, so having a value-receiver breaks stuff here (I actually get a runtime-error because of that here).
EDIT: Sorry, seem to be sleep-deprived, the Free()-methods still have pointers? Then the error has to be at another point…
EDIT2: No, it is not really. gitObject.Free() still has a value-receiver, as it seems, which reproducibly creates a crash when the runtime tries to garbage-collect an objec. Error is
changing it to a pointer-receiver gets rid of the problem.
EDIT3: Created a (trivial) pull-request on polymorphism-take-2 to change it to a pointer-receiver
Not that my opinion will count much, but I like that change and would like to see it merged ;)
Brilliant. Sorry it took me so long to go through the PR list, @Merovius. Got so much stuff on my plate right now.
Expect me to revisit these bindings and greatly expand them in about a month (I'm going to actually start using them). Until them, your PRs are always appreciated.
luv,
vmg