Polysemous Values Qustion

Don Clugston dac at nospam.com.au
Tue Sep 25 23:55:55 PDT 2007


Janice Caron wrote:
> In another thread, Christopher Wright said that polysemous meant "A
> variable that can have several types depending on how it is assigned
> or casted is polysemous. Walter wants to use this especially for
> string literals -- should it be fixed length or not, should it be
> char, wchar,
> dchar?"
> 
> And then Don Clugston said "For example, the literal number 1. Could
> be a short, int, uint, float, complex number,..."
> 
> Both of those examples are LITERALS. I get that. Literal can be
> interpreted as either one type or another. It makes sense that you'd
> want to delay nailing down the decision until you really have to.
> 
> But CW said: "A /variable/..." (my emphasis). Can you have a
> polysemous variable (as opposed to literal)? I don't get how that
> would work.

AFAIK, it only applies to rvalues (which is a bit broader than simply literals).



More information about the Digitalmars-d mailing list