Re: Pass by Reference

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

First, there's no need for adding square brackets. The syntax is already distinct enough for humans and compilers to recognize. Language like Lua and Python already demonstrate that.

I agree there's no need. Right now, it strikes me as a good idea because it's helping the person understand that something different is going on.

dcuny said...

Second, it breaks the existing idiom. We already have:

x = foo() 

Adding a comma extends the existing syntax:

x, y = foo() 

Whereas using the square brackets forces the user to use a new syntax without any obvious value.

I'm seeing the square brackets as something more like the desequencing operation. And makes it more obvious to me that we're expecting multiple return values. Again, I like the emphasis. I'm not a fan of the current trend of (what seems to me) sneaky syntax that does a lot more than is obvious. This is a relatively mild example, but still.

dcuny said...

Third, it uses an existing feature of syntax in an unrelated way. The square brackets already have a semantic meaning in Euphoria. Now you're overloading them with a new, unrelated meaning.

Yes, this is where I probably am closest to agreeing with you. I just wanted something different from sequence brackets. Parentheses were obvious non-starters.

dcuny said...

Anyhoo, I think I'm going to take back my statement about how call_func() should operate. Given that the parser doesn't let the code compile if there's a mismatch, and call_func() throws an exception if there's a parameter length mismatch, I think the parameter count match should be enforced at runtime - that is, the left and right sides should be equal.

Yes, I don't see any other way. Well, in some cases we could detect the target function and deal with it right away, but we'd still need to do something at runtime when we can't.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu