Sometimes anonymous and inline functions as terms are used interchangeably.
I wrote an addOnce method that utilized a closure - an inline function
(it wasn't anonymous though) that subscribed to the main add (this is a
Signals implementation) method, then removes itself from within itself,
and calls the user func.
https://github.com/CaptainN/SignalsLite/blob/master/src/com/unfocus/signalslite/SignalLite.as
I tend to agree with you though in general. It's easier to work with
classes and class methods than with a hundred closures, especially
during debugging (and especially when they're all unnamed).
That said, JavaScript (which doesn't have proper classes, only
prototypes and closures) can be quite fun.
https://github.com/CaptainN/SignalsLite.js
There again, it's actually a lot better to name your functions (even
inline ones) because then they show up with a name in the error
messages. ;-)
Kevin N.
On 10/24/12 10:08 AM, Merrill, Jason wrote:
Ok, what's a good case to use them? Just curious, I have never found a
situation where they were warranted.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders