Re: Extensible compound statements -- new exec flavor

Ty Sarna (tsarna@endicor.com)
Mon, 23 Jan 1995 05:30:08 GMT

In article <JFULTON.95Jan21162010@dsjfqvarsa.er.usgs.GOV>,
Jim Fulton <jfulton@dsjfqvarsa.er.usgs.GOV> wrote:
>
> Proposed new exec compound statement:
> -------------------------------------
>
> Add a compound exec statement: cexec_stmt:
>
> cexec: "exec" callable ":" suite
> ["else" ":" suite]
[...]
> exec transaction:
> # some code
> # that makes up the transaction
> exec transaction:
> # This is a sub transaction
> # Perhaps more code for the first transaction
> Advantages:
>
> - New control constructs, such as transactions, can be modelled.
> - Fully backward compatible.

Yes yes yes! I like this! Both for transactions (which I'd like to
implement too) and for other new control constructs. This would be great
for threads programming, too:

exec AttemptShare(some_object): # or any of {Attempt|Obtain}{Lock|Share}
# do stuff with the locked entity
# lock automaticly freed at end of block
else:
# something else

As with transactions it could be done with existing facilities, but it's
easy to screw up handling of freeing the lock, especially in the case of
exceptions and what not.

This is a really sexy construct, and it sure would get my vote.

-- 
Ty Sarna                 "Don't be wet or humidity, for the cause of
tsarna@endicor.com        electric obstacle." -- Warning from a manual