On 04/01/2012 00:31, Marcos Douglas wrote: [...] >> Another interesting article is: >> http://www.joelonsoftware.com/items/2003/10/13.html > > Very interesting and I agree when he say: > "I think the reason programmers in C/C++/Java style languages have > been attracted to exceptions is simply because the syntax does not > have a concise way to call a function that returns multiple values, so > it's hard to write a function that either produces a return value or > returns an error." > > If we could return more than one value, ok we (maybe) do not need Exceptions. > > Marcos Douglas
I find myself often doing either: function Bla(parameters): integer; - > returns => 0 for success/value returned, < 0 for error and upper layers recognize the error codes (this is pretty much like c common usage you can find in c programs) or function Bla(some_params; out ErrorMessage: string):boolean; or function Bla(some_params; out ErrorCode: integer): some_type_other_than_integer; so it's not like you /can't/ return more than one value... but you need to prepare yourself for it ;) L. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal