<commit_before>RFC 0005: Ability to define classes
========================================================================
$Id$

@authors: friebe
@created: Sun Nov 16 19:51:54 CET 2003
@status: draft
@category: language

Scope of Change
---------------
There will be a new method in the default classloader, called defineClass().

Rationale
---------
In situations where serialized objects are passed to another system some
of the classes might not be defined. There should be an ability to catch
these errors graceously and define classes as needed.

Functionality
-------------
The defineClass() method defines a class and returns a lang.XPClass object 
on success. On this object, one can invoke the method newInstance() to
instanciate an object of this class.

<?php
  $cl= &ClassLoader::getDefault();
  
  // Define the class
  try(); {
    $class= &$cl->defineClass('de.thekid.irc.IRCUser');
  } if(catch('ClassFormatError', $e)) {
    $e->printStackTrace();
    exit(-1);
  }
  
  // Instanciate it
  $instance= &$class->newInstance();
?>

Dependencies
------------
Changes to lang.ClassLoader

Related documents<commit_msg>- Change way in which fully qualified names are created - Pass second argument to defineClass() containing the class` sourcecode<commit_after>RFC 0005: Ability to define classes
========================================================================
$Id$

@authors: friebe
@created: Sun Nov 16 19:51:54 CET 2003
@status: draft
@category: language

Scope of Change
---------------
There will be a new method in the default classloader, called defineClass().

Rationale
---------
In situations where serialized objects are passed to another system some
of the classes might not be defined. There should be an ability to catch
these errors graceously and define classes as needed.

Functionality
-------------
The defineClass() method defines a class and returns a lang.XPClass object 
on success. On this object, one can invoke the method newInstance() to
instanciate an object of this class.

<?php
  $cl= &new ClassLoader('de.thekid.irc');
  
  // Define the class
  try(); {
    $class= &$cl->defineClass('IRCUser', $bytes);
  } if(catch('FormatException', $e)) {
    $e->printStackTrace();
    exit(-1);
  }
  
  // Instanciate it
  $instance= &$class->newInstance();
?>

Dependencies
------------
Changes to lang.ClassLoader

Related documents
{'fraction_non_alphanumeric': 0.1841109709962169, 'fraction_numerical': 0.014291719209751997, 'mean_word_length': 3.731610337972167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6153116', 'n_tokens_mistral': 669, 'n_tokens_neox': 620, 'n_words': 263}