gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Re: [OT] Java is fun!


From: Momchil Velikov
Subject: Re: [Gnu-arch-users] Re: [OT] Java is fun!
Date: 23 Oct 2003 10:10:53 +0300
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Tom" == Tom Lord <address@hidden> writes:

Tom> To briefly reiterate, the above code is compiled at a time or location
Tom> where:

Tom>    Reader.getLinesOfFiles
Tom>            is declared with:

Tom>            throws IOException;

Tom> and

Tom>    Parser.parseLines
Tom>            is declared with:

Tom>            throws ParserException;


Tom> and it seems (according to _your_ claims (among others) about the
Tom> meaning of throws declarations) that the author of a code snippet such
Tom> as the above can reasonably assume:


Tom>    the body of 'catch (IOException e)'
Tom>            is reached because an exception is thrown from
Tom>                 Reader.getLinesOfFiles

Tom>    the body of 'catch (ParserException e)'
Tom>            is reached because an exception is thrown from
Tom>                 Parser.parseLines

Tom> Yet the language specs prove that such an assumption is _false_ unless
Tom> I (externally to Java) ensure that the code snippet is linked with the
Tom> same versions of Reader and Parser it was compiled against.  Do you
Tom> claim I have misundersood the spec?  If so, how?

This is relevant to probably _any_ language, in particular C:

Consider changing [1]

        struct dirent *readdir(DIR *dir);

to

        int readdir (DIR *DIRSTREAM, struct dirent *ENTRY,
                     struct dirent **RESULT);

and linking an executable compiled against the first declaration to a
library compiled against the second one.

~velco

[1] (apparently someone didn't think about backward compatibility (or
deliberately wanted to break programs, so they are "fixed" :), just
like in your Java example)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]