Fixed for VC6.5.
[luabind.git] / doc / changes.txt
blob5b5eb6e4bd38910172bef0e3568b9daaa0d37c62
1 LUABIND BETA 7 changes
2 ======================
4 We have introduced a change that may break current code,
5 nothing will break silently however.
7 The change is that the previous way of writing virtual class
8 wrappers was to have it contain an object that refered to
9 the actual lua object. This would cause a dependency cycle
10 and result in the object never being garbage collected until
11 the whole lua state was closed. The new way is to use a newly
12 introduced type called weak_ref, instead of the object.
13 See docs for more info.
16 Changes from beta6
17 ------------------
19 * renamed get_globals() and get_registry() to globals()
20   and registry()
21 * rewrote object and made a few changes:
23   * moved iterators out of the class and removed
24     begin/end/raw_begin/raw_end/array_begin/array_end.
25     See updated docs for how to use the iterators.
26   * removed array_iterator alltogether
27   * renamed pushvalue() to push()
28   * removed set()
29   * replaced the constructor that creates an object from
30     a stack value (with better syntax)
31   * moved out the member functions type(), at() and raw_at()
32     and made them free functions. (type(), gettable(), settable(),
33     rawget() and rawset())
34   * renamed lua_state() to interpreter()
35   * object now supports nested indexing (with []-operator) as
36     well as function calls directly on indexed values (i.e.
37     globals(L)["my_fun"](10)). The indexing has also been made
38     more efficient through the use of expression templates.
40 * removed functor (use object with call_function() instead)
42 * using boost-build, and has better support for building
43   as a dll. The makefiles still works.
44 * removed the option LUABIND_DONT_COPY_STRING, this means
45   that luabind will not provide storage for name strings.
46   i.e. the strings sent to module, namespace_ and class_
47   are expected to have global storage (it's no problem as
48   long as you use string constants)
51 wrappers
52 ........
54 Wrapper classes now have to derive from wrap_base and they don't have
55 to contain any references to the lua-part (this is done by the base
56 class now). The overload of call_member() that previuosly took a
57 weak_ref as first parameter is now a member function of the wrap_base
58 class and no longer takes the self reference argument. Example:
60 struct A
62     virtual ~A() {}
63     virtual std::string f() { return "A:f()"; }
66 struct A_wrap : A, wrap_base
68     virtual std::string f()
69     {
70         return call_member<std::string>("f");
71     }
73     static std::string default_f(A* p)
74     {
75         return p->A::f();
76     }
79 The changes when registering the virtual functions is that you now
80 have to register both the virtual function _and_ the default
81 implementation of the function (for static dispatch). Like this:
83 module(L)
85     class_<A, A_wrap>("A")
86         .def(constructor<>())
87         .def("f", &A::f, &A_wrap::default_f)
90 If you update your luabind version without changing the way you register
91 virtual functions, it will still compile, but may give you runtime
92 errors.
94 With these changes adopt will work as expected on wrapped types (the
95 weak reference will be transformed into a strong reference internally).
97 These changes will also make dynamic function dispatch work from within
98 lua (and not just from c++ into lua).
101 policy placeholders
102 ...................
104 luabind now handles member functions in a more general way.
105 The self reference that is passed as first parameter to
106 member functions is now refered to using the _1 placeholder
107 (instead of self). This means that the first argument to a
108 member function is refered to with _2.
111 additions
112 .........
114 * added __newindex metatable entry on c++ classes
115 * moved more code into cpp-files (hopefully reduces user
116   compile time slightly)
117 * the iterators are now true models of ForwardIterator
118 * error messages when writing non-matching type to a property
119   or attribute.
120 * support for inner scopes
121 * support for nil to holder_type conversion
122 * wrappers for lua_resume() with the same syntax as
123   call_function() (resume_function() and resume())
126 bugfixes
127 ........
129 * bugs in the overload resolution could give internal errors
130   in some cases.
131 * def_readonly and def_readwrite will now return references
132   if the type is not a primitive type. This will allow
133   chained . operators.
134 * object_cast() of uninitialized objects works
135 * supports strings with extra nulls in them (not for member
136   names though)
137 * fixed reference leakage by reducing the amount of explicit
138   resource management.
139 * fixed bug where matchers for getters and setters did not
140   propagate to derived classes.
141 * fixed leak when using class wrappers. They had a reference
142   cycle that wouldn't get collected (until the lua_State was
143   closed).
144 * lots of other fixes we can't remember