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/
|