===============================
Generated file name is too long
===============================

**Generated file name is too long**

There are use cases, when `Py++`_ generated file name is too long. In some cases
the code generation process even fails because of this.

This is just a symptom of the problem. This happens when you expose template
instantiated classes and you did not specify the class alias. `Py++`_ uses a class
alias as a basis for the file name.

Let me explain.

.. code-block:: C++

  template < class T>
  struct holder{ ... };

As you know, a class name in `Python`_ has few `constraints`_ and `Py++`_ is aware
of them. "holder< int >" is illegal class name, so `Py++`_ will generate another
one - "holder_less_int_greater\_". Pretty ugly and even long, but at least it is
legal one.

.. _`constraints` : http://www.python.org/doc/2.5.2/ref/identifiers.html

It is pretty simple to change the alias of the class, or any other declaration:

.. code-block:: Python

  from pyplusplus import module_builder

  mb = module_builder_t( ... )
  holder = mb.class_( 'holder< int >' )
  holder.alias = 'IntHolder'
  #the following line has same effect as the previous one:
  holder.rename( 'IntHolder' )

Another solution to the problem, is to use different strategy to split the generated
code to files. You can read more about splitting files `here`_.

.. _`here` : ./../split_module.html

.. _`Py++` : ./../pyplusplus.html
.. _`Boost.Python`: http://www.boost.org/libs/python/doc/index.html
.. _`Python`: http://www.python.org
.. _`GCC-XML`: http://www.gccxml.org
