1. hypocrite's reply

> discard = { x, y, discard }

So it is not a joke. Read it again, Ralf. And tell the old hypocrite (me!) what
the line
is really meant to do. To create an artificial fog? jiri

new topic     » topic index » view message » categorize

2. Re: hypocrite's reply

>> discard = { x, y, discard }
>
>So it is not a joke. Read it again, Ralf. And tell the old hypocrite (me!)
what the line
>is really meant to do. To create an artificial fog? jiri


Ok, this was a bad, useless example.

First of all, the reason I want a discard variable is, so Euphoria can speed
things up for those cases Im not gonna use the result of an expression, or
more logically a function call.

However, when a function is called merely for its side-effects, and not the
return value, there could be arguments that are only used to gain the result
value. Such arguments can be discarded as well.

sequence list
list = {}

function my_func (integer x, integer y, object z)
    list = append(list, {x,y})
    return x*y*z
end function

discard = my_func (3, 23, discard)

*legal*

discard = my_func (discard, 3, {2,3})

*crash* .. side effect no longer possible

Ok, recondiring this, it isnt very clean, still an discard variable for
assignment to speed things up, which also halts your program if you
accidently do use the value of discard in an expression, is something I
would like to see in some release of Euphoria.

And I dont have to explain the speed gain. In the above example the
interpreter can skip the calculation of the return value for example. It
would be one of the more complex things to add to the preproccesor inside
ex.exe though.

Ralf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu