-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 07/04/2015 18:24, Roland Plüss wrote: > > > On 04/06/2015 06:45 PM, Holger Hans Peter Freyther wrote: >> On Sun, Apr 05, 2015 at 05:47:29PM +0200, Roland Plüss wrote: >> >>> What you mean with "C-style error"? A C++ exception (that >>> doesn't work it looks like)? The cCall is of void return type >>> so I can't return anything. And smalltalk side can't check the >>> arguments as the information required to perform the checks is >>> sometimes located deep inside the engine code base. >> "C-style" error.. a non zero return code and maybe setting a >> variable with the semantic of errno. The return type of "void" is >> your decision? Can't you return something to indicate success or >> failure? > I sure can decide the return type. I just considered it quite quick > and easy if I could return an #int if I link to a function > actually returning an integer. I certainly could return nil but > then I have no idea what error really happened nor can I properly > catch it (well... besides ifNotNil: ). Since Smalltalk has already > an exception/error system why not using it? I don't like wrangling > a language unless there's no other choice. You can return an exception object and throw it from Smalltalk. It certainly can work with methods that would return #void (return nil if there is no exception), it is a bit more complicated for methods that could either return a value or throw an exception. Paolo > > And as far as I know I can't include any code into a <primitive> > declared method. > > I once did the trick with errno type error handling in a module I > made for Smalltalk but it's cumbersome to use and error prone. > > > > _______________________________________________ help-smalltalk > mailing list [email protected] > https://lists.gnu.org/mailman/listinfo/help-smalltalk > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVJOf/AAoJEL/70l94x66Dw98H+QGQDaAUZSJmG3oAp/wLnDeF KEdwJEdB48rTaoqLV0VH7xn4uvY5fqrCOl4AXsDzHT7wx4GT0qnvlJGcnftWWrV1 +rO6vuSnrYSJuk89oNESS+EjvSUarjYry+C9T06LqCf00bjTJ6TJ35gvGMVRrzd0 zN77jHIPJX04sCP4ST0xsZoz/aQHkNRV9C5EpqdQd4l0oWFaid3nTmso0owmKWjO C6SuIskIjiXuTOVxTfPMuXCGD0VLNgq/aaMXAWonVkGGXVeBHHTKury6wlAngLbh iN2q7V8OUna8LCe828OnQktuSAwFmsXW9rvlK97LB1EuE2H8C3g1d5jLEiLTs1U= =1up1 -----END PGP SIGNATURE----- _______________________________________________ help-smalltalk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-smalltalk
