Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

any reason that heirarchies can not be registered for value types


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 randomguy12345   Members   -  Reputation: 105

Like
0Likes
Like

Posted 05 September 2012 - 10:17 PM

http://www.angelcode..._hierarchy.html
mentions that
Hierarchies can currently only be registered for reference types, not for value types.
why is it so. is it a design choice?


I mean , if i have value type(for performance reasons) of "ZFraction" and "ZIrrational" . Now i would definitely like them to be a subclass of "ZReal".
Just due to the above restriction, i will be forced to use reference type, which will make the performance poor, as it heap based.

Edited by randomguy12345, 06 September 2012 - 07:31 PM.


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3370

Like
0Likes
Like

Posted 06 September 2012 - 08:03 AM

Do you really need for a ZInteger to be treated as a ZFraction or vice versa through polymorphing?

It's currently not possible to do reference casts for value types, but that doesn't mean you can't register both ZInteger and ZFraction even if they are base and subclass in C++.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 randomguy12345   Members   -  Reputation: 105

Like
0Likes
Like

Posted 06 September 2012 - 07:52 PM

ha..ha.. Actually my bad. It was a typing mistake.
I do not want the "ZFraction" and "ZIrrational" to be a subclass of "ZInteger".
I want the "ZFraction" and "ZIrrational" to be a subclass of "Real". I have edited and corrected my original question.
We keep ZFraction , because we want to store say 1/3 instead of 0.3333333333.....
but many Irrational do not have fraction representations, they may be quadratic surds etc.


Actually, I want to develop a object oriented scripted framework for high speed " mathematical computation", as it needs to be very high speed hence i am not doing it in java. I want to do it ALL in C++ classes, but only the interfaces will be exposed to angelscript. The reason i chose angelscript has nothing to do with static typing or feature x or feature y . i chose angelscript because it lets me define "my own" types(ie, value types) which will exist on "stack", not on heap, this will give me less cost to speed performance compared to heap approach. This (custom-classes on stack) is not possible in almost any of the C like syntax based scripting languages for C++, it seems to be possible only in angelscript.

But on the above said url in my question , when i was preliminarily reading . It says that if i make them value types then i can not make object oriented heriarchies in them.

my heirarchy (ZFraction and ZIrrational are subclasses of ZReal . There are other classes in this heirarchy as well ZComplex, ZNatural ) etc. All will be implemented as C++ classes as proper parent and child classes.

Now, you said in your reply that
"It's currently not possible to do reference casts for value types, but that doesn't mean you can't register both ZInteger and ZFraction even if they are base and subclass in C++."

Now, from your reply i could not understand much, that by any workaround whether you are saying its possible: yes or no .

If i expose ZFraction and ZIrrational and ZReal (originally implemtned in C++) to angelscript as VALUE TYPE, then are you saying that i can still expose child-parent relationship of ZFraction and ZReal to angelscript, even if they are value types, using some workaround? Any relevant url for this?
sorry for the trouble, but its extremely important for me.

Edited by randomguy12345, 06 September 2012 - 07:58 PM.


#4 Andreas Jonsson   Moderators   -  Reputation: 3370

Like
0Likes
Like

Posted 06 September 2012 - 08:36 PM

I just don't know in what cases you will actually use the child-parent relationship for the ZFraction and ZReal types. Can you show an example? Wouldn't implicit value casts do just as well?

If you can just explain to me why there is such great need for the child-parent relationship to be known to AngelScript, then I'll look into implementing the necessary support.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS