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: Nathan Fisher <virtual1 at pitnet dot net>
Date: Sat, 27 Jul 2002 12:18:01 -0500

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.

- Nathan


On Saturday, July 27, 2002, at 08:00 AM, REALbasic Developer Releases wrote:

Subject: Re: Ability to have more then one LValue
From: "Will Leshner" <leshner at ljug dot com>
Date: Fri, 26 Jul 2002 17:55:01 -0700

Right. I think what you probably want is the ability to do this:

ST1.Text = ST2.Text = "This is a test"

You can do that kind of stuff in C because '=' returns the result of the
assignment. That could be useful in RB as well.

Now that I look at your original email as it came to me the '=' wasn't
there. But I see what you are getting at now.

On Friday, July 26, 2002, at 05:41  PM, Mike Benonis wrote:

Here's an example.  I want to do this:

    ST1.Text, ST2.Text="This is a test"

Instead of this:

    ST1.Text="This is a test"
    ST2.Text="This is a test"

-Mike

PS - Did you see the Equals symbol in my examples?  There was one
there, but
your reply doesn't show it.  Maybe your client is choking on the equals
sign?  So we understand, there should be an equals sign above after the
last
.Text on every line.



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