[erlang-questions] Why isn't erlang strongly typed?

Dan Gudmundsson <>
Thu Oct 23 08:45:55 CEST 2008


Richard O'Keefe wrote:
> 
> On 22 Oct 2008, at 8:09 pm, Dan Gudmundsson wrote:
> 
>> There is a reason there is no mnesia:read/2 and it is that the third 
>> argument
>> is the lock type which forces you to think what kind of lock you want 
>> on that object,
>> there is no need for that on the dirty_* functions.
> 
> This argument would have force *IF* mnesia:read/1 didn't exist.
> But it does.  It is idle to claim that people are forced to
> think about what kind of lock they want when they can already
> write mnesia:read({Tab,Key}).
> 

Agree, but I think that was the motivation.
mnesia:read/1 was the original api function which was kept
when the 'new'* dirty_read/2 and read/3 was introduced.

So what do you want?

mnesia:read({Tab,key}, Lock) ->
   mnesia:read(Tab,Key,Lock);
or
mnesia:read(Tab,Key) ->
   mnesia:read(Tab,Key,read).
or both?

/Dan
* new means before 1997 :-)



More information about the erlang-questions mailing list