[erlang-questions] Maps

Chris King colanderman@REDACTED
Wed May 15 16:27:43 CEST 2013


On Wed, 15 May 2013 04:20:20 -0400, Jesper Louis Andersen  
<jesper.louis.andersen@REDACTED> wrote:

>
> On May 14, 2013, at 7:37 PM, Chris King <colanderman@REDACTED> wrote:
>
>> Static structure does not preclude subtyping.  OCaml's functional
>> objects capture this notion perfectly -- an object has a set of
>> methods which are known at compile time (hence static).  However any
>> given function need only be aware of the presence of the subset of
>> methods in which it is interested.  Note that this does not preclude a
>> function from creating a copy of said object with only those methods
>> modified!
>
> This is often called "structural subtyping" in contrast to "nominal  
> subtyping". The difference is that the structural variant is implicit  
> whereas the nominal variant is explicit. You have to explicitly define  
> the relationsship in the nominal case, which is common in Java, C++, …
>
> Google Go is another language with structural subtyping in its interface  
> model. There is also some structurality in the Standard ML module system  
> w.r.t. signature checks.

Yes, I know.


> I agree we need something which is better than records at some point,  
> with static guarantee of the contents. But currently, the thing we are  
> missing is a fast map implementation which is functional, so we can  
> avoid ETS tables for purposes they aren't designed for.

I understand that.  But why must (a) this new fast map implementation have  
an associated syntax, and (b) this syntax displace the syntax which *is*  
needed to implement pattern-matching of frames?

If anything you can get an *even faster* map implementation if you ignore  
the use case of extensible records.



More information about the erlang-questions mailing list