Updates docs and news.

This commit is contained in:
Dominik Picheta 2014-04-06 20:46:31 +01:00
commit b2fd562983
6 changed files with 211 additions and 85 deletions

View file

@ -223,6 +223,30 @@ Internet Protocols and Support
* `uri <uri.html>`_ * `uri <uri.html>`_
This module provides functions for working with URIs. This module provides functions for working with URIs.
* `asyncdispatch <asyncdispatch.html>`_
This module implements an asynchronous dispatcher for IO operations.
**Note:** This module is still largely experimental.
* `asyncnet <asyncnet.html>`_
This module implements asynchronous sockets based on the ``asyncdispatch``
module.
**Note:** This module is still largely experimental.
* `asynchttpserver <asynchttpserver.html>`_
This module implements an asynchronous HTTP server using the ``asyncnet``
module.
**Note:** This module is still largely experimental.
* `net <net.html>`_
This module implements a high-level sockets API. It will replace the
``sockets`` module in the future.
* `rawsockets <rawsockets.html>`_
This module implements a low-level sockets API.
Parsers Parsers
------- -------

View file

@ -13,13 +13,19 @@ import rawsockets
export TPort export TPort
## AsyncDispatch ## AsyncDispatch
## -------- ## -------------
## ##
## This module implements a brand new dispatcher based on Futures. ## This module implements a brand new dispatcher based on Futures.
## On Windows IOCP is used and on other operating systems the selectors module ## On Windows IOCP is used and on other operating systems the ``selectors``
## is used instead. ## module is used instead.
##
## **Note:** This module is still largely experimental.
# TODO: Discarded void PFutures need to checked for exception. # TODO: Discarded void PFutures need to checked for exception.
# TODO: Exceptions are currently uncatchable due to the limitation that
# you cannot have yield in a try stmt. Perhaps I can get the macro to put
# a user's try except around ``future.read``.
# -- Futures # -- Futures

View file

@ -8,6 +8,8 @@
# #
## This module implements a high performance asynchronous HTTP server. ## This module implements a high performance asynchronous HTTP server.
##
## **Note:** This module is still largely experimental.
import strtabs, asyncnet, asyncdispatch, parseutils, parseurl, strutils import strtabs, asyncnet, asyncdispatch, parseutils, parseurl, strutils
type type

View file

@ -6,6 +6,44 @@
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
## This module implements a high-level asynchronous sockets API based on the
## asynchronous dispatcher defined in the ``asyncdispatch`` module.
##
## Example
## =======
##
## The following example demonstrates a simple chat server.
##
## .. code-block::nimrod
##
## import asyncnet, asyncdispatch
##
## var clients: seq[PAsyncSocket] = @[]
##
## proc processClient(client: PAsyncSocket) {.async.} =
## while true:
## let line = await client.recvLine()
## for c in clients:
## await c.send(line & "\c\L")
##
## proc serve() {.async.} =
## var server = newAsyncSocket()
## server.bindAddr(TPort(12345))
## server.listen()
##
## while true:
## let client = await server.accept()
## clients.add client
##
## processClient(client)
##
## serve()
## runForever()
##
##
## **Note:** This module is still largely experimental.
import asyncdispatch import asyncdispatch
import rawsockets import rawsockets
import net import net

View file

@ -3,21 +3,75 @@ News
==== ====
..
2014-XX-XX Version 0.9.4 released 2014-XX-XX Version 0.9.4 released
================================= =================================
The Nimrod development community is proud to announce the release of version
0.9.4 of the Nimrod compiler and tools.
Bugfixes This release includes about 1300 changes in total including various bug
-------- fixes, new languages features and standard library additions and improvements.
This release brings with it support for user-defined type classes, a brand
new VM for executing Nimrod code at compile-time and new symbol binding
rules for clean templates.
It also introduces support for the brand new
`Babel package manager <https://github.com/nimrod-code/babel>`_ which
has itself seen its first release recently. Many of the wrappers that were
present in the standard library have been moved to separate repositories
and should now be installed using Babel.
Apart from that a new **experimental** Asynchronous IO API has been added via
the ``asyncdispatch`` and ``asyncnet`` modules. The ``net`` and ``rawsockets``
modules have also been added and they will likely replace the sockets
module in the next release. The Asynchronous IO API has been designed to
take advantage of Linux's epoll and Windows' IOCP APIs, support for BSD's
kqueue has not been implemented yet but will be in the future.
The Asynchronous IO API provides both
a callback interface and an interface which allows you to write code as you
would if you were writing synchronous code. The latter is done through
the use of an ``await`` keyword which behaves similar to C#'s await. The
following is a very simple chat server demonstrating Nimrod's new async
capabilities.
.. code-block::nimrod
import asyncnet, asyncdispatch
var clients: seq[PAsyncSocket] = @[]
proc processClient(client: PAsyncSocket) {.async.} =
while true:
let line = await client.recvLine()
for c in clients:
await c.send(line & "\c\L")
proc serve() {.async.} =
var server = newAsyncSocket()
server.bindAddr(TPort(12345))
server.listen()
while true:
let client = await server.accept()
clients.add client
processClient(client)
serve()
runForever()
Library Additions Library Additions
----------------- -----------------
- Added ``macros.genSym`` builtin for AST generation. - Added ``macros.genSym`` builtin for AST generation.
- Added ``macros.newLit`` procs for easier AST generation. - Added ``macros.newLit`` procs for easier AST generation.
- Added module ``logging``.
- Added module ``asyncdispatch``.
- Added module ``asyncnet``.
- Added module ``net``.
- Added module ``rawsockets``.
- Added module ``selectors``.
- Added module ``asynchttpserver``.
- Added support for the new asynchronous IO in the ``httpclient`` module.
Changes affecting backwards compatibility Changes affecting backwards compatibility
----------------------------------------- -----------------------------------------
@ -65,6 +119,7 @@ News
an object. an object.
- Arrays can be annotated to be ``unchecked`` for easier low level - Arrays can be annotated to be ``unchecked`` for easier low level
manipulations of memory. manipulations of memory.
- Support for the new Babel package manager.
Language Additions Language Additions

View file

@ -62,7 +62,8 @@ srcdoc2: "pure/ftpclient;pure/memfiles;pure/subexes;pure/collections/critbits"
srcdoc2: "pure/asyncio;pure/actors;core/locks;pure/oids;pure/endians;pure/uri" srcdoc2: "pure/asyncio;pure/actors;core/locks;pure/oids;pure/endians;pure/uri"
srcdoc2: "pure/nimprof;pure/unittest;packages/docutils/highlite" srcdoc2: "pure/nimprof;pure/unittest;packages/docutils/highlite"
srcdoc2: "packages/docutils/rst;packages/docutils/rstast" srcdoc2: "packages/docutils/rst;packages/docutils/rstast"
srcdoc2: "packages/docutils/rstgen;pure/logging" srcdoc2: "packages/docutils/rstgen;pure/logging;pure/asyncdispatch;pure/asyncnet"
srcdoc2: "pure/rawsockets;pure/asynchttpserver;pure/net"
webdoc: "wrappers/libcurl;pure/md5;wrappers/mysql;wrappers/iup" webdoc: "wrappers/libcurl;pure/md5;wrappers/mysql;wrappers/iup"
webdoc: "wrappers/sqlite3;wrappers/postgres;wrappers/tinyc" webdoc: "wrappers/sqlite3;wrappers/postgres;wrappers/tinyc"