[erlang-questions] Built-in type var(_)

Tony Hannan tonyhannan2@REDACTED
Sun Nov 7 01:16:59 CET 2010


Thanks, but I more interested in the built-in type var that I am conflicting
with. Where is it? How do I use it?

Thanks,
Tony

On Sat, Nov 6, 2010 at 9:05 PM, Kostis Sagonas <kostis@REDACTED> wrote:

> Tony Hannan wrote:
>
>> Hello,
>>
>> I was writing an MVar module (a' la Haskell) and defining the type
>>
>>    -type var(A) :: {var, pid(), A}.
>>    % initial value kept in reference for type only, current value held in
>> process
>>
>> But the compiler complained that
>>
>>    "type var(_) is a builtin type; it cannot be redefined"
>>
>> I don't see this built-in var mentioned in any of the documentation and
>> Google didn't find it either. So where is this var type defined and can I
>> use it instead of creating my own var type.
>>
>
> The underlying type representation needs to have a way of representing type
> variables (the A in your declaration) and it so happens that it has chosen
> something involving var/1.  I guess you are unlucky.
>
> Simply choose some other name like mvar(A), myvar(A), my_var(A), ...
>
> But you are right that this should probably be mentioned somewhere.
>
> Kostis
>


More information about the erlang-questions mailing list