for reference:

For each" expects the iterator and elements to all be of the same time

https://doc.4d.com/4Dv17/4D/17.3/For-eachEnd-for-each.300-4621439.en.html

but it is possible to use "This.value" in listboxes

https://doc.4d.com/4Dv17/4D/17.3/Managing-List-Box-Objects.300-4621083.en.html

and $1.value in collection methods

https://doc.4d.com/4Dv17/4D/17.3/collectionmap.305-4621807.en.html

as well as $col[$i] in a "For" loop

https://doc.4d.com/4Dv17/4D/17.3/Value-type.301-4620763.en.html

so there are already ways to iterate mixed collections in v17, without the 
variant type.

---

the use of variant type (or object properties in general as its substitute) 
does allow for generic code,
but an over-use of it may lead to runtime errors and a hit on performance (we 
have strong types for a reason).

---

finally, it would be more appropriate to discuss v18 features on the beta 
forums:

https://forums.4d.com/List_Message/JP:0/0/2/1/1/1/14234613/0/0/1/-1/0/0/0/0/0/0

> 2019/11/03 3:40、Kirk Brooks via 4D_Tech <[email protected]>のメール:
>
> $tuple_col:=New collection("a";"b";"c";null;null;null;"z")
>
> I want to iterate through the collection and concatenate the values into a
> string.
>
> $str:=""
> For each ($element;$tpl_col)
>
> If ($element#Null)
>
> $str:=$str+$element
>
> End if
>
> $str:=$str+$delim
>
> End for each
>
> If this code is interpreted and not typed things are fine. As soon as I
> declare $element as TEXT it throws an error when I hit a Null. If I declare
> it as an object it throws an error when it hits a text. But if I declare
> $element as C_VARIANT it's all good.




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