conceived as a browser-only client
language. Servers are usually programmed with quite different languages such as Java, PHP, and Ruby.
Recent experiments such as Node.
server, which makes the development
more coherent; however, harmonious
composition of independent components is still not ensured.
In 2006, three different projects—
namely, Google Web Toolkit (GWT),
Links from the University of Edin-
burgh, 1 and Hop from INRIA (http://
www.inria.fr) 5—offered alternative
methods for programming Web appli-
cations. They all proposed that a Web
application should be programmed as
a single code for the server and client,
written in a single unified language.
This principle is known as multitier
Figure 1. A file browser Web widget.
1:(define-tag <BROWSER> ((id (gensym)) ;; HTML identifier
2: (class #f) ;; HTML class
3: (path::bstring "/tmp")) ;; default initial path
4: (define (<dir-entry> path)
5: ;; function to build HTML display for directories
6: (<DIV> :data-hss-tag "dir-entry"
7: :onclick ˜(with-hop ($(service () (<directory> path)))
8: (lambda (h)
9: (innerHTML-set! $id h)))
in Java extensions. GUIs are based on
static components declared in external HTML files and on dynamic parts
generated by the client-side execution.
HTML are directly involved.
The Hop language takes another
path relying on a different idea: incorporating all the required Web-re-lated features into a single language
with a single homogeneous development and execution platform, thus
uniformly covering all the aspects of
a Web application: client side, server
side, communication, and access to
third-party resources. Hop embodies
user with a fully general algorithmic
language. Web services and APIs can
be used as easily as standard library
functions, whether on the server side
or client side.
(define (<file-entry> path)
;; function to build HTML display for files
(<DIV> :data-hss-tag "file-entry"
(define (<directory> path)
;; main display function
;; HTML representation of the parent directory
(<dir-entry> (make-file-name path ".."))
;; HTML representation of files
(map (lambda (np)
(if (directory? np)
(sort string<? (directory->path-list path)))))
;; main HTML element
(<DIV> :data-hss-tag "browser"
:id id :class class
Figure 1: A file browser Web Widget.
and htML Abstraction
This article presents the Hop approach to Web application programming, starting with the basic example
of a Web file viewer. In the first version, files and directories are listed
on a bare page. Directories are click-able to enable dynamic browsing, and
plain file names are displayed. This
simple problem illustrates the most
central aspect of realistic Web applications—namely, the tight collaboration and synchronization of servers
and clients. Here, the server owns
the files while the browser visualizes
them. When the user clicks on a directory, the client requests new information from the server.
Upon receipt, the client updates
the page accordingly. The file viewer
is easy to implement if each request
delivers a new complete page. By adding the requirement that the file viewer
should be a widget embedded inside a
complex Web page, the problem becomes slightly more difficult, since
updates now concern only incremental subparts of the documents. This
demands a new kind of collaboration
between the server and the client.