Re: strong typing and error handling

new topic     » goto parent     » topic index » view thread      » older message » newer message

On 27 Jun 2003, at 7:55, Peter Willems wrote:

> 
> 
> Maybe I'm shooting myself in the foot here, but....
> 
> One of the things in Eu that I really like is the rule-like
> variable typing that let us set boundaries for a variable.
> But it seems to me that the absense of an error-handler makes
> this close to useless because when I try to load a value into
> a variable that is outside it's boundaries, it exits the app
> with an error message. Thus I need to have my app check anyway
> when putting values into vars to prevent my app from exiting,
> so when I have to check var boundaries myself, what does the
> option to set boundaries when defining a var does for me ?
> 
> Or do I mis something and IS it possible to capture boundary
> overflow (or underflow) in a simple way so I can write a simpe
> error-handler ?

You set your own type, which Eu will execute whenever you assign 
something to the var. Inside the typecast code, you check it's bounds. There 
is info on user-defined typecasting in Eu's help docs, but i don't know how to 
tell you where they are.

Scroll down to this line in String.e for an example:

global type string_type(object x)

Kat

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu