[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A major problem with the Lua ecosystem
- From: Sean Conner <sean@...>
- Date: Thu, 1 Feb 2018 18:11:50 -0500
It was thus said that the Great Sean Conner once stated:
> So I created a subdirectory "6CC24CA3-0D40-550D-9B0F-EF54C94C54C1"
> and in there, I have "syslog.so". In the C file, I had to name the main
> function
>
> int luaopen_6CC24CA3_0D40_550D_9B0F_EF54C94C54C1_syslog(lua_State *L)
> { ... }
>
> because the '-' isn't a valid in a C identifier. But when I tried:
>
> local syslog = require "6CC24CA3-0D40-550D-9B0F-EF54C94C54C1.syslog"
>
> I get:
>
> lua-53: error loading module '6CC24CA3-0D40-550D-9B0F-EF54C94C54C1.syslog' from file './6CC24CA3-0D40-550D-9B0F-EF54C94C54C1/syslog.so':
> ./6CC24CA3-0D40-550D-9B0F-EF54C94C54C1/syslog.so: undefined symbol: luaopen_0D40-550D-9B0F-EF54C94C54C1_syslog
I should also note that a pure Lua module will have no such restriction.
So it's possible to have this:
local syslog = require "6CC24CA3_0D40_550D_9B0F_EF54C94C54C1.syslog"
local xdg = require "13DC8997-46AB-54E2-9BC4-10C88CFAC5D4.xdg"
syslog("debug","this is here")
syslog('debug',"desktop=%s",xdg.DESKTOP_DIR)
where you have two styles of UUID. Oh, and heaven forbid someone attempt to
do:
local syslog = require "6cc24ca3_0d40_550d_9b0f_ef54c94c54c1.syslog"
local xdg = require "13dc8997-46ab-54e2-9bc4-10c88cfac5d4.xdg"
syslog("debug","this is here")
syslog('debug',"desktop=%s",xdg.DESKTOP_DIR)
On some systems (with case-insensative filenames) this will work ... on
some, it won't ... good times.
-spc (For the record, I don't think using UUIDs as a namespace is a good
idea ... )