synonyms

Alex Tweedly alex at tweedly.net
Thu Jun 29 12:51:54 EDT 2017


On 29/06/2017 17:43, Mike Bonner via use-livecode wrote:
> yeah, that was kinda my point.  It bipasses the need to jump through all
> the hoops of building up the proper string, then having to break it into
> parts on the other end.  My earlier example (way over simplified) ended up
> using split create an array out of name value pairs.. It just makes more
> sense to me, to pass in the array to begin with.
>
> Having said that, building such a string could be simplified using merge..
> doSomething 12,4, merge("size=[[tsize]],row=[[gAData]]")
??
[[gAData]] is still not convertable to a string, so I don't see how that 
could work.

But who cares :-) ?

For some cases - basically simpler ones - the string parsing works 
nicely, though it can be a bit untidy when you are passing variables.

For 98% of the others, an array of named/optional parameters works well 
(and you can use tricks/functions to make that less verbose).

doSomething 12, 4, _("size", tSize, row, gAData)
          works well for me, is probably anathema to some (many?) others

and for the last 2% where you want named, optional, pass-by-reference 
parameters - you're out of luck,  maybe LCB will help some day.

-- Alex.

> But again, you either do the work first (and build the array to send)  or
> you do the work after (and break up the name value pairs after the fact.)
>   It just seems simpler to me to use arrays from the start.
>
> On Thu, Jun 29, 2017 at 10:31 AM, Alex Tweedly via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> On 29/06/2017 17:17, Mike Bonner via use-livecode wrote:
>>
>>> The thing about passing in as an array is.. its just a different form of
>>> name value pairs, so it sidesteps the whole issue.
>>> alue pairs.
>>>
>> Not quite - there's a crucial difference.
>>
>> Using an array for name/value pairs, you can pass in an array as an actual
>> parameter.
>>
>> You can't do that with strings for the name/value pairs.
>>
>>     put gAData into tA["row"]
>>     put 100 into tA["size"]
>>     DoSomething 12, 4, tA
>>
>> but you can't do
>>     DoSomething 12, 4, "size=100", "row=" & gAData
>> because the array gAData can't be automatically converted to/from a string
>> to pass it.
>>
>> -- Alex.
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list