Asked By : sandeepkunkunuru
Answered By : Mike Samuel
At a simple level, this can be seen as a macro-like facility, although it is more powerful than most existing macro facilities as arbitrary code can be run at compile-time. Using this, one can interact with the compiler, and generate code safely and easily as ITrees (a.k.a. abstract syntax trees).
which is a step up from Scheme’s hygienic macros that allow referentially transparent macro definitions. Mechanisms like quasiliterals have allowed constructing and destructuring of parse trees in other languages, but those are more often used for interacting with domain-specific languages (DSLs) instead of self-modification. Newspeak’s reflection allow exceptions to be implemented as library code.
7.6 Exception Handling
Because Newspeak provides reflective access (7.2) to the activation records(3.6), exception handling is purely a library issue. The platform will provide a standard library that supports throwing, catching and resuming exceptions, much as in Smalltalk.
Perligata:Romana demonstrates how an entirely new syntax can be skinned onto a language.
This paper describes a Perl module — Lingua::Romana::Perligata — that makes it possible to write Perl programs in Latin.
Arguably not semantically significant, PyPy is an interpreter generator for languages whose semantics are specified in a highly statically-analyzable subset of Python, and they use it to experiment with new language constructs in Python like adding thunks to the language. Also of interest might be Ometa.
This dissertation focuses on experimentation in computer science. In particular, I will show that new programming languages and constructs designed specifically to support experimentation can substantially simplify the jobs of researchers and programmers alike. I present work that addresses two very different kinds of experimentation. The first aims to help programming language researchers experiment with their ideas, by making it easier for them to prototype new programming languages and extensions to existing languages. The other investigates experimentation as a programming paradigm, by enabling programs themselves to experiment with different actions and possibilities— in other words, it is an attempt to provide language support for what if…? or possible worlds reasoning.
Alex Warth’s dissertation demonstrates using an Ometa to define significantly new semantics (transactional semantics via worlds) in JavaScript+Ometa.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/1560