Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luerl:init() fails on Erlang R15B03 (erts-5.9.3.1) #21

Closed
kotedo opened this issue Mar 6, 2013 · 4 comments
Closed

luerl:init() fails on Erlang R15B03 (erts-5.9.3.1) #21

kotedo opened this issue Mar 6, 2013 · 4 comments

Comments

@kotedo
Copy link

kotedo commented Mar 6, 2013

When I try to create a new state it crashes with this error message:

Eshell V5.9.3.1 (abort with ^G)
1> {ok, State} = luerl:init().
** exception error: no match of right hand side value
{luerl,{array,7,10,undefined,
{{table,{array,0,10,nil,10},
{{{{empty,<<"_G">>,
{tref,0},
empty,<<"_VERSION">>,<<"Lua 5.2">>,empty},
<<"assert">>,
{function,#Fun<luerl_basic.1.43970411>},
{empty,<<"collectgarbage">>,
{function,#Fun<luerl_basic.2.43970411>},
empty}},
<<"dofile">>,
{function,#Fun<luerl_basic.3.43970411>},
{{empty,<<"eprint">>,
{function,#Fun<luerl_basic.4.43970411>},
empty},
<<"error">>,
{function,#Fun<luerl_basic.0.43970411>},
{empty,<<"getmetatable">>,
{function,#Fun<luerl_basic.5.43970411>},
empty,<<"io">>,
{tref,2},
empty}}},
<<"ipairs">>,
{function,#Fun<luerl_basic.6.43970411>},
{{{empty,<<"load">>,
{function,#Fun<luerl_basic.7.43970411>},
empty},
<<"loadfile">>,
{function,#Fun<luerl_basic.8.43970411>},
{empty,<<"math">>,{tref,1},empty},
<<"next">>,
{function,#Fun<luerl_basic.9.43970411>},
{empty,<<"os">>,{tref,3},empty}},
<<"pairs">>,
{function,#Fun<luerl_basic.10.43970411>},
{{empty,<<"pcall">>,
{function,#Fun<luerl_basic.11.43970411>},
empty},
<<"print">>,
{function,#Fun<luerl_basic.12.43970411>},
{empty,<<"rawequal">>,
{function,#Fun<luerl_basic.13.43970411>},
empty}}},
<<"rawget">>,
{function,#Fun<luerl_basic.14.43970411>},
{{{empty,<<"rawlen">>,
{function,#Fun<luerl_basic.15.43970411>},
empty},
<<"rawset">>,
{function,#Fun<luerl_basic.16.43970411>},
{empty,<<"select">>,
{function,#Fun<luerl_basic.17.43970411>},
empty}},
<<"setmetatable">>,
{function,#Fun<luerl_basic.18.43970411>},
{{empty,<<"string">>,{tref,4},empty},
<<"table">>,
{tref,6},
{empty,<<"tonu"...>>,{...},...},
<<"tostring">>,
{function,...},
{...}}}},
nil},
{table,{array,0,10,nil,10},
{{{{empty,<<"abs">>,
{function,#Fun<luerl_math.2.36130362>},
empty},
<<"acos">>,
{function,#Fun<luerl_math.3.36130362>},
{empty,<<"asin">>,
{function,#Fun<luerl_math.4.36130362>},
empty}},
<<"atan">>,
{function,#Fun<luerl_math.5.36130362>},
{{empty,<<"atan2">>,
{function,#Fun<luerl_math.6.36130362>},
empty},
<<"ceil">>,
{function,#Fun<luerl_math.7.36130362>},
{empty,<<"cos">>,
{function,#Fun<luerl_math.8.36130362>},
empty}}},
<<"cosh">>,
{function,#Fun<luerl_math.9.36130362>},
{{{empty,<<"deg">>,
{function,#Fun<luerl_math.10.36130362>},
empty},
<<"exp">>,
{function,#Fun<luerl_math.11.36130362>},
{empty,<<"floor">>,
{function,#Fun<luerl_math.12.36130362>},
empty}},
<<"fmod">>,
{function,#Fun<luerl_math.13.36130362>},
{{empty,<<"frexp">>,
{function,#Fun<luerl_math.14.36130362>},
empty},
<<"huge">>,1.7976931348623157e308,
{empty,<<"ldexp">>,
{function,#Fun<luerl_math.15.36130362>},
empty}}},
<<"log">>,
{function,#Fun<luerl_math.16.36130362>},
{{{empty,<<"log10">>,
{function,#Fun<luerl_math.17.36130362>},
empty},
<<"max">>,
{function,#Fun<luerl_math.0.36130362>},
{empty,<<"min">>,
{function,#Fun<luerl_math.1.36130362>},
empty}},
<<"modf">>,
{function,#Fun<luerl_math.18.36130362>},
{{empty,<<"pi">>,3.141592653589793,empty},
<<"pow">>,
{function,#Fun<luerl_math.19.36130362>},
{empty,<<...>>,...}},
<<"random">>,
{function,#Fun<luerl_math.21.36130362>},
{{empty,<<...>>,...},<<"sin">>,{...},...}}},
nil},
{table,{array,0,10,nil,10},
{empty,<<"flush">>,
{function,#Fun<luerl_io.0.115329101>},
empty,<<"write">>,
{function,#Fun<luerl_io.1.115329101>},
empty},
nil},
{table,{array,0,10,nil,10},
{{empty,<<"clock">>,
{function,#Fun<luerl_os.0.53974525>},
empty},
<<"date">>,
{function,#Fun<luerl_os.1.53974525>},
{empty,<<"difftime">>,
{function,#Fun<luerl_os.2.53974525>},
empty},
<<"getenv">>,
{function,#Fun<luerl_os.3.53974525>},
{empty,<<"time">>,
{function,#Fun<luerl_os.4.53974525>},
empty}},
nil},
{table,{array,0,10,nil,10},
{{{empty,<<"byte">>,
{function,#Fun<luerl_string.0.115339544>},
empty},
<<"char">>,
{function,#Fun<luerl_string.1.115339544>},
{empty,<<"find">>,
{function,#Fun<luerl_string.2.115339544>},
empty}},
<<"format">>,
{function,#Fun<luerl_string.3.115339544>},
{{empty,<<"gmatch">>,
{function,#Fun<luerl_string.4.115339544>},
empty},
<<"gsub">>,
{function,#Fun<luerl_string.5.115339544>},
{empty,<<"len">>,
{function,#Fun<luerl_string.6.115339544>},
empty}},
<<"lower">>,
{function,#Fun<luerl_string.7.115339544>},
{{empty,<<"match">>,
{function,#Fun<luerl_string.8.115339544>},
empty},
<<"rep">>,
{function,#Fun<luerl_string.9.115339544>},
{empty,<<"reve"...>>,{...},...},
<<"sub">>,
{function,...},
{...}}},
nil},
{table,{array,0,10,nil,10},
{empty,<<"__index">>,{tref,4},empty},
nil},
{table,{array,0,10,nil,10},
{{empty,<<"concat">>,
{function,#Fun<luerl_table.0.123621961>},
empty},
<<"insert">>,
{function,#Fun<luerl_table.1.123621961>},
{empty,<<"pack">>,
{function,#Fun<luerl_table.2.123621961>},
empty},
<<"remove">>,
{function,#Fun<luerl_table.3.123621961>},
{empty,<<"sort">>,
{function,#Fun<luerl_table.4.123621961>},
empty,<<...>>,...}},
nil},
undefined,undefined,undefined}},
[],7,
{meta,nil,{tref,5},nil},
[{tref,0}],
false,#Ref<0.0.0.216>}
2>

Thoughts?

Thank you!
--Kai

P.S.> Sorry for the messy dump, but I think that's GitHub ...

@rvirding
Copy link
Owner

rvirding commented Mar 6, 2013

The reason is because luerl:init() just returns the state not wrapped with a {ok,...}. So you should call it like

State = luerl:init(),

It maybe should wrap the result but now it just crashes on an error so I thought it wasn't necessary. The messy dump is github.

There is a relatively newly formed google group which might be easier to use if you want to discuss matters, https://groups.google.com/forum/?hl=en&fromgroups#!forum/luerl

Robert

@kotedo
Copy link
Author

kotedo commented Mar 6, 2013

Hi Robert,

Yes, I noticed that the State is returned just as the State after I
submitted the ticket.

But, the issue remains. I don't get luerl's State, even if I try to run it
as it is in the docs.

Eshell V5.9.3.1 (abort with ^G)
1> State = luerl:init().
{luerl,{array,7,10,undefined,
{{table,{array,0,10,nil,10},
{{{{empty,<<"_G">>,
{tref,0},
empty,<<"_VERSION">>,<<"Lua 5.2">>,empty},
<<"assert">>,
{function,#Fun<luerl_basic.1.43970411>},
{empty,<<"collectgarbage">>,
{function,#Fun<luerl_basic.2.43970411>},
empty}},
<<"dofile">>,
{function,#Fun<luerl_basic.3.43970411>},
{{empty,<<"eprint">>,
{function,#Fun<luerl_basic.4.43970411>},
empty},
<<"error">>,
{function,#Fun<luerl_basic.0.43970411>},
{empty,<<"getmetatable">>,
{function,#Fun<luerl_basic.5.43970411>},
empty,<<"io">>,
{tref,2},
empty}}},
<<"ipairs">>,
{function,#Fun<luerl_basic.6.43970411>},
{{{empty,<<"load">>,
{function,#Fun<luerl_basic.7.43970411>},
empty},
<<"loadfile">>,
{function,#Fun<luerl_basic.8.43970411>},
{empty,<<"math">>,{tref,1},empty},
<<"next">>,
{function,#Fun<luerl_basic.9.43970411>},
{empty,<<"os">>,{tref,3},empty}},
<<"pairs">>,
{function,#Fun<luerl_basic.10.43970411>},
{{empty,<<"pcall">>,
{function,#Fun<luerl_basic.11.43970411>},
empty},
<<"print">>,
{function,#Fun<luerl_basic.12.43970411>},
{empty,<<"rawequal">>,
{function,#Fun<luerl_basic.13.43970411>},
empty}}},
<<"rawget">>,
{function,#Fun<luerl_basic.14.43970411>},
{{{empty,<<"rawlen">>,
{function,#Fun<luerl_basic.15.43970411>},
empty},
<<"rawset">>,
{function,#Fun<luerl_basic.16.43970411>},
{empty,<<"select">>,
{function,#Fun<luerl_basic.17.43970411>},
empty}},
<<"setmetatable">>,
{function,#Fun<luerl_basic.18.43970411>},
{{empty,<<"string">>,{tref,4},empty},
<<"table">>,
{tref,6},
{empty,<<"tonu"...>>,{...},...},
<<"tostring">>,
{function,...},
{...}}}},
nil},
{table,{array,0,10,nil,10},
{{{{empty,<<"abs">>,
{function,#Fun<luerl_math.2.36130362>},
empty},
<<"acos">>,
{function,#Fun<luerl_math.3.36130362>},
{empty,<<"asin">>,
{function,#Fun<luerl_math.4.36130362>},
empty}},
<<"atan">>,
{function,#Fun<luerl_math.5.36130362>},
{{empty,<<"atan2">>,
{function,#Fun<luerl_math.6.36130362>},
empty},
<<"ceil">>,
{function,#Fun<luerl_math.7.36130362>},
{empty,<<"cos">>,
{function,#Fun<luerl_math.8.36130362>},
empty}}},
<<"cosh">>,
{function,#Fun<luerl_math.9.36130362>},
{{{empty,<<"deg">>,
{function,#Fun<luerl_math.10.36130362>},
empty},
<<"exp">>,
{function,#Fun<luerl_math.11.36130362>},
{empty,<<"floor">>,
{function,#Fun<luerl_math.12.36130362>},
empty}},
<<"fmod">>,
{function,#Fun<luerl_math.13.36130362>},
{{empty,<<"frexp">>,
{function,#Fun<luerl_math.14.36130362>},
empty},
<<"huge">>,1.7976931348623157e308,
{empty,<<"ldexp">>,
{function,#Fun<luerl_math.15.36130362>},
empty}}},
<<"log">>,
{function,#Fun<luerl_math.16.36130362>},
{{{empty,<<"log10">>,
{function,#Fun<luerl_math.17.36130362>},
empty},
<<"max">>,
{function,#Fun<luerl_math.0.36130362>},
{empty,<<"min">>,
{function,#Fun<luerl_math.1.36130362>},
empty}},
<<"modf">>,
{function,#Fun<luerl_math.18.36130362>},
{{empty,<<"pi">>,3.141592653589793,empty},
<<"pow">>,
{function,#Fun<luerl_math.19.36130362>},
{empty,<<...>>,...}},
<<"random">>,
{function,#Fun<luerl_math.21.36130362>},
{{empty,<<...>>,...},<<"sin">>,{...},...}}},
nil},
{table,{array,0,10,nil,10},
{empty,<<"flush">>,
{function,#Fun<luerl_io.0.115329101>},
empty,<<"write">>,
{function,#Fun<luerl_io.1.115329101>},
empty},
nil},
{table,{array,0,10,nil,10},
{{empty,<<"clock">>,
{function,#Fun<luerl_os.0.53974525>},
empty},
<<"date">>,
{function,#Fun<luerl_os.1.53974525>},
{empty,<<"difftime">>,
{function,#Fun<luerl_os.2.53974525>},
empty},
<<"getenv">>,
{function,#Fun<luerl_os.3.53974525>},
{empty,<<"time">>,
{function,#Fun<luerl_os.4.53974525>},
empty}},
nil},
{table,{array,0,10,nil,10},
{{{empty,<<"byte">>,
{function,#Fun<luerl_string.0.115339544>},
empty},
<<"char">>,
{function,#Fun<luerl_string.1.115339544>},
{empty,<<"find">>,
{function,#Fun<luerl_string.2.115339544>},
empty}},
<<"format">>,
{function,#Fun<luerl_string.3.115339544>},
{{empty,<<"gmatch">>,
{function,#Fun<luerl_string.4.115339544>},
empty},
<<"gsub">>,
{function,#Fun<luerl_string.5.115339544>},
{empty,<<"len">>,
{function,#Fun<luerl_string.6.115339544>},
empty}},
<<"lower">>,
{function,#Fun<luerl_string.7.115339544>},
{{empty,<<"match">>,
{function,#Fun<luerl_string.8.115339544>},
empty},
<<"rep">>,
{function,#Fun<luerl_string.9.115339544>},
{empty,<<"reve"...>>,{...},...},
<<"sub">>,
{function,...},
{...}}},
nil},
{table,{array,0,10,nil,10},
{empty,<<"__index">>,{tref,4},empty},
nil},
{table,{array,0,10,nil,10},
{{empty,<<"concat">>,
{function,#Fun<luerl_table.0.123621961>},
empty},
<<"insert">>,
{function,#Fun<luerl_table.1.123621961>},
{empty,<<"pack">>,
{function,#Fun<luerl_table.2.123621961>},
empty},
<<"remove">>,
{function,#Fun<luerl_table.3.123621961>},
{empty,<<"sort">>,
{function,#Fun<luerl_table.4.123621961>},
empty,<<...>>,...}},
nil},
undefined,undefined,undefined}},
[],7,
{meta,nil,{tref,5},nil},
[{tref,0}],
false,#Ref<0.0.0.222>}
2>

P.S.: I am the "other" guy from you-know-who who'd like to invite you to
you-know-who, San Francisco, after the conference. :)

--Kai

On Tue, Mar 5, 2013 at 8:47 PM, Robert Virding notifications@github.comwrote:

The reason is because luerl:init() just returns the state not wrapped
with a {ok,...}. So you should call it like

State = luerl:init(),

It maybe should wrap the result but now it just crashes on an error so I
thought it wasn't necessary. The messy dump is github.

There is a relatively newly formed google group which might be easier to
use if you want to discuss matters,
https://groups.google.com/forum/?hl=en&fromgroups#!forum/luerl

Robert


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-14479580
.

@rvirding
Copy link
Owner

rvirding commented Mar 6, 2013

That IS luerl's state. It is a record with the following definition:

-record(luerl, {tabs,free,next,                 %Table structure
                meta=[],                        %Data type metatables
                env,                            %Environment
                locf=false,                     %Started local function
                tag                             %Unique tag
               }).

The new-engine, which is soon to be released, has a bigger state with fields especially for global stack frames. These are now kept as tables.

I will come by after the conference and talk languages.

@kotedo
Copy link
Author

kotedo commented Mar 6, 2013

Fantastic, I guess the amount of "empty" in the State were a bit confusing.
But, all is good as long as it works.

--Kai

P.S.> Good to hear that you can make it! That is fantastic news!

@kotedo kotedo closed this as completed Mar 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants