Interfaces shouldn't always be a pointer!

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Interfaces shouldn't always be a pointer!

Post by Dreglor »

It occurred to me that interfaces are always a forced pointer, weather or not you have * prefixed the variable. it somewhat troubling, I can understand that under most circumstances that interfaces would be a pointer (created off site) and it looks neater to omit the pointer symbol from the code under these conditions. however, it looks sloppy and inconsistent to have interfaces along side of structures and or under the same block of memory (Objects). It would be consistent, cleaner, and easier to have variables using a interface type be declared like a structure (actually allocating the memory) and use the garbage collection that Pure Basic has built in for local variables, given that off site or complex interfaces still have to do there own garbage collecting with release(). Just my two cents on the issue.

to simply put it, It would be nice to have control weather its is a pointer or not.
~Dreglor
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Not sure I understand what you are suggesting there? An interface variable is a pointer (in that it holds an address) - full-stop, no getting away from that. Whether you use the * prefix is entirely up to you when declaring an object variable.
I may look like a mule, but I'm not a complete ass.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

well interfaces as they are now are a pointer to a structure like this

interfacevariable -> *vtable.i -> method1.prototype


so instead of having a pointer point to another pointer why not remove one less pointer and leave it as a structure of methods with a veector pointer at the top
~Dreglor
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Because then it wouldn't be an interface. An interface as laid out by the COM standard is a very precise thing, change it and it can no longer be called an interface.
I may look like a mule, but I'm not a complete ass.
Post Reply