Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
January 13, 2004 exception handling | ||||
---|---|---|---|---|
| ||||
in Handling Errors section in the spec, it doesnt show an example of using the try catch finally keywords. Is it somewhere else? Surely that would be the right place to put it. |
January 13, 2004 Re: exception handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | In article <bu0dkg$1r5t$1@digitaldaemon.com>, imr1984 says... > >in Handling Errors section in the spec, it doesnt show an example of using the try catch finally keywords. Is it somewhere else? Surely that would be the right place to put it. > > can someone post an example for using the finally keyword, because C++ doesnt use it. |
January 13, 2004 Re: exception handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | You should be able to implement a Singleton pattern easy. This is what I do in Java public class One{ One one; public static void getOne(){ if(one == null){ new One(); } } private One(){ // private constructor //construct stuff } } This way if there is an instance of One already you cannot make another One. This was good for me in Java because I found that when clicking a JTable for some reason the Thread goes through the event listener method twice. The Singleton pattern solved this problem for me. Phill. "imr1984" <imr1984_member@pathlink.com> wrote in message news:bu0dkg$1r5t$1@digitaldaemon.com... > in Handling Errors section in the spec, it doesnt show an example of using the > try catch finally keywords. Is it somewhere else? Surely that would be the right > place to put it. > > |
January 13, 2004 Re: exception handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to Phill | woops wrong thread! "Phill" <phill@pacific.net.au> wrote in message news:bu20f7$1ff0$1@digitaldaemon.com... > You should be able to implement a Singleton pattern > easy. > This is what I do in Java > > public class One{ > One one; > > public static void getOne(){ > if(one == null){ > new One(); > } > } > > private One(){ // private constructor > //construct stuff > } > > } > > This way if there is an instance of One already > you cannot make another One. > > This was good for me in Java because I found > that when clicking a JTable for some reason the > Thread goes through the event listener method > twice. > > The Singleton pattern solved this problem for > me. > > > Phill. > > > > "imr1984" <imr1984_member@pathlink.com> wrote in message news:bu0dkg$1r5t$1@digitaldaemon.com... > > in Handling Errors section in the spec, it doesnt show an example of using > the > > try catch finally keywords. Is it somewhere else? Surely that would be the > right > > place to put it. > > > > > > |
January 14, 2004 Re: exception handling | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 Attachments: | imr1984 wrote: > in Handling Errors section in the spec, it doesnt show an example of using the try catch finally keywords. Is it somewhere else? Surely that would be the right place to put it. I probably know less about error handling than you do, so my example may be of limited use (or wrong). But the attached example does compile and run and it may answer your question. If it doesn't help you, you might try to re-phrase your question. More specific questions get more specific answers. By the way, I'm assuming you've already looked at http://www.digitalmars.com/d/statement.html#try. (I agree it'd be nice to have an actual example in the documentation using these keywords.) -- Justin http://jcc_7.tripod.com/d/ |
Copyright © 1999-2021 by the D Language Foundation