[m-rev.] for review: Fix abstract equivalence types.

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Aug 23 16:59:47 AEST 2017

On Wed, 23 Aug 2017 08:27:49 +0200, Dirk Ziegemeyer <dirk at ziegemeyer.de> wrote:

> What ist the reason for not using
> :- type var(T) == int.
> instead?
> I suppose that the compiler won’t recognise if we accidentally mix up two types which are both equivalent to int.

As Mark said, you answered your own question.

> Would „:- type var(T) == int.“ have advantages over the current definition? E.g. regarding memory consumption or unification speed.


The current definition of var is what we call a "notag" type; a type that has
exactly one function symbol, which has exactly one argument. The type
checker treats such types differently from the argument's type (in this case,
it won't allow the unification of a variable with an integer, unless of course
the integer is wrapped in the var() function symbol), but the code generator
generates the same code for notag types as for the argument type.
Therefore the wrapper has no impact whatsoever on either memory
consumption or execution time.


More information about the reviews mailing list