realbasic-betas.mbox
[Top] [All Lists]

Re: Ability to have more then one Return Value

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: Ability to have more then one Return Value
From: Kevin Ballard <kevin at sb dot org>
Date: Sat, 27 Jul 2002 14:11:24 -0400
On 7/27/02 1:18 PM, "Nathan Fisher" <virtual1 at pitnet dot net> wrote:

> 
> On a somewhat similar note, it would be nice for functions to be able to
> return more than one value.  This would require a bit of a change to the
> compiler's syntax, but would eliminate the need for "wrapper classes" in
> a lot of instances.
> 
> For example, right now I might call GetAddressAndPort(Server) to get the
> server's address and port.  As it is now, I would probably have to
> return it as a single string, like "192.168.1.15:110" and nthfield out
> the results.  This would be so much handier:
> 
>     Sub GetAddressAndPort(Server as string) as string,integer
> or
>     Sub GetAddressAndPort(Server as string) as string, as integer
> 
> and call it like
> 
>     Address, Port=GetAddressAndPort(Server)
> 
> Does something like this have a prayer of being implemented?  As far as
> I can tell, it doesn't break existing syntax.

To me, this just looks like it could be very confusing. What happens if you
say

address=GetAddressAndPort(Server)

? Would it say missing LValue? That would be wrong as it has an LValue.
They'd have to have new errors and everything. I think it's a waste of time
for something like this, which has good potential for confusion.

Besides, in response to a previous message, ByRef is not a kludge. If you
understand what it's actually doing, you'll see it's perfectly fine. And it
also has other uses, namely if you have a 2MB string you don't want to copy
it, so you pass it around ByRef.

-- 
Kevin Ballard
kevin at sb dot org
Email from Korea or China must go to <kevin dot nb at sb dot org>
http://kevin.sb.org/



<Prev in Thread] Current Thread [Next in Thread>