[Swift-devel] iterate behavior

Ketan Maheshwari ketancmaheshwari at gmail.com
Tue Jul 5 15:19:53 CDT 2011


On Tue, Jul 5, 2011 at 2:25 PM, Ketan Maheshwari <ketancmaheshwari at gmail.com
> wrote:

>
>
> On Tue, Jul 5, 2011 at 2:09 PM, Ben Clifford <benc at hawaga.org.uk> wrote:
>
>>
>> > The first instance 'until' i gets greater than 2 is when it gets 3. With
>> > this regard, I think trace could go ahead and show the value of i but
>> > somehow no other statement should get evaluated in that iteration.
>>
>> I think that's crazy: either the body gets executed or it doesn't get
>> executed. trace should not be a 'special statement' that enclosing control
>> structures need to know about that is distinct from a regular swift
>> function call. its also crazy to have trace showing that the body was
>> entered and executed when it wasn't. "I can't see whats going wrong: trace
>> tells me that this loop iteration happens, but its as if the rest of the
>> body doesn't happen..."
>>
>
> trace could be made a debug-level statement and can represent a "visual"
> debugging tool in a script-based programming paradigm.
>

Furthermore, a debug-level trace could be useful applied to arrays:

foreach anelement, idx in anarray{
res[ix] = some_func(anelement);
trace(anarray);
}

Making trace(anarray) print the "end-of-array:anarray" without really
executing some_func could be a useful debugging tool.


>
>
>>
>> --
>>
>
>
>
> --
> Ketan
>
>
>


-- 
Ketan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20110705/7ab1a859/attachment.html>


More information about the Swift-devel mailing list