Re[2]: [fpc-pascal] using exceptions

2012-01-04 Thread José Mejuto
Hello FPC-Pascal, Wednesday, January 4, 2012, 1:31:01 AM, you wrote: MD> Very interesting and I agree when he say: MD> "I think the reason programmers in C/C++/Java style languages have MD> been attracted to exceptions is simply because the syntax does not MD> have a concise way to call a functio

Re: [fpc-pascal] using exceptions

2012-01-04 Thread Bernd
2012/1/3 Lars : > But that just a goto statement going to the except label.. Exceptions in a > way are actually forcing you to write your code in  a GOTO way. I would see Exceptions as being more like the fabled COMEFROM, the legendary counterpart of the GOTO.

Re: [fpc-pascal] using exceptions

2012-01-03 Thread Marcos Douglas
On Tue, Jan 3, 2012 at 7:20 PM, Lars wrote: > Marcos Douglas wrote: >> On Thu, Dec 22, 2011 at 4:17 PM, Anton Shepelev >> wrote: >>> Marcos Douglas: >>> It's  not  difficult,  but is boring have always a parameter or function return to return  an  error, and  have  to  verify  if e

Re: [fpc-pascal] using exceptions

2012-01-03 Thread Lars
Marcos Douglas wrote: > On Thu, Dec 22, 2011 at 4:17 PM, Anton Shepelev > wrote: >> Marcos Douglas: >> >>> It's  not  difficult,  but is boring have always a >>> parameter or function return to return  an  error, >>> and  have  to  verify  if error then... if not er- >>> ror...  if error

Re: [fpc-pascal] using exceptions

2011-12-22 Thread Marcos Douglas
On Thu, Dec 22, 2011 at 4:17 PM, Anton Shepelev wrote: > Marcos Douglas: > >> It's  not  difficult,  but is boring have always a >> parameter or function return to return  an  error, >> and  have  to  verify  if error then... if not er- >> ror...  if error and error then... etc > > If you mean hav

Re: [fpc-pascal] using exceptions

2011-12-22 Thread Anton Shepelev
Marcos Douglas: > It's not difficult, but is boring have always a > parameter or function return to return an error, > and have to verify if error then... if not er- > ror... if error and error then... etc If you mean having to write nested IFs to check all the errors, then there are

Re: [fpc-pascal] using exceptions

2011-12-22 Thread Bart
On 12/22/11, nore...@z505.com wrote: > You don't see as much Try Except, it's more Try Finally. People ignore the > exceptions because it's an accepted thing to do. Then the end user of the > application gets a strange exception message instead of a user friendly > one. For example, if a file is

Re: [fpc-pascal] using exceptions

2011-12-22 Thread Marcos Douglas
On Wed, Dec 21, 2011 at 10:29 PM, wrote: > Marcos wrote: >> I use Exceptions to check the integrity of classes. I have one >> Exception for each class (E), most of the time. > > > Another problem with errors is that sometimes it is hard for a class to > return errors. In procedural programming yo

Re: [fpc-pascal] using exceptions

2011-12-21 Thread noreply
Marcos wrote: > I use Exceptions to check the integrity of classes. I have one > Exception for each class (E), most of the time. Another problem with errors is that sometimes it is hard for a class to return errors. In procedural programming you can usually return an error as a parameter but some

Re: [fpc-pascal] using exceptions

2011-12-21 Thread noreply
> In our previous episode, ik said: >> But we use exceptions even on places such as StrToInt, when the string >> is >> not an integer number, but we can expect to either have a number or >> something else. So why use an exception there ? > > Because much used routines like strtoint are often used w

Re: [fpc-pascal] using exceptions

2011-12-21 Thread noreply
> Hello, > > Exceptions like the name suggested, is to mark something that you are not > suppose to expect. > For example while getting a data something went wrong, like disconnection, > wrong size of data etc... > > The usage of exception is very costly in performance, and there for should > use o

Re: [fpc-pascal] using exceptions

2011-12-19 Thread Bernd
2011/12/19 Marcos Douglas : >> The usage of exception is very costly in performance, and there for should >> use only on specific events imho. IMHO it has its legitimate uses. Thee are even languages (Python for example) where it is considered totally normal to use exceptions all over the place a

Re: [fpc-pascal] using exceptions

2011-12-19 Thread Marcos Douglas
On Mon, Dec 19, 2011 at 4:53 PM, ik wrote: > Hello, > > Exceptions like the name suggested, is to mark something that you are not > suppose to expect. > For example while getting a data something went wrong, like disconnection, > wrong size of data etc... > > The usage of exception is very costly

Re: [fpc-pascal] using exceptions

2011-12-19 Thread Marco van de Voort
In our previous episode, ik said: > But we use exceptions even on places such as StrToInt, when the string is > not an integer number, but we can expect to either have a number or > something else. So why use an exception there ? Because much used routines like strtoint are often used without prop

[fpc-pascal] using exceptions

2011-12-19 Thread ik
Hello, Exceptions like the name suggested, is to mark something that you are not suppose to expect. For example while getting a data something went wrong, like disconnection, wrong size of data etc... The usage of exception is very costly in performance, and there for should use only on specific