Reflections in Opal – Meta Information in a Functional Programming Language

  • Klaus Didrich
  • Wolfgang Grieskamp
  • Florian Schintke
  • Till Tantau
  • Baltasar Trancón-y-Widemann
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1868)


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.


Functional Language Opal Language Dynamic Type Runtime Overhead Code Repository 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
    Abadi, M., Cardelli, L., Pierce, B., Remy, D.: Dynamic Typing in Polymorphic Languages. Journal of Functional Programming 5(1), 111–130 (1996)CrossRefGoogle Scholar
  3. 3.
    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)Google Scholar
  4. 4.
    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)Google Scholar
  5. 5.
    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)CrossRefGoogle Scholar
  6. 6.
    Futatsugi, K., Goguen, J.A., Jouannaud, J.-P., van Meseguer, J.: Principles of OBJ2. In: 12th ACM Symposium on Principles of Programming Languages (1985)Google Scholar
  7. 7.
    Hall, C.V., Hammond, K., Jones, S.L.P., Wadler, P.: Type Classes in Haskell. In: ESOP (January 1994)Google Scholar
  8. 8.
    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)Google Scholar
  9. 9.
    Leroy, X., Mauny, M.: Dynamics in ML. Journal of Functional Programming 3(4), 431–463 (1993)CrossRefGoogle Scholar
  10. 10.
    Pepper, P.: Funktionale Programmierung in OPAL, ML, HASKELL und GOFER. Springer-Lehrbuch, Hidleberg (1998) ISBN 3-540-64541-1Google Scholar
  11. 11.
    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)CrossRefGoogle Scholar
  12. 12.
    Sun Microsystems Inc.: JavaTM Core Reflection, API and Specification (1997); Part of the JDK documentationGoogle Scholar
  13. 13.
    Wirsing, M.: Handbook of Theoretical Computer Science. In: van Leeuven, J. (ed.) Algebraic Specification, ch. 13, pp. 675–788. North-Holland, Amsterdam (1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Klaus Didrich
    • 1
  • Wolfgang Grieskamp
    • 1
  • Florian Schintke
    • 1
  • Till Tantau
    • 1
  • Baltasar Trancón-y-Widemann
    • 1
  1. 1.Technische Universität Berlin 

Personalised recommendations