• Create Account

## Double handle

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.

5 replies to this topic

### #1iraxef  Members

Posted 06 June 2014 - 09:44 PM

If I have code like the below:

AppRegisteredType @ @ foo = ...;


What should the behavior be as far as the double handle? Should it be a compiler error? Or is it OK that it works as-is?

Thank you.

### #2Andreas Jonsson  Moderators

Posted 07 June 2014 - 06:45 AM

It should be a compilation error. Handles of handles is not possible, since that would mean that the actual handle itself was also reference counted, which isn't the case.

Are you saying that it compiles without error?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #3Andreas Jonsson  Moderators

Posted 07 June 2014 - 07:18 AM

Fixed in revision 1952

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #4iraxef  Members

Posted 21 July 2014 - 09:20 PM

It turns out I need to maintain support for handle of a handle for backwards compatibility purposes. If you can spare the time, please let me know what you think of the attached diff (whether you'd do anything differently in order to support this locally).

Thank you very much!

### #5Andreas Jonsson  Moderators

Posted 22 July 2014 - 08:05 AM

I'm sorry, but it does not make sense to keep this kind of backwards compatibility in the library. It was never a valid syntax to begin with. It was just a bug in the compiler that it ignored the extra handle.

If you want to allow compiling scripts with this kind of invalid syntax I suggest you do a preprocessor pass to look for the existance of double handles and exchange one of them for a space character before giving the code to the script compiler. It can be done with a quick linear pass over the code. The engine's ParseToken method can ideally be used to identify the separate tokens so that you do not need to worry about falsely identifying @ tokens in strings.

If you're already using the CScriptBuilder add-on you should preferrably add this check in the CScriptBuilder::ProcessScriptSection method, this way you'll avoid an extra pass over the code and thus get next to zero impact on build times.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

### #6iraxef  Members

Posted 22 July 2014 - 08:26 PM

I'm sorry, but it does not make sense to keep this kind of backwards compatibility in the library. It was never a valid syntax to begin with. It was just a bug in the compiler that it ignored the extra handle.

Agreed - I'll have to keep a local patch for as long as I need to maintain the backwards compatibility. I was just hoping you could double-check the patch for me.

However, I think I got it all working, so no worries.

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.