Re: Win32LIb/Llama Status

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 25 Jun 1999, Roderick Jackson wrote:

] >IMHO, it's a perfect argument for including and appending to an internal
] >routine_id() table for the interpreter.
]
] Hmmm... might work. But we'd still need the routine_id token as well,
] otherwise you couldn't get one on the fly:
]
]    sequence RoutineName
]
]    puts (1, "Enter procedure name to execute: ")
]    gets (RoutineName)
]
]    exec_procedure (routine_id (RoutineName), {})
]
]    RoutineName = GetInternalRoutine () -- determines another routine to use
]
]    exec_procedure (routine_id ("BuiltIn" & RoutineName), {})

I hadn't thought of using routine_id() like that. Maybe because asking a
user for a subroutine name seems insecure. One good/bad guess and the
system goes belly-up.

The other idea is a good one, but for things like that, you should be
developing your own sequence/table of ids like so:

-- builtins.e --
global sequence BuiltIn

function joblot()
    -- etc. etc.
    return something
end function

-- etc. etc.

BuiltIn = {
    routine_id("joblot"),
    routine_id("etc. etc."),
    ---
    }

-- program.ex --

-- Now use GIR() like so:

RoutineLocalId = GetInternalRoutine()
exec_procedure(BuiltIn[RoutineLocalId])

IMHO, using anything but straight strings in routine_id() calls is bad
programming practice. YMMV OC. :)

Carl

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail........: cyrek- at -bigfoot.com -- Remove hyphens. Ta :)
URL...........: http://www.bigfoot.com/~cyrek/
Uncrackable...: "19.6A.23.38.52.73.45 25.31.1C 3C.53.44.39.58"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu