Is it bad for object.di to depend on core.exception?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Mar 7 20:10:46 PST 2012


On Wed, Mar 07, 2012 at 08:06:55PM -0800, Sean Kelly wrote:
> On Mar 3, 2012, at 6:45 PM, H. S. Teoh wrote:
> 
> > So I'm still working on fixing issue 5030, which *should* have been a
> > trivial fix. But I'm running into a bunch of circumstantial problems,
> > among which is this new method in AssociativeArray(Key,Value):
> > 
> >    Value opIndex(Key key, string file=__FILE__, size_t line=__LINE__)
> >    {
> >    	auto p = key in *cast(Value[Key]*)(&p);
> > 	if (p) return *p;
> > 	throw new RangeError(file, line);
> >    }
> > 
> > Originally it was simply Value opIndex(Key key) without any range check,
> > which is probably a bad idea, so I added the throw RangeError in there.
> > 
> > However, this introduces a dependency from object.di to core.exception.
> 
> Have the function above call something like:
> 
> Value opIndex(…) {
>>     throw _d_newRangeError(file, line);
> }
> 
> Throwable _d_newRangeError(string, size_t); // defined in object_d (not .di).

Good idea, I'll do that. Thanks!


T

-- 
They pretend to pay us, and we pretend to work. -- Russian saying


More information about the Digitalmars-d mailing list