[plt-scheme] make-object return value

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 17 14:17:45 EST 2003

At Mon, 17 Mar 2003 11:02:42 -0800 (PST), Ron Stanonik wrote:
> Is it possible for class instantiation to return something other
> than an instance?  Say, #f, to indicate that an error occurred?

No.

> I'm creating a class that will extract information from pdf's.
> (A jpeg of the first page, jpegs of the images in the document,
> author, title, creation date, if available.)
> 
>   (define a (make-object pdf% "/tmp/a.pdf"))
> 
> If the user passes a file which isn't a pdf, then I could raise
> an exception, but if make-object just returned #f, that would be
> sufficient.

You'll have to raise an exception, I think.

Matthew



Posted on the users mailing list.