19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

default distributions will provide programmers with good performance over a variety of machines. However, in some<br />

circumstances, performance can be improved by overriding the default selection of distributions. Moreover, some<br />

programmers might wish to define these distributions, tailored for particular platforms and programs.<br />

2.16.3 Operator Overloading<br />

Operators in <strong>Fortress</strong> can be overloaded with new definitions. Here is an alternative definition of the factorial function,<br />

defined as a postfix operator:<br />

opr (n)! = ∏<br />

i←1:n<br />

i<br />

As with mathematical notation, <strong>Fortress</strong> allows operators to be defined as prefix, postfix, and infix. More exotic<br />

operators can even be defined as subscripting (i.e., applications of the operators look like subscripts), and as bracketing<br />

(i.e., applications of the operators look like the operands have been simply enclosed in brackets).<br />

2.16.4 Definition of New Syntax<br />

<strong>Fortress</strong> provides a facility for the definition of new syntax in libraries. This facility is useful for defining libraries for<br />

domain-specific languages, such as SQL, XML, etc. It is also used to encode some of the language constructs seen by<br />

applications programmers.<br />

33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!