Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSir Ementaler

Posted 03 July 2013 - 05:45 AM

I think the topic name accurately describes the problem I encountered while using AngelScript. It's not a major error, but it bothers me. For reference, C++ standard allows nameless function arguments with default values:

void foo(int=0);

AngelScript supports both nameless function arguments (foo(int)) and default values of arguments (foo(int unused=0) - currently the best substitute, but if this were C++, some compilers would generate a warning about an unused argument), but the above code is for no apparent reason considered incorrect.

 

Now I realize your first thought might be that something like this is completely useless. I already went through explaining how it can be used to my friend, whose first response was "it really feels like you should be doing whatever you're doing in another way", but who later admitted this solution would be the best one. I don't want to get into detail again; in short, it's about functions that have to fit a certain funcdef, so they support handles of that kind, but at the same time are also meant to be called from code directly.


#1Sir Ementaler

Posted 03 July 2013 - 05:42 AM

I think the topic name accurately describes the problem I encountered while using AngelScript. It's not a major error, but it bothers me. For reference, C++ standard allows nameless function arguments with default values:

void foo(int=0);

AngelScript supports both nameless function arguments (foo(int)) and default values of arguments (foo(int unused=0)), but the above code is for no apparent reason considered incorrect.

 

Now I realize your first thought might be that something like this is completely useless. I already went through explaining how it can be used to my friend, whose first response was "it really feels like you should be doing whatever you're doing in another way", but who later admitted this solution would be the best one. I don't want to get into detail again; in short, it's about functions that have to fit a certain funcdef, so they support handles of that kind, but at the same time are also meant to be called from code directly.


PARTNERS