www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Feature Request: Eliminate as many try block as possible

reply Davidl <Davidl 126.com> writes:
Step1: enhance the Signal & Slot func, make it support observer of a  
delegate of a nested func
Step2: provide low-level func, SaveStackFrame, RestoreStackFrame(these two  
func manipulate the SP)
actually they are quite simple, a rough implementation of them would be(i  
haven't tried to compile
it actually , but they should do the trick) :
struct Frame
{
     static int _esp;
     SaveStackFrame()
     {
         asm
         {
             mov _esp,ESP;
         }
     }

     RestoreStackFrame()
     {
         asm
         {
             mov ESP,_esp;
         }
     }
}

Step3:
make all throw exception in library all proceeded by signal & slot. This  
would reduce the runtime
expense, and i think would provide user a lot possibilities with  
proceeding the exception generated
  by the standard library. like continue the standard library process? or  
break the process?
Apr 05 2007
parent Davidl <Davidl 126.com> writes:
err, i don't know if it requires RetPoint(return to specific IP address)=
?
cause the idea of using SaveStackFrame & RestoreStackFrame is trying to
get the signal break the whole process like a real exception does.

so possible use of it would be

void func()
{
     Frame f =3D new f;
     f.SaveStackFrame;
     void handler(char[] msg, int i)
     {

         f.RestoreStackFrame(&Label);
     }
     //Set the handler to our nested func

     //call some std funcs

     Label:
     // continue normal process
}

and a typo in Frame :p static int _esp; should be int _esp;

and another feature request is user can use & operator to get
forward label address to void*


 Step1: enhance the Signal & Slot func, make it support observer of a  =
 delegate of a nested func
 Step2: provide low-level func, SaveStackFrame, RestoreStackFrame(these=
=
 two func manipulate the SP)
 actually they are quite simple, a rough implementation of them would  =
 be(i haven't tried to compile
 it actually , but they should do the trick) :
 struct Frame
 {
      static int _esp;
      SaveStackFrame()
      {
          asm
          {
              mov _esp,ESP;
          }
      }

      RestoreStackFrame()
      {
          asm
          {
              mov ESP,_esp;
          }
      }
 }

 Step3:
 make all throw exception in library all proceeded by signal & slot. Th=
is =
 would reduce the runtime
 expense, and i think would provide user a lot possibilities with  =
 proceeding the exception generated
   by the standard library. like continue the standard library process?=
=
 or break the process?
Apr 05 2007