Branch: Tag:

2002-11-24

2002-11-24 19:21:52 by Martin Stjernholm <mast@lysator.liu.se>

More info about implicit lambda and some other stuff. Fixed more
uniform formatting.

Rev: CHANGES:1.32

115:       sprintf("%O", a[*]);    - o Implicit lambda. + o Implicit lambda    A convenient way to embed code that needs pre- and/or post- -  initialization. +  initialization. If a statement starts with a function call +  followed directly by a brace block, then the block is transformed +  to a lambda function which is passed as the last argument to the +  function being called.    -  FIXME: Not stable. mast type here. +  The following example embeds OpenGL calls that modifies the matrix +  in an implicit lambda that will save the matrix before execution +  and restore it afterwards:    -  This example embeds OpenGL calls that modifies the matrix in an -  implicit lambda that will save the matrix before execution and -  restore it afterwards. -  +     void PushPop( function f )    { -  GL.glPushMatrix(); +  glPushMatrix();    mixed err = catch(f()); -  GL.glPopMatrix(); +  glPopMatrix(); +  if (err) throw(err);    }    -  +  void do_something() +  {    PushPop() {    glTranslate( ((1.0-0.08)-pcs)/2, 0.0, 0.0 ); -  drawstuff(); +  draw_stuff();    }; -  +  }    -  +  Note that although useful, this feature has important +  disadvantages and will probably be obsoleted by a better +  alternative in the future. The problem is that the inner brace +  block become a completely separate function instead of remaining a +  block. The difference (apart from being slower) is shown by this +  example:    - o Access to hidden variables in surrounding scopes. +  void do_something() +  { +  PushPop() { +  if (glError()) return; +  glTranslate( ((1.0-0.08)-pcs)/2, 0.0, 0.0 ); +  draw_stuff(); +  }; +  draw_more_stuff(); +  } +  +  Since the inner block is a separate function, the return statement +  doesn't exit do_something() as one might expect, causing +  draw_more_stuff() to be called even when there's a GL error. +  Another effect is that break and continue can't be associated with +  statements outside the implicit lambda block. +  +  Another method that overcomes these problems will likely be +  implemented. The problem is that it can give compatibility +  problems to change old code that uses implicit lambdas to that +  one, since e.g. return will work differently without giving any +  sort of error. +  + o Access to hidden variables in surrounding scopes    Include the names of the surrounding classes themselves in the lookup for    Foo::, to make it possible to adress hidden variables in the scopes of    surrounding classes, e.g:
174:    respectively adds and removes entries from the list of paths to    inspect when resolving Local.* symbols.    + o The program type can be specialized +  It's possible to specialize a program variable by adding a program +  identifier, much like an object variable can be specialized. E.g: +  +  program(Stdio.File) fd = Stdio.File; +    o enum reserved    An enum construct similar to that in C has been introduced.    For example:
202:    globally available symbol UNDEFINED.      o _m_delete -  There is now an LFUN mixed _m_delete(mixed index) to overload in -  your classes to imitate mappings. It gets invoked when m_delete -  is performed on your object. +  A class can now define a function mixed _m_delete(mixed index) to +  make the objects work like mappings with m_delete(). (This feature +  has been added to later 7.2 releases too.)    - o :: includes current class -  class X { -  int i; -  void create (int i) {X::i = i;} -  } + o sprintf("%O", foo) is more descriptive +  If foo is a program or an object then Pike will try to find the +  resolved name instead of returning just "program" or "object". +  However, if an object contains an _sprintf function it will still +  be called in this case.         New modules / classes / methods added:
226:    > h[3];    (2) Result: 19    -  +    o ADT.Relation.Binary    Handles binary relations. Hilfe example:    > object r=ADT.Relation.Binary("test");
250:    5    })    -  +    o Audio.Codec and Audio.Codec    Contains decoders and encoders for audio. Currently WAV and MP3.    Note: The API remains marked "unstable".
323:    1120    })    -  +    o Image.Fonts    High level API for font handling. Should be used instead of    accessing the Freetype, TTF and *FIXME* modules directly.
333:      o Image.SVG    + o Shuffler +    o Gmp.mpq and Gmp.mpf    Multi precision fractions.   
342:      o String.Replace, String.SingleReplace    + o Return value from catch blocks. +  The return value from catch blocks that exit normally has been +  changed from a normal zero (i.e. zero_type 0) to UNDEFINED (i.e. +  zero_type 1).    -  +    Optimizations:   --------------   
423:       Lookup of identifier "foo" in D():    -  D-+-B-+-foo Pike 7.3.23 --- Pike 7.3.32 +  D-+-B-+-foo (Pike 7.3.23 --- Pike 7.3.32)    | |    | +-A---foo    |
508:    Use the Makefile target lobotomize_crypto to lobotomize Pike.    Should preferably be executed in an unused tree straight from CVS.    +    C level/development changes:   ----------------------------   
527:      o Reworked trampolines to cause less circular references. (solves 1937)    -  +    (To browse bug tickets, either visit   http://community.roxen.com/crunch/ - or append the ticket id to   "http://bugs.roxen.com/" for an address directly to the ticket
537:   Uncategorized:   --------------    - o --with-new-multisets - o PIKE_RUN_UNLOCKED +    o Works with Autoconf 2.50   o Saved 8 bytes per object for objects not using their parent scope   o constant objects (Gmp.Bignum, Math.Matrix, Image.Color)
548:   o #pragma save_parent   o #pragma dont_save_parent (overrides constant __pragma_save_parent__)   o dont_dump_module - o modules can no longer call functions in other modules directly + o C modules can no longer call functions in other dynamic C modules directly   o it is possible to inherit pike programs from C programs.   o separate weak flags for indices and values in mappings   
574:   system.usleep/nanosleep   system.Memory (a class to read/write from mmap'ed or allocated memory)   SDL - Shuffler +