common code patterns

Monte Goulding monte at appisle.net
Fri Aug 11 18:17:08 EDT 2017


> On 11 Aug 2017, at 9:40 am, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> repeat with i=1 to paramcount()-1
>            put param(i)&"," after theValue
> end repeat
> put param(paramcount()) after theValue
> 
> Shorter, faster, and just plain tidier :-)

Hmm… there’s a few reasons I’m not a fan of this pattern:

- you can’t really clearly document the handler parameters although this could feasibly be worked around by redefining what a parameter is in your docs
- if any of your parameters may contain whatever delimiter you are using when parsing the params then everything breaks if you are using comma as suggested above then it’s not safe to pass object references to the handler.

So my question therefore is are there many people that use this pattern and should we throw it around a bit to get a more robust form or is this an edge case of a particular developer’s scripting style?

Cheers

Monte




More information about the Use-livecode mailing list