Op dinsdag 22 november 2016 15:55:25 UTC+1 schreef Rex van der Spuy:
>
> But, can anyone explain why Elm doesn't let us do this?
>

My impression is that it has to do with the enforced strong typing and type 
safety of elm.

A record is intended for key-value type info where each value could be of a 
different type.
And elm's greatness requires that elm always knows the type it is working 
on.
Dynamic typing for records (which javascript does allow for objects) would 
break this guarantee.

So with a record, you get the flexibility that each field could be whatever 
type, but you lose the dynamicness (is that even a word?) of the keys.
With Dict, it is the other way around. You can get a value by supplying a 
dynamic key, but all values in the Dict must be of the same type.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to