Kirk,

Thanks - very helpful. What I was hoping to do was to build a couple of text 
arrays in a method; return them in an object; and then use them directly in 
calls to HTTP methods, something like this:

C_OBJECT($headers)
$headers:=BuildHeaders // returns object containing matched arrays
$status:=HTTP Get($url; $response; $headers.names; $headers.values)

Is that possible, or must I extract the names and values arrays from the 
returned object before use? I’m using v17R4.

Jeremy

> On 10 Jun 2019, at 19:47, Kirk Brooks via 4D_Tech <[email protected]> 
> wrote:
> 
> Jeremy,
> Depends on which version you are using. If you are in v17 then 'arrays in
> objects' are essentially gone. They are collections now and you can use dot
> notation with collections.
> Otherwise, yes 'arrays' are still arrays within the object.
> 
> It's possible to mix the nomenclatures in v17. You _can_ define an object
> as use OB SET ARRAY but there is no advantage to doing so. It's much better
> to use collections.
> 
> C_OBJECT($o)
> $o:=New object
> $o.array:=New collection
> 
> $o.array.push(1) // $o: {array: [1]}
> 
> 
> $x:=$o.array[0]  //  $x = 1
> 
> If you have some array of longints you want to append you can call OB SET
> ARRAY($o;”array”;$arrayOfLongs) without an error and it will be a
> collection.
> You could also call ARRAY TO COLLECTION($o.array;$arrayOfLongs)
> 
> 
> On Mon, Jun 10, 2019 at 11:37 AM Jeremy Roussak via 4D_Tech <
> [email protected]> wrote:
> 
>> Are arrays within objects rather second-class properties? I know that I
>> can put an array into an object using OB SET ARRAY, and I can retrieve it
>> (all of it) using OB GET ARRAY, but is that all?
>> 
>> Can I use dot notation to refer to the arrays themselves, or to individual
>> elements of the array?
>> 
>> C_OBJECT($o)
>> 
>> $o:=New object
>> OB SET ARRAY($o;”array”;$arrayOfLongs)
>> 
>> $o.array{1} - error
>> $o.array - error
>> $o[“array”] - error
>> 
> 
> -- 
> Kirk Brooks
> San Francisco, CA
> =======================
> 
> What can be said, can be said clearly,
> and what you can’t say, you should shut up about
> 
> *Wittgenstein and the Computer *
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to