Abstract
We report on an extension of the Opal system that allows the use of reflections. Using reflections, a programmer can query information like the type of an object at runtime. The type can in turn be queried for properties like the constructor and deconstructor functions, and the resulting reflected functions can be evaluated. These facilities can be used for generic meta-programming. We describe the reflection interface of Opal and its applications, and sketch the implementation. For an existing language implementation like Opal’s the extension by a reflection facility is challenging: in a statically typed language the management of runtime type information seems to be an alien objective. However, it turns out that runtime type information can be incorporated in an elegant way by a source-level transformation and an appropriate set of library modules. We show how this transformation can be done without changing the Opal core system and causing runtime overhead only where reflections are actually used.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
The Opal Home Page, http://uebb.cs.tu-berlin.de/~opal
Abadi, M., Cardelli, L., Pierce, B., Remy, D.: Dynamic Typing in Polymorphic Languages. Journal of Functional Programming 5(1), 111–130 (1996)
Abadi, M., Cardelli, L., Pierce, B., Plotkin, G.: Dynamic Typing in a Statically-Typed Language. In: 16th ACM Symposium on Principles of Programming Languages, pp. 213–227 (1989)
Didrich, K., Fett, A., Gerke, C., Grieskamp, W., Pepper, P.: OPAL: Design and Implementation of an Algebraic Programming Language. In: Gutknecht, J. (ed.) Programming Languages and System Architectures. LNCS, vol. 782, pp. 228–244. Springer, Heidelberg (1994)
Didrich, K., Grieskamp, W., Maeder, C., Pepper, P.: Programming in the Large: the Algebraic-Functional Language Opal 2α. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, pp. 323–338. Springer, Heidelberg (1998)
Futatsugi, K., Goguen, J.A., Jouannaud, J.-P., van Meseguer, J.: Principles of OBJ2. In: 12th ACM Symposium on Principles of Programming Languages (1985)
Hall, C.V., Hammond, K., Jones, S.L.P., Wadler, P.: Type Classes in Haskell. In: ESOP (January 1994)
Hartel, P.H., Feeley, M., Alt, M., Augustsson, L., Baumann, P., Beemster, M., Chailloux, E., Flood, C.H., Grieskamp, W., van Groningen, J.H.G., Hammond, K., Hausman, B., Ivory, M.Y., Jones, R.E., Kamperman, J., Lee, P., Leroy, X., Lins, R.D., Loosemore, S., Röjemo, N., Serrano, M., Talpin, J.-P., Thackray, J., Thomas, S., Walters, P., Weis, P., Wentworth, P.: Benchmarking implementations of functional languages with “pseudoknot”, a Float-Intensive benchmark. Journal of Functional Programming 6(4) (1996)
Leroy, X., Mauny, M.: Dynamics in ML. Journal of Functional Programming 3(4), 431–463 (1993)
Pepper, P.: Funktionale Programmierung in OPAL, ML, HASKELL und GOFER. Springer-Lehrbuch, Hidleberg (1998) ISBN 3-540-64541-1
Pil, M.: Dynamic types and type dependent functions. In: Hammond, K., Davie, T., Clack, C. (eds.) IFL 1998. LNCS, vol. 1595, pp. 169–185. Springer, Heidelberg (1999)
Sun Microsystems Inc.: JavaTM Core Reflection, API and Specification (1997); Part of the JDK documentation
Wirsing, M.: Handbook of Theoretical Computer Science. In: van Leeuven, J. (ed.) Algebraic Specification, ch. 13, pp. 675–788. North-Holland, Amsterdam (1990)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Didrich, K., Grieskamp, W., Schintke, F., Tantau, T., Trancón-y-Widemann, B. (2000). Reflections in Opal – Meta Information in a Functional Programming Language. In: Koopman, P., Clack, C. (eds) Implementation of Functional Languages. IFL 1999. Lecture Notes in Computer Science, vol 1868. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10722298_9
Download citation
DOI: https://doi.org/10.1007/10722298_9
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67864-9
Online ISBN: 978-3-540-44658-3
eBook Packages: Springer Book Archive