Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37784
| Path | csiph.com!news.bbs.geek.nz!.POSTED.agency.bbs.geek.nz!not-for-mail |
|---|---|
| From | ram@zedat.fu-berlin.de (Stefan Ram) (Stefan Ram) |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Two exceptions |
| Date | Sat, 09 Dec 2017 16:15:06 +1200 |
| Organization | fsxNet Usenet Gateway | bbs.geek.nz/#fsxNet |
| Message-ID | <3577663232@f38.n261.z1.binkp.net> (permalink) |
| References | <4199194256@f38.n261.z1.binkp.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | news.bbs.geek.nz; posting-host="M6YmRdZYyc42DJk0lNlt/X4dpP4dzvceBNabSmESN3E"; logging-data="10956"; mail-complaints-to="abuse@news.bbs.geek.nz" |
| User-Agent | VSoup v1.2.9.47Beta [95/NT] |
| X-MailConverter | SoupGate-Win32 v1.05 |
| X-Comment-To | Victor Porton |
| Xref | csiph.com comp.lang.java.programmer:37784 |
Show key headers only | View raw
Victor Porton <porton@narod.ru> writes:
>So I have two alternatives:
>1. Derive ParseException from FatalParseException what seems to do the right
>thing but seems illogical.
The type of a result of a parse is
class ParseResult { ...
which can have subclasses
class ProperParseResult extends ParseResult { ... class ErrorParseResult
extends ParseResult { ...
which in turn can have several subclasses each of which
might implement several interfaces.
A parseResult might contain other parseResults (AST).
But without knowing more details of the problem, it is
difficult to suggest further details.
>An object X may be either X1 or X2 or X3 class.
When X is not X1, of course, this is neither an error
nor a reason to throw.
(Check whether you might use the anti-pattern "switch on
(sub)type [i.e., X1, X2, X3]" whose use should be replaced
by polymorphism.)
Traversing given nested objects is not called "parsing"
(which is working on a sequence of tokens), it is more like
a tree travesal, which might suggest to check out the
visitor pattern.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Two exceptions Victor Porton <porton@narod.ru> (Victor Porton) - 2017-12-09 00:53 +1200
Re: Two exceptions Eric Sosman <esosman@comcast-dot-net.invalid> (Eric Sosman) - 2017-12-08 18:21 +1200
Re: Two exceptions Victor Porton <porton@narod.ru> (Victor Porton) - 2017-12-09 01:55 +1200
Re: Two exceptions Eric Sosman <esosman@comcast-dot-net.invalid> (Eric Sosman) - 2017-12-09 07:39 +1200
Re: Two exceptions Victor Porton <porton@narod.ru> (Victor Porton) - 2017-12-10 02:39 +1200
Re: Two exceptions Victor Porton <porton@narod.ru> (Victor Porton) - 2017-12-10 02:46 +1200
Re: Two exceptions Kiwi User <martin@mydomain.invalid> (Kiwi User) - 2017-12-10 00:52 +1200
Re: Two exceptions Kiwi User <martin@mydomain.invalid> - 2017-12-10 21:50 +0000
Re: Two exceptions Patrick Roemer <sangamon@netcologne.de> (Patrick Roemer) - 2017-12-09 13:47 +1200
Re: Two exceptions Arne Vajhøj <arne@vajhoej.dk> (Arne Vajhøj) - 2017-12-08 18:49 +1200
Re: Two exceptions v_borchert@despammed.com (Volker Borchert) (Volker Borchert) - 2017-12-09 07:53 +1200
Re: Two exceptions ram@zedat.fu-berlin.de (Stefan Ram) (Stefan Ram) - 2017-12-09 16:15 +1200
Re: Two exceptions Eric Sosman <esosman@comcast-dot-net.invalid> (Eric Sosman) - 2017-12-09 14:55 +1200
Re: Two exceptions Patrick Roemer <sangamon@netcologne.de> (Patrick Roemer) - 2017-12-11 15:09 +1200
Re: Two exceptions Victor Porton <porton@narod.ru> - 2017-12-12 11:14 +0200
csiph-web