Commit graph

188 commits

Author SHA1 Message Date
kyren 80a98ef29c Couple of changes:
- Update readme, changelog, cargo version number in preparation for release
- Remove panicking behavior on recursive callback calls, add additional error
  variant for recursive callback errors.
2017-12-04 01:47:04 -05:00
kyren cfa2b34a7b Bump version to 0.9.7, update changelog 2017-11-08 14:07:48 -05:00
kyren 00a3153ae0 Bump version / changelog for 0.9.6 2017-10-26 16:53:14 -04:00
kyren 8592af1b16 Bump version to 0.9.5, update changelog 2017-10-25 14:55:05 -04:00
kyren 4bbeeb2b2d Update to 0.9.4, update changelog 2017-10-24 08:59:55 -04:00
kyren 401c06cfe6 Bump cargo version to 0.9.3, update changelog. 2017-10-14 19:27:24 -04:00
kyren ef538d8757 Update rlua to 0.9.2, add SOME kind of changelog. 2017-09-24 19:32:26 -04:00
kyren ec088300f2 Specify gcc crate dependency with minimum bound on version with Build 2017-09-09 21:04:57 -04:00
kyren 1efef92570 I guess I need to bump the cargo version even to change the badge. 2017-08-02 17:43:44 -04:00
kyren fffeb9701b Badge has wrong url, I guess it doesn't expect the github portion 2017-08-02 17:42:58 -04:00
kyren b42d613c5b Update Cargo.toml for 0.9, add travis-ci badge 2017-08-02 17:37:29 -04:00
kyren 2553623b65 Provide custom allocators that ensure that OOM results in an abort
(closes unsafety hole)
2017-08-02 16:33:48 -04:00
Jonas Schievink 3f20319a84 Use rustyline for the REPL
This makes the REPL more usable as you can now edit lines and recall
previously executed statements.
2017-08-02 14:32:45 +02:00
kyren 4549abbb85 Two major API changes to start with:
* Callbacks have generic argument and return types
* All variadics are done with tuples
2017-07-31 01:21:41 -04:00
kyren eafe4c7c30 cargo version bump for linking fix 2017-07-09 17:20:51 -04:00
kyren b8fab1b3ed Make the builtin version of lua 5.3 optional
In case you would need to build a crazy custom version of lua for a weird
platform.  This could possibly be done in a cleaner way.
2017-07-05 19:35:53 -04:00
kyren cd4343c83e Bump cargo version (again! I'm sorry!), and update README 2017-06-25 18:27:52 -04:00
kyren 8548fbd263 Bump cargo version to 0.7.0
I'm not 100% sold on the LuaError design, I think there are a lot of questions
still, but there have been enough bugfixes that it's better to do a cargo bump.
2017-06-25 02:41:02 -04:00
kyren 47db72cac4 Big API incompatible error change, remove dependency on error_chain
The current situation with error_chain is less than ideal, and there are lots of
conflicting interests that are impossible to meet at once.  Here is an
unorganized brain dump of the current situation, stay awhile and listen!

This change was triggered ultimately by the desire to make LuaError implement
Clone, and this is currently impossible with error_chain.  LuaError must
implement Clone to be a proper lua citizen that can live as userdata within a
lua runtime, because there is no way to limit what the lua runtime can do with a
received error.  Currently, this is solved by there being a rule that the error
will "expire" if the error is passed back into rust, and this is very
sub-optimal.  In fact, one could easily imagine a scenario where lua is for
example memoizing some function, and if the function has ever errored in the
past the function should continue returning the same error, and this situation
immediately fails with this restriciton in place.

Additionally, there are other more minor problems with error_chain which make
the API less good than it could be, or limit how we can use error_chain.  This
change has already solved a small bug in a Chucklefish project, where the
conversion from an external error type (Borrow[Mut]Error) was allowed but not
intended for user code, and was accidentally used.  Additionally, pattern
matching on error_chain errors, which should be common when dealing with Lua, is
less convenient than a hand rolled error type.

So, if we decide not to use error_chain, we now have a new set of problems if we
decide interoperability with error_chain is important.  The first problem we run
into is that there are two natural bounds for wrapped errors that we would
pick, (Error + Send + Sync), or just Error, and neither of them will
interoperate well with error_chain.  (Error + Send + Sync) means we can't wrap
error chain errors into LuaError::ExternalError (they're missing the Sync
bound), and having the bounds be just Error means the opposite, that we can't
hold a LuaError inside an error_chain error.

We could just decide that interoperability with error_chain is the most
important qualification, and pick (Error + Send), but this causes a DIFFERENT
set of problems.  The rust ecosystem has the two primary error bounds as Error
or (Error + Send + Sync), and there are Into impls from &str / String to
Box<Error + Send + Sync> for example, but NOT (Error + Send).  This means that
we are forced to manually recreate the conversions from &str / String to
LuaError rather than relying on a single Into<Box<Error + Send + Sync>> bound,
but this means that string conversions have a different set of methods than
other error types for external error conversion.  I have not been able to figure
out an API that I am happy with that uses the (Error + Send) bound.  Box<Error>
is obnoxious because not having errors implement Send causes needless problems
in a multithreaded context, so that leaves (Error + Send + Sync).  This is
actually a completely reasonable bound for external errors, and has the nice
String Into impls that we would want, the ONLY problem is that it is a pain to
interoperate with the current version of error_chain.

It would be nice to be able to specify the traits that an error generated by the
error_chain macro would implement, and this is apparently in progress in the
error_chain library.  This would solve both the problem with not being able to
implement Clone and the problems with (Error + Send) bounds.  I am not convinced
that this library should go back to using error_chain when that functionality is
in stable error_chain though, because of the other minor usability problems with
using error_chain.

In that theoretical situation, the downside of NOT using error_chain is simply
that there would not be automatic stacktraces of LuaError.  This is not a huge
problem, because stack traces of lua errors are not extremely useful, and for
external errors it is not too hard to create a different version of the
LuaExternalResult / LuaExternalError traits and do conversion from an
error_chain type into a type that will print the stacktrace on display, or
use downcasting in the error causes.

So in summary, this library is no longer using error_chain, and probably will
not use it again in the future.  Currently this means that to interoperate with
error_chain, you should use error_chain 0.8.1, which derives Sync on errors, or
wait for a version that supports user defined trait derives.  In the future
when error_chain supports user defined trait derives, users may have to take an
extra step to make wrapped external errors print the stacktrace that they
capture.

This change works, but is not entirely complete.  There is no error
documentation yet, and the change brought to a head an ugly module organization
problem.  There will be more commits for documentation and reorganization, then
a new stable version of rlua.
2017-06-24 18:11:56 -04:00
kyren 7b7f7f36fc Bump cargo version, bugfix for numeric conversions.
This could arguably be a semver update, but the previous behavior was definitely
not intentional, it was a bug.
2017-06-23 03:28:43 -04:00
kyren f92e21d5cb Bump cargo version to 0.6.0 2017-06-20 18:13:40 -05:00
kyren 64d1eae55c New 0.5.x cargo update with important coroutine bugfix, build changes 2017-06-17 23:23:17 -04:00
kyren 44370dd64e bump cargo version, nice addition of Result conversion 2017-06-15 16:28:12 -04:00
kyren 8440298e71 Go ahead and release 0.5.0
partially for the selfish reason that my submodule setup does not deal well with
ureleased versions of cargo libs where the version number ends with -pre
2017-06-11 01:33:08 -04:00
kyren 5c8aa19b8d Two major API changes:
Allow load to return values, allows reimplementing require() like functions
properly.

Make globals table explicit in Lua, remove Lua::get / Lua::set in favor of
Lua::globals.  Allows obeying globals metatable, using other Table functions on
the globals table.

Also added "has" method as shorthand for checking whether a table entry is not
nil.
2017-06-11 01:12:25 -04:00
kyren 1c0b1014ee Improve performance of create_table / create_array_table 2017-06-05 01:46:45 -04:00
kyren 9aed99e3e3 atpanic function was not a good idea, it's not sound
It crosses the C api boundary, the only proper way to panic would be to actually
error guard everywhere, aborting is fine.
2017-06-05 01:05:41 -04:00
kyren b3218137e1 Somewhat smarter strategy for error_guard calls, less ungodly slow.
Also add raw_length table function
2017-06-05 00:41:48 -04:00
kyren e4052bb4d4 Bump cargo.toml version number 2017-06-05 00:06:15 -04:00
kyren bd7ee783e3 fix links, again 2017-05-29 16:34:39 -04:00
kyren ab3f75a90d bump cargo version 2017-05-29 16:33:54 -04:00
kyren 4deb90c1ef Update README / Cargo.toml to point to docs.rs API docs 2017-05-29 16:28:29 -04:00
kyren 9c4029c04c bump cargo version 2017-05-26 23:49:49 -04:00
kyren e73346bc0f version bump 2017-05-25 00:58:28 -04:00
kyren 5c0f183a52 Improved error handling and formatting
Now prints lua backtraces on callback errors as well.  This could be
controlled with LUA_BACKTRACE or just RUST_BACKTRACE or similar.
2017-05-22 14:25:36 -04:00
kyren b15ee9053e Update to use hlist_macro for hlist macros.
You will type hlist! hlist_pat! and HList! so often that every character
counts.  Apologize for the API churn in the README.
2017-05-22 11:16:34 -04:00
kyren ccc83767ec Updates to Cargo.toml metadata 2017-05-22 03:06:33 -04:00
kyren 065c69894a Initial import 2017-05-21 19:50:59 -04:00