[mercury-users] Tagged datatypes and boxing

Lee Naish lee at cs.mu.OZ.AU
Fri Sep 24 16:40:35 AEST 1999


In message <199909232321.LAA04010 at hermes.otago.ac.nz>Richard wrote:
>To continue, why the h--l should we humans be forced to count bits?

C programmers know the cost of everything but the value of nothing.

Haskell programmers know the value of everything but the cost of nothing.

The value (what you are representing) is always important but sometimes the
cost (how it is represented) can be important to know as well.  Subranges
and assertions give the compiler an opportunity to use a better
representation (though it might not).  Counting bits tends to distract
programmers from the more abstract view and being constantly reminded of
implementation by special types, pointers, assignments and the like is
generally bad news.  Another possibility is to allow some kinds of "pragma"
to suggest to the compiler how a type is best represented.  eg:

type color = <integer range/RGB triple/...> pragma packed.

	lee
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list