How Nested Functions Work, part 1
Michiel Helvensteijn
m.helvensteijn.remove at gmail.com
Wed Sep 2 11:39:22 PDT 2009
Rainer Deyke wrote:
>> I still find it silly that it was built that way. Seems to me you should
>> be able to forward-reference *any* symbol that has a value that can't
>> change over its lifetime. Functions, const/immutable vars, typedefs,
>> classes, etc.
>
> That can lead to subtle problems in the case of functions:
>
> int i = f();
> int f() { return i; }
You're right, I forgot about that. You can conservatively statically forbid
this. But I admit it makes the 'constant data should obviously be
forward-referenceable' thing less convincing. :-)
--
Michiel Helvensteijn
More information about the Digitalmars-d
mailing list