[plt-scheme] likely -> incompatibility: hashtables

From: Jos Koot (jos.koot at telefonica.net)
Date: Mon Apr 7 18:46:11 EDT 2008

The constant time functional update seems a good idea to me. The idea of a 
property for creating new kinds of tables sounds interesting.
With respect to the names: Scheme is a verbose language in comparison to 
some other ones. Some abbreviations seem allright to me provided this is not 
the start of an evolution to a caricatural non-verbose language such as APL. 
I read (and write) a whole page of Scheme faster than a single line of APL.

----- Original Message ----- 
From: "Matthew Flatt" <mflatt at cs.utah.edu>
To: <plt-scheme at list.cs.brown.edu>
Sent: Monday, April 07, 2008 11:31 PM
Subject: [plt-scheme] likely -> incompatibility: 

> While we're cleaning up the language in v4, we'd like to do something
> about the API for using hash tables:
> * The names `hash-table-get' and `hash-table-put!' are long enough to
>   be annoying.
> * The names don't follow the usual `-ref' and `-set!' covention. (I
>   always have trouble remembering that it's `hash-table-put!', not
>   `hash-table-set!'.)
> * We'd like more things to have the same API, such as a dictionary
>   that provides constant-time functional update.
> Here's the current plan to deal with those problems:
> * Change `hash-table-get' to `table-ref'.
> * Change hash-table-put!' to `table-set!'.
> * Change "hash-table" in most other function names to just "table":
>   `hash-table-count' -> `table-count'.
> * Add some property for creating new kinds of tables. The property
>   value supplies an implementation for `table-ref', etc.
> * Leave the name `make-hash-table' and `make-immutable-hash-table' as
>   they are, on the grounds that they create a specific kind of table.
>   Also leave the `#hash' and `#hasheq' notations alone. Keep
>   `hash-table?', but also add `table?'.
> * Add `hash-table-set' (no "!"), which takes an table and functionally
>   produces an extended one. Immutable hash tables would support this
>   operation, and mutables one wouldn't. Note that `#hash()' and
>   `#hasheq()' become useful base cases for inductively building up a
>   table with `hash-table-set'.
> * Add `table-remove', the functional complement of `table-remove!'.
> * Add `for/table', which builds an immutable hash table.
> Since lots of `hash-table-...' functions change names in `scheme/base',
> this will break lots of v3.99 code. (Of course, the `mzscheme' module
> would export the old names.) We'd also have to pick a new name for the
> `table' datatype in Scribble, and no doubt in other places.
> It's a late in the v3.99 series to make changes like this, but tables
> seem important enough to do it anyway --- and important enough to favor
> this change over hundreds of other potential improvements that won't
> happen in v4.
> This plan is tentative, but it will happen very soon if we don't
> discover serious problems with it.
> Matthew
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme 

Posted on the users mailing list.