Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Default parameters within namespace


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
1 reply to this topic

#1 iraxef   Members   -  Reputation: 348

Like
0Likes
Like

Posted 05 June 2014 - 02:15 PM

I have some binding code along these lines:

engine->SetDefaultNamespace("MyNamespace");

engine->RegisterObjectType("MyType", sizeof(MyType), asOBJ_VALUE | as OBJ_POD | ...);

engine->RegisterObjectMethod("SomeObject", "MyType AFunction(MyType param = MyType()) const", ...);

If in script you call AFunction() and don't provide the default parameter, that script will fail to compile with:

Identifier 'MyType' is not a data type
A cast operator has one argument
Identifier 'MyType' is not a data type
The type of the default argument expression doesn't match the function parameter type

Is it possible to make the compiler look at the current 'default namespace' when resolving this default parameter?

 

Thank you!



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3352

Like
0Likes
Like

Posted 05 June 2014 - 05:03 PM

Yes, it should be possible to make the compiler use the namespace of function that the default arg is being evaluated for. I'll look into it.


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