...inline...

> You can only set the primary entity (the one you pass in to 
> parse) via an
> input source.

Right - thats what I understood.

 
> The thing is that the URL class is an OO class and is general 
> purpose and
> should use exceptions to report errors.

Whoa there! -- I take serious issue with the statement that- "Its an OO
Class...and should use exceptions".  The C++ spec and programming compuity
at large has recognized that exception handling is NOT designed for
anticipated flow control but instead for truly "exceptional conditions".
The fact that the URI class explicitly ecpects path names and throws an
exception in this case is, I believe, something that could be fixed up a
bit.  I think the root cause is excessive work done in the constuctor.  This
makes you _need_ to throw an exception for convenient signalling to consumer
code - not because you encountered an "exceptional situation".

>  What is needed is not 
> to hack up the
> URL class and make it less desirable, but to provide external 
> optimizations
> that prevent it from being used such that it would create 
> exceptions unless
> they are for real.

I think "hacking up the URL class" is exacly what is needed - move the work
done in the constuctor that "requires" the exception and move usage to the
public methods that the constuctor delegates to anyway.  

> A bit of probing could quickly determine the correct thing 
> most of the time.
> For instance, if it starts with a '.', then its relative 
> which means its of
> the type of its parent, which is known. That would handle 
> many of the cases,
> since the parser could then internally use the correct type 
> of input source
> and avoid this issue. If it starts with http or ftp, then its 
> its a URL. If
> it starts with x: or / then its a local file.

I like this idea!   Perhaps delegate to an InputSaurseFactory that could
perform the probing and factory out different concrete instances of an
abstract InputSource?  Kinda puts a lot of parsing logic in the Factory
class but... 

Basically I'd just like to cleanup the runtime of my application.  Like I
said before we are throwing a dozen exceptions per parse, and I'm sure
that's killing performance as well.  

Jim


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to