alice-teacher Do in order scope issue in Alice 3

Leonel Morales litomd at gmail.com
Wed May 18 19:19:41 EDT 2022


It's hard to find a case where do in order needs to go inside another
do in order directly.

I have used several consecutive do in order inside a do together,
makes sense in some cases. Can't think of a case where the scope of a
variable was a problem.

Grouping code is another example. If several lines of code have to be
copied through the clipboard it is easier to put them all in a do in
order block and copy or move it to the clipboard, instead of going
line by line. After reorganizing code it may end looking like that for
no other purpose than easing copy or move.

Not sure.

2022-05-18 13:26 GMT-06:00, Ziccardi, Adam <aziccardi at opschools.org>:
> Nicely illustrated 'technicality'.
> What's the logic or reason for the inner DoTogether containing only the
> num1 and nums initializers?
> Is this exercise only to show the scope doesn't extend outward?
> AZ
>
> On Wed, May 18, 2022 at 1:45 PM Leonel Morales <litomd at gmail.com> wrote:
>
>> I guess it has to do with blocks' translation into Java. Do in order
>> translation places all instructions inside curly brackets creating a
>> semantic scope.
>>
>> I examined the code with the "Java code on the side" option and obtained
>> this:
>>
>> [image: image.png]
>>
>> And it works... not sure if it should.
>>
>> Regards,
>>
>> El mié, 18 may 2022 a las 10:43, Carlos Bovell via alice-teachers (<
>> alice-teachers at lists.andrew.cmu.edu>) escribió:
>>
>>> Hi,
>>>
>>> In Alice 3, the do in order control structure limits scope. Is there a
>>> reason for that? In the attached screenshot, the variable outside the do
>>> in
>>> order can't be assigned any of the variables' values that were declared
>>> inside the do in order.
>>>
>>> Carlos
>>>
>>>
>>> _______________________________________________
>>> alice-teachers mailing list
>>> alice-teachers at lists.andrew.cmu.edu
>>> To change settings or unsubscribe visit:
>>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
>>
>> _______________________________________________
>> alice-teachers mailing list
>> alice-teachers at lists.andrew.cmu.edu
>> To change settings or unsubscribe visit:
>> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
>
>
>
> --
> Adam Ziccardi
> 716-209-6482
> OPTA president
> K-12 CS coordinator
> NYS Master Teacher
> Teacher Webpage <https://www.opschools.org/Domain/2958>
>


More information about the alice-teachers mailing list