On 24/08/2017 12:09, Markus Armbruster wrote:
> Cut-and-paste cuts both ways (pardon the pun):
> 
>     initialize with QTestState A
>     frobnicate with QTestState A
>     glomnify with QTestState A
>     frobnicate with QTestState A
>     initialize with QTestState B
>     boingboing with QTestState B
>     finalize with QTestState A
>     finalize with QTestState A
> 
> Uh, forgot to frobnicate after boingboing, let me fix that real quick!
> 
>     initialize with QTestState A
>     frobnicate with QTestState A
>     glomnify with QTestState A
>     frobnicate with QTestState A
>     initialize with QTestState B
>     boingboing with QTestState B
>     frobnicate with QTestState A
>     finalize with QTestState A
>     finalize with QTestState A
> 
> Spot the pasto.
>
> This hasty paste would simply work with global_qtest.  I'm not claiming
> there are cases that are just the opposite.  I'm just challenging your
> apparent claim that the long forms help with avoiding or catching
> pastos.  Can you explain how they help more than they hurt?

A pasto without global_qtest is local.

But cut-and-paste that involves _assigning_ global_qtest, even if it
doesn't have cut-and-paste mistakes, may create a mess of functions
knowing^Wbelieving they know what global_qtest is.

Assigning global_qtest means the short-form functions have effectively
dynamic binding.  In a perfect world, global_qtest would be static and
the create-and-assign-global would assert(!global_qtest).  Then >1 VM ->
don't use the short forms.

Paolo

> A bit of global state isn't automatically bad.  *Shared* global state is
> what gets us into trouble.  Can you point to examples where global_qtest
> is shared in ways that aren't 100% trivial?


Reply via email to