Re: EURXSC -- Euphoria Routine Exit Status Code idea

new topic     » goto parent     » topic index » view thread      » older message » newer message
Aveu said...

I have an idea for a new feature for the next major release of Euphoria.

You mean 5.0? That's probably years away. The next minor release and next revision release (4.1.0 and 4.0.5 respectively) are a lot closer.

Aveu said...

At its heart the idea is nothing more than to create a new built-in global variable (which would be a reserved identifier) that can be R/W accessed by any routine.

Basically errno from C. I think this is a bad idea, since it's less obvious and more complicated than simply using a function to return the value.

Aveu said...

Here is a hypothetical example of how this might be used:

8.16.4.7 add_item

  1. The Routine Exit Status Code will be set as follows:
    1. If needle was successfully added to haystack then EURXSC = 0
    2. If needle was already part of haystack then EURXSC = 1
    3. If needle was not already part of haystack and also failed to be added then EURXSC = -1

The -1 case will never happen, since it is impossible to fail to add it as part of the haystack if it is not already in there. (I guess we could run out of memory during the attempt, but then Euphoria crashes rather than returning a catchable exception or error code.)

I can see the use of being able to check if the needle was already in the list before it was added. However, I'm not sure that this is worth changing the return value of add_item, especially when doing the check manually first is so cheap. (I could be talked into an add_item_ex() that returns {0,theList} or {1,theList} however.)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu