Indeed (re: Re^2: Extending a perl program with Scheme, Lua, or JS)! That's exactly how I got my degree, got out of a lengthy prison sentence and keep adding extra money to my bank account every month. All via a script.
Seriously now, you may believe that defining a function (in X language) to take in data structures (plain arrays which can soon become Perl's objects or hashes) and then, I guess, modify these data structures back in the main Perl program is trivial. And all these for the sake of avoiding a shift. But you may be happier if you reconsider. For example shift can also be written as $_[0] or using the power of OO:
my ($teacher_obj, $student_obj, $new_grades) = @_; $student_obj->teacher_modify_grades($new_grades, $teacher_obj);
The argument for keeping within Perl can only be strengthen by looking at modules like dc, bc which are not shelling out to bc but implement its operation in Perl or C. And of course, you can create any calculator to suit your needs using Marpa by following MarpaX::ESLIF::Tutorial::Calculator.
In any event, I would keep the calculator for calculating. And provide an API for the higher-level operations. But that's me.
In reply to Re: Extending a perl program with Scheme, Lua, or JS
by bliako
in thread Extending a perl program with Scheme, Lua, or JS
by bcrowell2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |