rvirding / luerl

Lua in Erlang
Apache License 2.0
1.03k stars 141 forks source link

New vs Old Interface #158

Closed samaaron closed 1 year ago

samaaron commented 1 year ago

Hi there

Would it be possible to point me towards the difference between the new and 'old' interface APIs. From the wiki, they seem similar from a user perspective:

I'm assuming it's something like different internal VM state representations.

It would be really useful to know which version is best to use for new projects. For example, is the new version experimental or is it the next iteration of the API and you're keeping the old version for backwards compatibility.

Once I've figured out the differences I'd be happy to have a go at writing some motivation at the top of each wiki page to help others would might be similarly curious.

Apologies if this isn't the best place to ask a question - happy to be directed to a more appropriate location. (I did try joining the slack but the signup app doesn't seem to work at the moment - http://luerl-slack.herokuapp.com).

rvirding commented 1 year ago

No, there is absolutely no difference in the internal state between the 'old' and 'new' interfaces! So you can quite happily mix using the old and new interfaces.

The reason I did a new interface is just just that I think it is a better interface. The function names are more logical and the return values are better and more usable. So my plan is in v2 (when it comes out) to rename the new interface in the module luerl_new to luerl and become the standard and rename the current luerl module to luerl_old. Hopefully this would make it easy to convert programs using the current interface to using it in the future.

That's my plan anyway.

EDIT: You can actually already do this as the luerl_old.erl module already exists.

samaaron commented 1 year ago

Thanks Robert, this makes a lot of sense. I'll focus on playing with the new interface :-)