Delegates are fully working now

Started by
12 comments, last by saejox 11 years ago

I've checked in the fix in revision 1614.

I'm glad you like the new features. I'm always trying to improve the library.

By the way, it's now officially 10 years since the first public release of AngelScript biggrin.png Back then the script language only supported 32bit int and float types ph34r.png

Regards,

Andreas

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

Advertisement

Hi, its me again :)

Will delegates support implicit conversion from functions and methods?

At the moment I'm very conflicted if i should add funcdefs like this: fn_void_int_float .

Because its very hard to remember all those delegate names.
I have less than 10 and still forget the correct one. I do suck at memorizing stuff :D Autocomplete ruined me i guess.

Creating a delegate requires an explicit construct call with the name of the funcdef. I don't plan on having the compiler implicitly create delegates. My recommendation is that you name your funcdef with names that reflect what they meant to be used for, and not their signatures. That ought to make it easier to remember the names :)

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

Okay, i understand. Not a big issue. I knew it was far stretch anyways. rolleyes.gif

I think i will name them using their signatures.

an example:


AddEvent(FrameEnded, FrameEndedDelegate(func));

but this also has a variant that gives takes a float.

so i need to find another meaningful name. Like


AddEvent(FrameEnded, FrameEndedDelegateWithTimePassed(func));

This gets too complex for my taste. if i were to name it based on signature then i don't need to remember just formulate its name from the signature of the bound function. That function the one she wrote, she can figure delegate name easily.

Another thing when the delegate name is typed wrong since there are too many overloads of the AddEvent resulting error message is not helpful.

One more is that i can generate funcdef declarations using a simple for loop, fn_void_void, fn_void_int, fn_void_float etc... Saves me typing and figuring out clever names for each delegate. Like a poor man's template :P

Since, i have no real experience with named delegates. Maybe i will be doing wrong. Time will tell :)

This topic is closed to new replies.

Advertisement