[Issue 2666] New: forward reference hell!
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 14 17:14:03 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2666
Summary: forward reference hell!
Product: D
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P1
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: someanon at yahoo.com
$ cat vector.d #-----------------------------------------------------
module vector;
class Vector(E) {
E[] data;
}
$ cat student.d #-----------------------------------------------------
module student;
import vector;
import teacher;
// define Student
class Student {
void ask(Teacher teacher) {
}
}
// define Students
alias Vector!(Student) Students;
$ cat teacher.d #-----------------------------------------------------
module teacher;
import student;
class Teacher {
Students students;
}
===============================================
$ dmd -c student.d
teacher.d(6): Error: forward reference to 'Vector!(Student)'
teacher.d(6): Error: Students is used as a type
teacher.d(6): variable teacher.Teacher.students voids have no value
===============================================
sure I know if I do:
$ dmd -c vector.d teacher.d student.d
all the three files can be compiled without error.
But my question is: why can't file be individually compiled?
I think I have the most natural/logical organization of files; if you move the
'Students' alias around, it could get compiled, but what's wrong with my
current organization?
--
More information about the Digitalmars-d-bugs
mailing list