ERights Home elang / io 
No Previous Sibling x On to: Text File I/O

URI Expressions

The URI Literal Expression

Example Meaning Value
<c:/jabbertest/jabberwocky.txt> A file on the local file system a object
<> A web page a object
<import:java.util.Vector> Load a Java class or an EMaker the Class object for Vector
<cap:***actual persistent object> Sturdy Reference A remote E object

The URLs familiar from web browsing -- such as -- are actually a special case of a syntax known as a URI. (Not that it matters, but URL stands for Uniform Resource Locator, while URI stands for Uniform Resource Identifier.) E's grammar recognizes legal URIs (and therefore, legal URLs) enclosed in angle brackets as URI literal expressions. A URI literal expression starts with a protocol-identifier, such as "http" or "file", is followed immediately by a colon, which is immediately followed by the uri-body characters, such as "//" or "/jabberwocky.txt":


The protocol-identifier is a simple identifier that names a URI-protocol handler. It is up to the named handler to interpret the uri-body and return the value of the URI expression. The value of a URI expression will usually depend on which protocol handler is named. The URI body must begin with one of these characters:

a-z, A-Z, 0-9, any of ;/?@&+$-_.!~*'().%#\|

After the first character, the URI body consists of characters from this set, plus "=" and ":".

*** details: E doesn't quite recognize all legal URIs. The exceptions are the exclusion of "=" and ":" from the first uri-body character -- since it would cause confusion with ":=" (assignment) and "::" (reserved for future use). ***

*** details: \ and | are not actually legal URI characters, but appear in Netscape and/or Internet Explorer (clarify this) to mean / and : respectively. Accordingly, E normalizes \ to / and | to : before passing these to the protocol handler. ***

The URI Unary Expression (left associative)

Example Meaning Value
<file: expr> use a calculated value the File whose name is the value of expr

To look up a file or a web page using a calculated name, rather than a name you know when you write the program, use the URI unary expression:

<protocol-name: expression>

So, for example, both

def name := "c:/jabbertest/jabberwocky.txt"
<file: name>



mean the same thing. You can also use the URI unary expression to look up names that contain non-URI characters. For example, Windows machines have a top level directory names "Program Files". Since this name contains a space, you can't use the URI literal expression. But

<file: "/Program Files">

is just as good.

The "file:" URI

See Text File I/O.

***detail: to accomodate the way modern browsers operate on windows, a one-letter protocol handler is assumed to be a drive letter and turned into a file: uri whose body consists of the original uri. For example,


is turned into


which will fetch the file from your A drive (typically, a floppy). ***

Standard URLs (http:, ftp:, gopher:, news:, and mailto:)

These all evaluate to objects. See URLs.

The "import:" URI

After "import:" comes a Java fully qualified class name. If there is a class by this name (or if one can be loaded), that class is the value of this expression. This enables the equivalent of Java's import statement. Whereas in Java we might write

import java.util.Vector;
    Vector vec = ...     //used as a declaration
    ... new Vector() ... //calling constructor or static method

we'd instead say in E

def makeVector := <import:java.util.makeVector>
def Vector := makeVector.asType()
    def vec :Vector := ...     # declarations are optional in E
    ... makeVector() ... # calling constructor or static method

See Interfacing with Java.

The "cap:" URI

If the Vat containing the designated object is currently on-line and can be found, and if the designated object is still exported by that Vat, this evaluates to a remote (*** or network) pointer to that object. See Introducing Remote Objects.

***show expansion to kernel language

Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / io 
No Previous Sibling x On to: Text File I/O
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign