Re: type-inquiry
Waldek Hebisch <[email protected]> Sun, 22 Jan 2017 17:09:05 +0100 (CET)
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
Paul Isaacs wrote:
>
> How is the production type-inquiry used?
>
> var
> p : integer;
>
> type
> q = type of p;
>
> How would it be possible that inquiring as to the type of p is useful?
> Under what circumstances would the type of p not be already known?
>
> Even if the type of p were not known, how would q be usable if its type
> were not fixed?
It seems that if you want you can replace type-inquiry by explicit
definition. However, type-inquiry may be preferable:
- for several purposes it does not matter which type you use,
it matters that types are the same. The simplest case is
swaping variables: you need temporary of the same type.
- type-inquiry may be useful if you generate program via
textual maniputation. Then "the same" program fragment
may be better reusable, in a sense adapting to types
from outside.
In other words, it looks like feature supporting specific
style, if you do not like this style do not use it.
--
Waldek Hebisch
_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc