 Originally Posted by khh
Yeah. That's not at all how I imagined they would work, but it seems fairly logical now that you present the idea. (Though I had to look spend some time just looking the code over and mentally executing it to get the picture :p)
How would you include user defined functions? One way of doing it could be to just paste the code for each time it's used (like inline functions), but how would you get proper functions?
Also, I'm guessing it would be pretty essential to implement a syntax checker?
I actually don't implement a syntax checker, my company has a dev-staging-live process, my app is live so it's assumed that everything is correct when it gets to me.
I do implement inline functions in that very way, and as for user defined real functions, well, my current language doesn't support those at this time, but I plan to add them in the very near future. They aren't that difficult. Basically, you would just replace a call to that function with something like @UserDefined(<place>) during a preprocessing pass. Then when you compile your callbacks, you have it point to the function that you've defined.
Yeah, scripting languages are weird things, and difficult to start implementing, but once you've done a few of them, you can write pretty advanced ones really quickly.
 Originally Posted by Artelis
How do I write a callback function that will get called at a rate that I can define?
You mean in a scripting language, or in C++?
|
|
Bookmarks