On 07/26/2016 04:19 PM, Michael Van Canneyt wrote:

This is not correct. In pascal the right-hand side of an assignment has a well-defined type. The compiler checks whether the type on the right is assignment-compatible to the left side.

Hmm.

if you do

x := y + z;

with x a real and y and z integers, the type of x will not change to be an integer, but the value will be converted.


Now I understand that with strings the encoding is a kind of "sub-type" and hence (usually) static and not convertible to allow for the compiler do decide if a conversion is necessary.

This has been discussed a long time ago and the argument was that _fully_ dynamically typed strings are to costly regarding CPU demand.

I did not get to know that those design decision has been changed for the normal usage case (while there seems to be ways to sue certain kinds of strings in a fully dynamical way) .

Changing the encoding of the left side operand of ":=" would only be logical if the encoding is never an attribute to the string's type but always a dynamical attribute to the string's content.

-Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to