realbasic-plugins
[Top] [All Lists]

Re: Returning an RB array

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Returning an RB array
From: Frank Condello <developer at chaoticbox dot com>
Date: Thu, 25 Jan 2007 16:05:41 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
References: <20070125164145 dot 282DB6DC4C2 at mail dot verex dot com> <99C128BD-5175-4A0D-82F9-DFE40CEE4240 at cahir dot net>
On 25-Jan-07, at 3:39 PM, Stephen A. Cochran Lists wrote:

On Jan 25, 2007, at 11:41 AM, joe at strout dot net wrote:

I think the generally preferred idiom is to make your own container
class and accessor specific to your data.  For example, see Group2D,
which is essentially a wrapper for an array of Object2Ds (plus some
additional functionality).

I thought about that, but it seems a class would run into the same issues.

For public plugins I'll tend to use wrapper classes, but for in-house stuff I'll often return a delimited string or memoryblock from the plugin and use a helper method in RB that creates and returns an array.

Frank.
<http://developer.chaoticbox.com/>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Thu 25 Jan 2007 14:07:07 -0700
Return-Path: <realbasic-plugins-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id 74FF218132C0; Thu, 25 Jan 2007 13:07:20 -0800 (PST)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on www.realsoftware.com X-Spam-Level: X-Spam-Status: No, score=-1.7 required=4.5 tests=AWL,BAYES_00,NO_REAL_NAME autolearn=no version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
        by xmail.realsoftware.com (Postfix) with ESMTP id 0D02618132B9;
        Thu, 25 Jan 2007 13:07:15 -0800 (PST)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id 3C8E01873555; Thu, 25 Jan 2007 15:07:11 -0600 (CST)
X-Original-To: realbasic-plugins at lists dot realsoftware dot com
Delivered-To: realbasic-plugins at lists dot realsoftware dot com
Received: from mail.verex.com (mail.verex.com [66.116.103.197])
        by lists.realsoftware.com (Postfix) with ESMTP id F1DC91873548
        for <realbasic-plugins at lists dot realsoftware dot com>;
        Thu, 25 Jan 2007 15:07:07 -0600 (CST)
Received: from [66.116.103.197] (localhost [127.0.0.1])
        by mail.verex.com (Postfix) with SMTP id 9E57E6DC8C0
        for <realbasic-plugins at lists dot realsoftware dot com>;
        Thu, 25 Jan 2007 14:07:07 -0700 (MST)
Date: Thu, 25 Jan 2007 14:07:07 -0700
From: joe at strout dot net
To: realbasic-plugins at lists dot realsoftware dot com
In-Reply-To: <99C128BD-5175-4A0D-82F9-DFE40CEE4240 at cahir dot net>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20070125210707 dot 9E57E6DC8C0 at mail dot verex dot com>
Subject: Re: Returning an RB array
X-BeenThere: realbasic-plugins at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot 
com>
Sender: realbasic-plugins-bounces at lists dot realsoftware dot com
Errors-To: realbasic-plugins-bounces at lists dot realsoftware dot com

On Jan 25, 2007, at 20:39 UTC, Stephen A. Cochran Lists wrote:

I thought about that, but it seems a class would run into the same issues. My plugin is accessing some directory services (proprietary, but conceptually similar to LDAP).

From some lookup function, I need to return the results, which is basically a two-dimensional array. each row is one matching record, with the columns determined by the fields requested.

Right, so you return an object that has an accessor to return the item
for any row and column.  Or perhaps better, an object that returns any
row all at once, as a Dictionary.

Both dimensions would be unknown, and would seem to encounter the same problem inside a class as outside.

No, you're still thinking about arrays. I'm saying, forget arrays. Design your own class (or classes) that return exactly the information
requested, and use those INSTEAD of arrays.  Just as Object2D doesn't
have any method that returns an array of its contents, yet you can
access its contents just fine via its methods (Count, Item, etc.).

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


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