Re: Pass by Reference

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

..

Because the compiler ensures the counts match, the only situation where a crash should be possible would be:

a, b, c = call_function( routine_id("foo"), {}) 

I'd initially agreed that this shouldn't be an error, but I no longer think that's the case.

Mainly, I figure that if you're trying to read more values back than a routine returns, it's a pretty strong hint that perhaps something is wrong.

After all, the parser treats it as a fatal error.

You've still go the de-sequencing operator to fall back to if you want to handle multiple values. But my assumption is that a routine should return a fixed number of parameters.

If you're just trying to avoid having Euphoria throw an exception, I figure better exception handling is the path to take.

Could you give an example of where you think you might encounter this use case?

- David

Just my 2c. If the requirement for multiple return values were driven largely by returning error/status codes then the suggestion (of mine in the Try/Catch thread) of using an implicit error variable would reduce a lot of this need. Therefore, that seems to simplify the issue to mere desequencing.

Spock

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

Search



Quick Links

User menu

Not signed in.

Misc Menu