Re: Pass by Reference

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

Maybe we can just make the changes to the parser to allow multiple return values - so it looks the same as the other languages and the parser can check intent - but have it implemented behind-the-scenes by replacing it with the appropriate sequence creation and desequencing calls (once the parser has validated everything of course)...

My thought exactly. No run-time cost, and the parser catches stupid mistakes I make.

Plus, the syntax for assignments looks consistent.

I believe there's some sort of pack and unpack

You might have noticed I've glossed over a couple of points:

  1. How does this behaves with routine_id? I assume that you can't determine this ahead of time, so you simply have to implement this as it currently is, and hope for the best... Unless someone's got a better idea.
  2. How do you declare the number of values returned? I assume the parser keeps track of the count, and complains if they don't balance.
  3. There's no way to declare a return type. Then again Euphoria doesn't currently declare a return type, which is an odd omission:
function foo(integer x) returns integer -- I'd expect Euphoria would do something like this 
   return 20 
end function 

The main syntactic difference is that most languages appear to use the underscore {_} character rather than {?}.

- David

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

Search



Quick Links

User menu

Not signed in.

Misc Menu