Re: Still on David's issues; SRFI 44

2005-08-17 Thread David Van Horn

Panu Kalliokoski wrote:

Whether SRFI 69 should be about general mappings or hash tables, has
been IMO adequately addressed; if there are suggestions about how to
make it clearer in the abstract that it _is_ about hash tables, they are
welcome.


In light of your comments, I agree with you Panu.  This is not just a mapping 
datastructure.  If my comments seemed off-base it is only because I am 
confused as to what the precise purpose of this SRFI is.  Without knowing the 
precise purpose, I cannot make concrete suggestions on the document.  Your 
response clarifies some, and I appreciate your patience and work.  My 
suggestions are below.  I have no intentions of being insulting.


I have the following suggestions for the abstract and rationale.  If you 
comment on these I can provide concrete suggestions for the rest of the 
document.  I have tried to characterize the purpose of this SRFI as making it 
possible to write portable code that uses hash tables in the most common ways 
while remaining efficient.  Do you agree with that characterization?


I think the simple and generic aim should be dropped.  The design of this SRFI 
should be simple and generic only so far as it furthers the above aim.


---8<---

Abstract

;; outline the need for, and design of, the proposal.

Hash tables are mutable data structures meeting certain complexity 
requirements that provide a mapping from some set of keys to some set of 
values associated to those keys.  When a good hash function is used, key 
lookup and destructive update must be performed in amortised constant time.


Widely recognised as a fundamental data structure, most Scheme systems provide 
their functionality.  However, no Scheme standard exists for hash tables and 
the functionality and interfaces provided by implementations varies widely, 
making it difficult to write portable programs that use hash tables.


This SRFI specifies an API for hash tables designed so that portable programs 
can be written which make efficient use of common hash table functionality.



Rationale

;; explain why the proposal should be incorporated as a standard feature in
;; Scheme implementations. If there are other standards which this proposal
;; will replace or with which it will compete, the rationale should explain
;; why the present proposal is a substantial improvement.

Hash tables are widely recognised as a fundamental data structure for many 
kinds of computational tasks.  Almost every non-minimal Scheme implementation 
provides some kind of hash table functionality, although there is no existing 
standard.


Alas, although somewhat similar, these hash table APIs have many differences: 
some trivial, like the naming of certain functions; some complex, like 
revealing different aspects of the internal implementation to the user; some 
coarse, like requiring keys to be of some specific type(s); some subtle, like 
requiring the user to guess the size of the hash table in advance to get 
optimal performance.  As a result, it is difficult to write portable programs 
that use hash tables.


The primary aim of this SRFI is to establish a standard API for hash tables so 
that portable programs can be written which make efficient use of common hash 
table functionality.  The API resolves the discrepancies between the various 
names and semantics for hash table operations provided by Scheme systems by 
standardizing the names and behaviors of the most common operations. 
Incorporating this SRFI as a standard feature of Scheme implementations makes 
it possible to write efficient and portable programs that use hash tables.


---8<---

Suggestions on the text given the aim of making it so that portable programs 
can be written which make efficient use of common hash table functionality:


There are several things in the document that *may* lead to more efficient use 
depending on the implementation.  I believe all of these should be dropped, 
leaving specified only those things which *must* lead to efficient use in all 
conforming implementations.  Specifically:


Drop size-hint.  Size-hint may be ignored as currently specified, thus its 
status as an optional argument to hash table constructors does nothing to make 
efficient use of hash tables portable.  Allow implementations to extend the 
parameters arbitrarily to make implementation specific improvements.


Drop type specific hash tables.  If they are simply shorthands as stated, they 
do nothing to make efficient use of hash tables portable.


If you'd like to suggest how particular implementations can improve 
efficiency, you could add the following:  Implementations may improve 
efficiency by specializing the hash table implementation when given the 
equivalence procedure =, string=?...


I don't see any reason to complicate the API, in what I would say is an ad-hoc 
manner, for non-portable gains in potential efficiency.


If you decide not to do this, you should add a rationale for including type 
specific hash tabl

Re: Still on David's issues; SRFI 44

2005-08-17 Thread bear


On Wed, 17 Aug 2005, Panu Kalliokoski wrote:

>On Tue, Aug 16, 2005 at 06:45:57PM -0700, bear wrote:

>> SRFI-44 is, plainly and simply, a Bad Idea.

> However, it seems to me that the SRFI way of disagreeing is to write a
> new SRFI to replace the former one.  Would you consider doing that?
> (And would it have any content besides "don't"?)

H.  Actually, yes I would consider doing that, and yes it
would have content beyond "don't."

A proper collections SRFI would provide a place to hang every
operation that could be implemented more efficiently on some
collection types, thus preventing abjectly stupid formulations
of those operations out of "universal primitives" that might
be horribly inefficient on a given collection.

It would also provide a simple, portable way to register a new
user-written collection with the interface so that "generic"
functions could thereafter be used with it.

Bear



Re: Still on David's issues; SRFI 44

2005-08-16 Thread Panu Kalliokoski
On Tue, Aug 16, 2005 at 06:45:57PM -0700, bear wrote:
> SRFI-44 is, plainly and simply, a Bad Idea.  Abstraction over
> collection types invites the misuse, or grossly inefficient
> use, of those collection types by inviting people to consider
> them interchangeable when, in effective use, they are not.  To

Actually these approaches (concrete+efficient and abstract+inefficient)
can be easily reconciled by first defining the concrete datatypes and
then collecting (pun?) them under an abstraction layer.  And if what you
state was the only problem with SRFI 44, it would be quite in line with
a language where even strings don't guarantee their most effective usage
patterns :)

The idea for SRFI 44 was probably taken from Common Lisp, the users of
which can undoubtedly tell a lot about its merits...

> I could go on about other reasons why SRFI-44 is a Bad Idea;
> but why?

Well, if I have to write some kind of rationale about why SRFI 44 is
ignored, I would be well advised to write something more elaborate :)
That said, I think SRFI 44 has already taken more than its share of
bashing.

However, it seems to me that the SRFI way of disagreeing is to write a
new SRFI to replace the former one.  Would you consider doing that?
(And would it have any content besides "don't"?)

Panu

-- 
personal contact: [EMAIL PROTECTED], +35841 5323835, +3589 85619369
work contact: [EMAIL PROTECTED], +35850 3678003
kotisivu (henkkoht):http://www.iki.fi/atehwa/
homepage (technical):   http://sange.fi/~atehwa/



Re: Still on David's issues; SRFI 44

2005-08-16 Thread bear


On Sun, 14 Aug 2005, Panu Kalliokoski wrote:

> What I haven't been adequately addressing is the neglection of SRFI 44.
> This is mainly because I have no motivation for criticising an
> already-finalised SRFI; I was hoping I could just go ahead and work this
> SRFI to be good, unhindered by SRFI 44.  It's possible that some other
> people feel the same way, I don't know.

SRFI-44 is, plainly and simply, a Bad Idea.  Abstraction over
collection types invites the misuse, or grossly inefficient
use, of those collection types by inviting people to consider
them interchangeable when, in effective use, they are not.  To
collection and SRFI authors, I recommend not complying with it;
to implementors, I recommend never implementing it.

I could go on about other reasons why SRFI-44 is a Bad Idea;
but why?

Bear