Re: Pass by Reference

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

I will always prefer

    {i,j,k} = thing(i,j,k) 

Why not

    i,j,k = thing(i,j,k) 

The first example implies you are trying to build a sequence, while the second looks like an assignment.

To be honest I can't really remember, but it was all thrashed out several years ago. I'll try me best:

Firstly, the {i,j,k} = <expr> syntax has already been implemented1. Given the way Eu is based on sequences, it somehow "fits". Otherwise, no real reason, except perhaps that

    i,j,k = {1,2,3} 

starts to get misleading, and then while

    i,j,k = 1,2,3 

seems better, it implies it would be OK to code

    return 1,2,3 

which is genuinely misleading. That absolutely has to return {1,2,3}, otherwise you've suddenly got issues with

if ... then 
    return 1,2 
else 
    return 1,2,3 

and, given there is only one eax/rax, subsequent implications for the system stack, call_back(), etc.

HTH,
Pete

1 Bear in mind I can only be authoritative about Phix, however I think it is also true for OpenEuphoria.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu