Thread overview
[phobos] Throwing Object
Jan 05, 2010
Sean Kelly
Jan 06, 2010
Walter Bright
Jan 06, 2010
Brad Roberts
Jan 06, 2010
Walter Bright
Jan 06, 2010
Sean Kelly
January 05, 2010
In a prior discussion with Andrei we agreed that in instances where there are multiple in-flight exceptions, the exceptions would all be chained via the .next property and passed up the stack together.  I just started implementing some of the code for this and have run into a snag: it's possible to throw instances of Object, and Object doesn't have a .next field.  I've toyed with some rather complex rules for resolving this, but the real problem is that Object instances can be thrown at all.  May I assume that the user should only ever throw Exceptions (ie. children of Error or Exception) and have some straightforward way for handling the Object case, be it ignore the Object, wrap it in an ObjectWrapperException, or something like that?
January 05, 2010
Sounds good to me.

Sean Kelly wrote:
> In a prior discussion with Andrei we agreed that in instances where there are multiple in-flight exceptions, the exceptions would all be chained via the .next property and passed up the stack together.  I just started implementing some of the code for this and have run into a snag: it's possible to throw instances of Object, and Object doesn't have a .next field.  I've toyed with some rather complex rules for resolving this, but the real problem is that Object instances can be thrown at all.  May I assume that the user should only ever throw Exceptions (ie. children of Error or Exception) and have some straightforward way for handling the Object case, be it ignore the Object, wrap it in an ObjectWrapperException, or something like that?
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
>
> 
January 05, 2010
At one point the plan was to restrict throw to only allowing subclasses of Exception, so the problem is defined out of existance.

On Tue, 5 Jan 2010, Walter Bright wrote:

> Date: Tue, 05 Jan 2010 17:46:16 -0800
> From: Walter Bright <walter at digitalmars.com>
> Reply-To: Discuss the phobos library for D <phobos at puremagic.com>
> To: Discuss the phobos library for D <phobos at puremagic.com>
> Subject: Re: [phobos] Throwing Object
> 
> Sounds good to me.
> 
> Sean Kelly wrote:
> > In a prior discussion with Andrei we agreed that in instances where there
> > are multiple in-flight exceptions, the exceptions would all be chained via
> > the .next property and passed up the stack together.  I just started
> > implementing some of the code for this and have run into a snag: it's
> > possible to throw instances of Object, and Object doesn't have a .next
> > field.  I've toyed with some rather complex rules for resolving this, but
> > the real problem is that Object instances can be thrown at all.  May I
> > assume that the user should only ever throw Exceptions (ie. children of
> > Error or Exception) and have some straightforward way for handling the
> > Object case, be it ignore the Object, wrap it in an ObjectWrapperException,
> > or something like that?
> > _______________________________________________
> > phobos mailing list
> > phobos at puremagic.com
> > http://lists.puremagic.com/mailman/listinfo/phobos
> > 
> > 
> > 
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
> 
January 05, 2010
Could we simply disallow statically throwing Object? That would be the ideal solution. Looks like we're all in agreement. Walter, do you want me to bugzillize this request?

Andrei

Sean Kelly wrote:
> In a prior discussion with Andrei we agreed that in instances where there are multiple in-flight exceptions, the exceptions would all be chained via the .next property and passed up the stack together.  I just started implementing some of the code for this and have run into a snag: it's possible to throw instances of Object, and Object doesn't have a .next field.  I've toyed with some rather complex rules for resolving this, but the real problem is that Object instances can be thrown at all.  May I assume that the user should only ever throw Exceptions (ie. children of Error or Exception) and have some straightforward way for handling the Object case, be it ignore the Object, wrap it in an ObjectWrapperException, or something like that?
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
January 05, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3678

Andrei Alexandrescu wrote:
> Could we simply disallow statically throwing Object? That would be the ideal solution. Looks like we're all in agreement. Walter, do you want me to bugzillize this request?
>
> Andrei
>
> Sean Kelly wrote:
>> In a prior discussion with Andrei we agreed that in instances where
>> there are multiple in-flight exceptions, the exceptions would all be
>> chained via the .next property and passed up the stack together.  I
>> just started implementing some of the code for this and have run into
>> a snag: it's possible to throw instances of Object, and Object
>> doesn't have a .next field.  I've toyed with some rather complex
>> rules for resolving this, but the real problem is that Object
>> instances can be thrown at all.  May I assume that the user should
>> only ever throw Exceptions (ie. children of Error or Exception) and
>> have some straightforward way for handling the Object case, be it
>> ignore the Object, wrap it in an ObjectWrapperException, or something
>> like that?
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
>
January 06, 2010
For what it's worth, I'm still planning to remove Throwable and have Exception derive from Error, as per TDPL.  If anyone thinks Throwable should remain as the base class for all throwable objects, please say so :-)

On Jan 5, 2010, at 6:34 PM, Andrei Alexandrescu wrote:

> Could we simply disallow statically throwing Object? That would be the ideal solution. Looks like we're all in agreement. Walter, do you want me to bugzillize this request?
> 
> Andrei
> 
> Sean Kelly wrote:
>> In a prior discussion with Andrei we agreed that in instances where there are multiple in-flight exceptions, the exceptions would all be chained via the .next property and passed up the stack together.  I just started implementing some of the code for this and have run into a snag: it's possible to throw instances of Object, and Object doesn't have a .next field.  I've toyed with some rather complex rules for resolving this, but the real problem is that Object instances can be thrown at all.  May I assume that the user should only ever throw Exceptions (ie. children of Error or Exception) and have some straightforward way for handling the Object case, be it ignore the Object, wrap it in an ObjectWrapperException, or something like that?
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

January 06, 2010
Perfect, thanks.

Andrei

Walter Bright wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=3678
> 
> Andrei Alexandrescu wrote:
>> Could we simply disallow statically throwing Object? That would be the ideal solution. Looks like we're all in agreement. Walter, do you want me to bugzillize this request?
>>
>> Andrei
>>
>> Sean Kelly wrote:
>>> In a prior discussion with Andrei we agreed that in instances where
>>> there are multiple in-flight exceptions, the exceptions would all be
>>> chained via the .next property and passed up the stack together.  I
>>> just started implementing some of the code for this and have run into
>>> a snag: it's possible to throw instances of Object, and Object
>>> doesn't have a .next field.  I've toyed with some rather complex
>>> rules for resolving this, but the real problem is that Object
>>> instances can be thrown at all.  May I assume that the user should
>>> only ever throw Exceptions (ie. children of Error or Exception) and
>>> have some straightforward way for handling the Object case, be it
>>> ignore the Object, wrap it in an ObjectWrapperException, or something
>>> like that?
>>> _______________________________________________
>>> phobos mailing list
>>> phobos at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/phobos
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
>>
>>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos