>
> Is there any way to force the evaluated expression to be searched for as
> an external routine?
>

Glenn, you might want to use Routine class' newFile() method to load an
external routine, and then run it with the call() or callWith() method.

Your code you might use something like this:

.External~call("time")
say .External~call("reverse", string)

::requires external.cls


*external.cls:*
/*
loads an external routine, parses and caches it for future use,
and runs it with optional arguments
e. g. say .External~call("reverse", string)
*/
::class External public

::method activate class
  expose cache
  cache = .Directory~new

::method call class
  expose cache
  use strict arg name, ...
  -- is this a first?
  if .nil == cache[name] then do
    -- load external source
    routine = .Routine~newFile(name || ".rex")
    -- save for future use
    cache[name] = routine
  end
  -- just run the code, with or without args
  return cache[name]~callWith(arg(2, 'a'))

On Tue, Feb 21, 2017 at 4:39 AM, Glenn Knickerbocker <n...@bestweb.net>
wrote:

> On Mon, 13 Feb 2017 22:32:18 -0500, Les K wrote:
> >return 'REVERSE'(string)
>
> And you can do the same with CALL:
>
>   Call 'REVERSE' string
>
> But what CALL also allows is for the name of the routine to be evaluated
> from an expression:
>
>   rev = 'rev'
>   erse = 'erse'
>   Call (rev || erse) string
>
> A name with any lowercase letters will never match an internal routine,
> so ooRexx will search for an external routine by that name (with all the
> rules of external searches applied, so case is ignored in searching for
> named routines or Windows files).
>
> But what if I don't know in advance that the name has any letters?  Or
> what if I'm on a system with case-sensitive filenames, so I can't
> translate it to lower case?  Is there any way to force the evaluated
> expression to be searched for as an external routine?
>
> Putting quotes in the value of the expression doesn't do it:
>
>   Call ("'REVERSE'") string
>
> That looks for a routine whose name is 'REVERSE' including the quotes.
>
> ¬R
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to