Skip to main content

Reflections in Opal – Meta Information in a Functional Programming Language

  • Conference paper
Implementation of Functional Languages (IFL 1999)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1868))

Included in the following conference series:

  • 216 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. The Opal Home Page, http://uebb.cs.tu-berlin.de/~opal

  2. Abadi, M., Cardelli, L., Pierce, B., Remy, D.: Dynamic Typing in Polymorphic Languages. Journal of Functional Programming 5(1), 111–130 (1996)

    Article  Google Scholar 

  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. 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. 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)

    Chapter  Google Scholar 

  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. Hall, C.V., Hammond, K., Jones, S.L.P., Wadler, P.: Type Classes in Haskell. In: ESOP (January 1994)

    Google Scholar 

  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. Leroy, X., Mauny, M.: Dynamics in ML. Journal of Functional Programming 3(4), 431–463 (1993)

    Article  Google Scholar 

  10. Pepper, P.: Funktionale Programmierung in OPAL, ML, HASKELL und GOFER. Springer-Lehrbuch, Hidleberg (1998) ISBN 3-540-64541-1

    Google Scholar 

  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)

    Chapter  Google Scholar 

  12. Sun Microsystems Inc.: JavaTM Core Reflection, API and Specification (1997); Part of the JDK documentation

    Google Scholar 

  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 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics