[question]userRPL, functions or (sub)subprograms and directories
|
03-29-2017, 02:44 PM
Post: #6
|
|||
|
|||
RE: [question]userRPL and functions or (sub)subprograms
(03-29-2017 12:51 PM)pier4r Wrote: Anyway my request for additional tips was mostly about "any other best practice how to code and use functions that are needed mainly by one main program?". I believe you've already found what is likely the best way to create and use embedded functions and subroutines for UserRPL -- create them as local vars and activate with local EVAL. This method keeps the source code together as a single object and is efficient with memory resources. The only downside that comes to mind for something like this might be performance, though only in situations where the function/subroutine is called many times. You're not likely to notice any performance issues for functions that are only used a few times. As you've already pointed out, storing programs/data into other user objects [aka globals] is a possibility. One additional advantage that this method brings is that you can use the object's location in your directory structure to control its scope. While this probably doesn't apply to what you originally intended, it's a worthy consideration for other situations, especially when different versions of the same function might apply to different scenarios. I'd be remiss if I didn't mention a third possibility, though it's fair to say that it's probably the least applicable in this case. That would be creating a custom library to contain your programs and data in a single coherent package. The overhead required makes this less feasible for simple situations, but it brings some nice benefits to projects with greater complexity or when you want to start controlling the "exposure" of individual elements of the application. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)