Re: Pass by Reference

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

Well, we agree on the fundamentals... Now all I need to do is beat you into submission about the particulars. blink

I've used the multiple return value in other languages (including wxBasic), and I've never felt the need to add some sort of extra syntax around it.

No other languages that return multiple values seem to feel this is necessary.

Consider these examples:

-- same syntax, whether takes 0 or multiple parameters 
a = foo() 
a = sin(10) 
a = max(10, 20) 
 
function foo0() 
function foo1(integer a) 
function foo2(integer a, integer b) 
 
integer a 
integer a, b 
 
sequence s1 = {} 
sequence s2 = {a} 
sequence s3 = {a, b} 
 
{a} = s 
{a, b} = s 

The addition of square brackets breaks this consistency:

return a 
return [a, b] 
 
a = foo1() 
[a, b] = foo2() 

So that's the fundamental issues I've got. IMNSHO...

  • It breaks established syntax
  • It doesn't add any safety that the compiler doesn't already give
  • It implies that there's some sort of special tuple object delimited by square braces
  • It prevents using square brackets for some other special tuple in the future

Basically, if the language is going to make me do extra work (which the brackets do), I (Mr. Lazy Developer) expect to get some benefit for it.

Wasn't the prior point that that language shouldn't "mollycoddle" the developer? (Although, personally, I want my programming language to do as much heavy lifting as possible).

- David

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

Search



Quick Links

User menu

Not signed in.

Misc Menu