Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

IEEE 754 Representation

Name: Anonymous 2014-09-13 5:48

Is it okay to use lower bits for a type tag?

Name: Anonymous 2014-09-13 7:40

>>7
1. No it's not.
2. It's possible but it still doesn't mean class tags are type tags.

For example for the type

data Either a b = Left a | Right b

there might be a value

Left "testicle"

that has a tag but this tag does not specify its type. We know that it's a Either String b value but we can't tell the b from the tag. It's a classification tag and can of course be encoded various ways, but it's in no way a type tag.

Likewise you might have a type like

Numeric = I Int | D Double

and encode the class tags (I or D) in the lowest bits of its representation, but it still wouldn't make them type tags. There's no way to find out at runtime if the value D 2.71 has the type Numeric or maybe some other type

Asswipe = I Int | D Double | C Char Char Char Char Char Char

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List