Re: Pass by Reference

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

Doesn't Phix already do something similar to this?

Yes, though quite a few bugs have been fixed in that area but never released, and the next one is still some months off.
When it is a local variable, since that can never be seen/referenced by the code being called,

  local = somefunc(...,local,...) 

the lhs gets set to <unassigned> over the call. Similar handling exists for

  local[i][j] = somefunc(...,local[i][j],...) 

though in that case the element gets set to 0, and there is also multiple assignment to consider.

There is a pointless benchmark/test case I have somewhere showing a 400-fold performance gain, though to be honest real-world gains are likely to be extremely rare, and tiny.

Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu