Method, system, and program for executing program
AssigneeInternational Business Machines Corporation
InventorMichiaki Tatsubori
Life of this patent
Estimating the term…
Abstract
A computer implemented method for virtually executing a program having property declarations of classes in a first programming language that is a dynamic scripting language on an execution system of a second programming language. The method includes: generating an interface class from a property name in the first programming language; loading the interface class; and preparing a class hierarchy on the execution system of the second programming language. A system and a computer readable article of manufacture for executing the same are also provided.
Claims10
A computer implemented method for virtually executing a program having property declarations of classes in a first programming language that is a dynamic scripting language on an execution system of a second programming language, the method comprising the steps of:
- generating an interface class that is uniquely determined from a property name in the program in the first programming language;
- loading the interface class;
- and
- preparing, for a first class of the first programming language occurring during execution of the program in the first programming language, when the first class of the first programming language directly inherits a second class of the first programming language, a class hierarchy on the execution system of the second programming language so that the class hierarchy corresponds to a dynamically created class hierarchy on the program in the first programming language by caching a second class of the second programming language inheriting a first class of the second programming language, with the first class of the second programming language corresponding to the first class of the first programming language being a key;
- determining whether a second object of the second programming language, corresponding to a first object of the first programming language, is an instance of an interface class of the second programming language;
- and
- converting an operator of the first programming language for obtaining a property of the first object of the first programming language to a conditional operator of the second programming language and a function that returns a corresponding property of the second object of the second programming language in response to determining that the second object of the second programming language, corresponding to the first object, is the instance of the interface class of the second programming language, wherein the converting obviates a use of a hash table;
- wherein fields are prepared in the first and second classes of the second programming language corresponding to the respective property declarations of the first and second classes of the program in the first programming language,
- wherein a processor connected to a memory device is configured to perform:
- the generating, the loading, the preparing, the determining and the converting.
A computer readable article of manufacture tangibly embodying non-transitory computer readable instructions which, when executed, cause a computer to carry out the steps of a method for virtually executing a program in a first programming language that is a dynamic scripting language, the program having property declarations of classes, on an execution system of a second programming language, the steps of:
- generating an interface class that is uniquely determined from a property name in the program in the first programming language;
- loading the interface class;
- preparing, for a first class of the first programming language occurring during execution of the program in the first programming language, when the first class of the first programming language directly inherits a second class of the first programming language, a class hierarchy on the execution system of the second programming language so that the class hierarchy corresponds to a dynamically created class hierarchy on the program in the first programming language by caching a second class of the second programming language inheriting a first class of the second programming language, with the first class of the second programming language corresponding to the first class of the first programming language being a key;
- determining whether a second object of the second programming language, corresponding to a first object of the first programming language, is an instance of an interface class of the second programming language;
- and
- converting an operator of the first programming language for obtaining a property of the first object of the first programming language to a conditional operator of the second programming language and a function that returns a corresponding property of the second object of the second programming language in response to determining that the second object of the second programming language, corresponding to the first object, is the instance of the interface class of the second programming language, wherein the converting obviates a use of a hash table;
- wherein fields are prepared in the first and second classes of the second programming language corresponding to the respective property declarations of the first and second classes of the program in the first programming language.
A computer implemented system for virtually executing a program in a first programming language that is a dynamic scripting language, the program having property declarations of classes, on an execution system of a second programming language, the system comprising:
- a memory device;
- a processor connected to the memory device,
- wherein the processor is configured to perform:
- generating an interface class that is uniquely determined from a property name in the program in the first programming language;
- loading the interface class;
- and
- preparing, for a first class of the first programming language occurring during execution of the program in the first programming language, when the first class of the first programming language directly inherits a second class of the first programming language, a class hierarchy on the execution system of the second programming language so that the class hierarchy corresponds to a dynamically created class hierarchy on the program in the first programming language by caching a second class of the second programming language inheriting a first class of the second programming language, with the first class of the second programming language corresponding to the first class of the first programming language being a key;
- determining whether a second object of the second programming language, corresponding to a first object of the first programming language, is an instance of an interface class of the second programming language;
- and
- converting an operator of the first programming language for obtaining a property of the first object of the first programming language to a conditional operator of the second programming language and a function that returns a corresponding property of the second object of the second programming language in response to determining that the second object of the second programming language, corresponding to the first object, is the instance of the interface class of the second programming language, wherein the converting obviates a use of a hash table;
- wherein fields are prepared in the first and second classes of the second programming language corresponding to the respective property declarations of the first and second classes of the program in the first programming language.
Dependencies are inferred from the claim text.