Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

asEP_ALLOW_IMPLICIT_HANDLE_TYPES and OMG!


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
4 replies to this topic

#1 FDsagizi   Members   -  Reputation: 514

Like
0Likes
Like

Posted 24 October 2012 - 03:13 AM

hi Posted Image

I was very tormented native system of work with references! I always use the links to be mistaken! But sometimes mistaken.


Always difficult to know what can make this code:


http://www.everfall....hp?8x2ooxr0acic

class Imp
{
Imp() { val = 9; }
string GetStr() { return "" + val; }
int val;
}
void startGame( string &param )
{
Imp im = Imp();
Imp @im2 = Imp();

im2.val = 99;

im2 = im; // Why need copy, why why why ? im2 its Reference!Posted Image

im.val = 0;

output( "im: " + im.GetStr() );
output( "im2: " + im2.GetStr() );
}




I often make a mistake forgetting to write "@" im2 = im


I found this thread: http://www.gamedev.n...etreturntypeid/

and i look in to - https://angelscript....licithandle.cpp And i say: OMG!!!! O! M! G!!!!Posted Image

Why did I not know about this before? It would have saved me a lot of nerve! I am angry at myself!

But! How to register c++ class ?


r=en->RegisterObjectType( "Scene", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );


try this:

r=en->RegisterObjectType( "class@ Scene", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectType( "@Scene", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );
r=en->RegisterObjectType( "Scene@", 0, asOBJ_REF | asOBJ_NOCOUNT ); assert( r >= 0 );

i can fail, fail, fail.

Edited by FDsagizi, 24 October 2012 - 03:16 AM.


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
0Likes
Like

Posted 24 October 2012 - 08:45 AM

The implicit handle feature is just experimental at the moment. Unfortunately it only works for script declared classes, and not registered classes.
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 FDsagizi   Members   -  Reputation: 514

Like
0Likes
Like

Posted 24 October 2012 - 08:22 PM

what are you going to do next in this area?

#4 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
0Likes
Like

Posted 25 October 2012 - 01:56 PM

For version 3.0 I'm considering going 100% implicit handles and remove the @ symbol completely from from the language (the result being much more similar to Java). Version 3.0 is very far away though, and my plans can change many times until then.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#5 cellulose   Members   -  Reputation: 169

Like
0Likes
Like

Posted 02 November 2012 - 01:05 PM

I think that might avert a great deal of confusion -- I've had some of my collaborators trip over the present @ semantics. A new operator like ":=" for value assignment might be an order if such a change is made, though.




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