| Thread overview | |||||
|---|---|---|---|---|---|
|
October 09, 2006 restriction in finally no catch | ||||
|---|---|---|---|---|
| ||||
Actually DMD has the restriction, that a catch in not allowed within a finally block.
A very simple workaround:
try{
}
catch( Exception e){
}
finally(
void block(){
try{
}
catch( Exception e){
}
}
block();
}
This is OK for the compiler.
I don't know the reason for this restriction, but
isn't it possible to get rid of it?
| ||||
October 09, 2006 Re: restriction in finally no catch | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | Frank Benoit wrote:
> Actually DMD has the restriction, that a catch in not allowed within a
> finally block.
>
> A very simple workaround:
>
[...]
another option:
try
{
}
catch( Exception e)
{
}
finally
{
// delegate literal
(){
try
{
}
catch( Exception e)
{
}
}(); // called directly
}
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply