[Prev][Next][Index][Thread]
RE: Interpreting error messages in Functional Developer
David,
> Anyone know if Functional Developer has a document that describes
> error messages in greater detail? I am getting the following from
> FunDev when I try a very simple program:
>
> Dylan error: attempt to call subclass? on an incompletely initialized
> class <my-sample>.
Top-level forms within a library are initialized in file order and
top to bottom within a file. If an error refers to an "incompletely
initialized class" it typically means you've tried to do something
with that class that requires knowledge of its slots or superclasses,
and have done so before the class's definition has been "run".
In the case of your example, it looks like there's a top-level call
to main() before the definition of <my-sample> gets a chance to run
(assuming datamodel.dylan is listed after dylansample.dylan in
the project), so an error results when you attempt to make(<my-sample>).
Try moving the kick-off call to main() such that it's the
last expression in the last file of the project.
FWIW, I'm a little surprised main() compiles if, as presented,
it's missing terminating semicolons after the let and the assignment!
-- Keith
> Below is a little bit of the code for context. I am sure that it
> is something simple but the error doesn't tell me much in this case.
>
> // -- Start example --
>
> // The following is defined in dylansample.dylan:
> Module: dylansample
>
> define method main() => ()
> let sample-instance = make(<my-sample>)
> sample-instance.value := 7
> format-out("value is %d\n", sample-instance.value);
> end method main;
>
> begin
> main();
> end
>
> // The following is defined in datamodel.dylan
> Module: dylansample
>
> define class <my-sample> ( <object> )
> slot value :: <integer>, init-value: 0;
> end class <my-sample>;
>
> // -- End example --
>
> I suspect it has something to do with these definitions being
> in two different files. If I combine them into one file, making
> the instance seems to work but the "format-out" call fails to
> run with an access violation.
Follow-Ups:
References: