Hi
I have not been paying attention to what is going on in the erlware
world for a long time so I am probably missing a lot of background for
this, but I an not going to let that stop me.

Isn't this just another implementation of a dictionary?
Aren't there enough of those in stdlib?
How is this better?

At least use the same functions names as in the dict API for similar
functions.

Is the set() type in the specs the same as stdlib:set() or are You
defining Your own.

I am not that happy with the name map. Since it seems to be the
same thing as what is normally called dictionaries in Erlang I
think it would be better to use that. Or relation since that is what it
is in a mathematical sense.
Also map is, at least for me, to to closely coupled to the higher order
function. I suspect that before the week is over You are going to add
the function map/2 and that will just look silly map:map(Fun,Map).

See more inline below.

/Anders

On Mon, Mar 14, 2011 at 5:23 PM, Eric Merritt <[email protected]> wrote:
> I am working on a set of extensable types for Erlang using behaviours
> and Paramaterized modules (feel free to ask why paramaterized
> modules) for erlware_commons. In doing this I realized that the API is
> going to be very important, since it will serve as the basis for many
> other types. To that end I decided to put the API out for comment. I
> will do this as a set of specs and docs.
>
> -opaque map(_KeyT, _ValueT) :: term().
>
> %% @doc empties the map.
> -spec clear() -> map().
>

Shouldn't this be
-spec new() -> map() instead?
Or is this really a mutable datatype?
In which case I suppose it should be
-spec clear(map()) -> map()
Or is it just me not understanding parameterized modules?

> %% @doc returns a boolean indicating if this map has the specified key
> -spec has(term()) -> boolean().

Should be has_key

>
> %% @doc check to see if the specified value exists in the map
> -spec has_value(Term()) -> boolean().
>
> %% @doc return the key value pairs as a set of {key, value} pairs
> -spec as_set() -> set().
>
> %% @doc get the item from the may
> -spec get(term()) -> term().
>
define types
key() = term()
value() = term()
-spec get(key()) -> value().

> %% @doc return all keys in the map as a set
> -spec keys(term()) -> set().

What is the parameter here?

>
> %% @doc Add a value to the map
> -spec put(term(), term()) -> map().

-spec add(term(), term()) -> map().
To match remove

>
> %% @doc remove a value from the map
> -spec remove(term()) -> map().
>
> %% @doc get the current number of key value pairs in the map
> -spec size() -> number().

integer() instead of number()

>
> %% @doc get all the values in the map as a sequence
> -spec values() -> sequence().
>
> As you can tell from the specs I am going to define sets and sequences
> very quickly as well.
>
> --
> Eric Merritt
> Erlang & OTP in Action (Manning) http://manning.com/logan
> http://twitter.com/ericbmerritt
> http://erlware.org
>
> --
> You received this message because you are subscribed to the Google Groups 
> "erlware-dev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/erlware-dev?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"erlware-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/erlware-dev?hl=en.

Reply via email to