Changes between Version 10 and Version 11 of WritingEfficientMetaModelica


Ignore:
Timestamp:
2014-10-30T07:51:20Z (10 years ago)
Author:
Lennart Ochel
Comment:

add bullet for try/catch

Legend:

Unmodified
Added
Removed
Modified
  • WritingEfficientMetaModelica

    v10 v11  
    5959}}}
    6060
     61== try/catch ==
     62Use try/catch syntax for doing stuff like the following:
     63{{{#!mo
     64// RML-style
     65algorithm
     66  _ := matchcontinue()
     67    case () equation
     68      // Do something which might fail.
     69    then ();
     70   
     71    else equation
     72      // Do something else.
     73    then ();
     74  end matchcontinue;
     75}}}
     76
     77
     78{{{#!mo
     79// OMC style
     80algorithm
     81  try
     82    // Do something which might fail.
     83  else
     84    // Do something else.
     85  end try;
     86}}}
     87
    6188== Avoid matchcontinue, use tail recursion ==
    6289`matchcontinue` is slow. Whenever possible, use `match` instead. This avoids calling `setjmp`.