[ 
https://issues.apache.org/jira/browse/THRIFT-4391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Rauschenbach updated THRIFT-4391:
---------------------------------------
    Description: 
The Lua library defines or clobbers 42 global variables, due to its lack of 
module encapsulation, making it an intrusive library that is atypically 
difficult to get working in my application context, and unnecessarily lowering 
its likelihood of working in other environments with diverse dependencies.

Ideally callers would access resources like this:

{code}
local TCompactProtocol = require 'Thrift'.TCompactProtocol
{code}

And the Thrift library would publish them like this:

{code}
-- Thrift.lua

local M = {}
M.ttype = function(obj) ...
M.terror = function(e) ...
M.version = 0.10
M.TType = ...
M.__TObject = ...
M.TProtocolBase = ...
M.TCompactProtocol = M.__TObject.new(M.TProtocolBase, {...
return M
{code}

The source codes should survive a check like this:

{code}
$ luacheck --std max+busted --codes src/lua test/lua --no-self --ignore 213 311 
611 631
{code}

Globals:

# __TClient
# __tobj_index
# __TObject
# __TProcessor
# base64_encode
# ch
# client
# CompactTypeToTType
# EscapeCharVals
# JSONCharTable
# JSONNode
# libluabitwise
# libluabpack
# liblualongnumber
# StringToTType
# TBinaryProtocol
# TBinaryProtocolFactory
# TBufferedTransport
# TCompactProtocol
# TCompactType
# terror
# TException
# TFramedTransport
# TFramedTransportFactory
# thrift_print_r
# THttpTransport
# THttpTransportFactory
# TJSONProtocol
# TMemoryBuffer
# TMessageType
# TProtocolBase
# TProtocolException
# TServer
# TSimpleServer
# ttable_size
# TTransportBase
# TTransportException
# TTransportFactoryBase
# ttype
# TType
# TTypeToCompactType
# TTypeToString
# version

  was:
The Lua library defines or clobbers 42 global variables, due to its lack of 
module encapsulation, making it an intrusive library that is atypically 
difficult to get working in my application context, and unnecessarily lowering 
its likelihood of working in other environments with diverse dependencies.

Ideally callers would access resources like this:

{code}
local TCompactProtocol = require 'Thrift'.TCompactProtocol
{code}

And the Thrift library would publish them like this:

{code}
-- Thrift.lua

local M = {}
M.ttype = function(obj) ...
M.terror = function(e) ...
M.version = 0.10
M.TType = ...
M.__TObject = ...
M.TProtocolBase = ...
M.TCompactProtocol = M.__TObject.new(M.TProtocolBase, {...
return M
{code}

The source codes should survive a check like this:

{code}
$ luacheck --std max+busted --codes src/lua test/lua --no-self --ignore 213 311 
611 631
{code}

Globals:

# __TClient
# __tobj_index
# __TObject
# __TProcessor
# base64_encode
# ch
# client
# CompactTypeToTType
# EscapeCharVals
# JSONCharTable
# JSONNode
# StringToTType
# TBinaryProtocol
# TBinaryProtocolFactory
# TBufferedTransport
# TCompactProtocol
# TCompactType
# terror
# TException
# TFramedTransport
# TFramedTransportFactory
# thrift_print_r
# THttpTransport
# THttpTransportFactory
# TJSONProtocol
# TMemoryBuffer
# TMessageType
# TProtocolBase
# TProtocolException
# TServer
# TSimpleServer
# ttable_size
# TTransportBase
# TTransportException
# TTransportFactoryBase
# ttype
# TType
# TTypeToCompactType
# TTypeToString
# version

        Summary: Lua library leaks 43 globals due to lack of module 
encapsulation  (was: Lua library leaks 42 globals due to lack of module 
encapsulation)

> Lua library leaks 43 globals due to lack of module encapsulation
> ----------------------------------------------------------------
>
>                 Key: THRIFT-4391
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4391
>             Project: Thrift
>          Issue Type: Bug
>          Components: Lua - Library
>    Affects Versions: 0.10.0
>            Reporter: David Rauschenbach
>
> The Lua library defines or clobbers 42 global variables, due to its lack of 
> module encapsulation, making it an intrusive library that is atypically 
> difficult to get working in my application context, and unnecessarily 
> lowering its likelihood of working in other environments with diverse 
> dependencies.
> Ideally callers would access resources like this:
> {code}
> local TCompactProtocol = require 'Thrift'.TCompactProtocol
> {code}
> And the Thrift library would publish them like this:
> {code}
> -- Thrift.lua
> local M = {}
> M.ttype = function(obj) ...
> M.terror = function(e) ...
> M.version = 0.10
> M.TType = ...
> M.__TObject = ...
> M.TProtocolBase = ...
> M.TCompactProtocol = M.__TObject.new(M.TProtocolBase, {...
> return M
> {code}
> The source codes should survive a check like this:
> {code}
> $ luacheck --std max+busted --codes src/lua test/lua --no-self --ignore 213 
> 311 611 631
> {code}
> Globals:
> # __TClient
> # __tobj_index
> # __TObject
> # __TProcessor
> # base64_encode
> # ch
> # client
> # CompactTypeToTType
> # EscapeCharVals
> # JSONCharTable
> # JSONNode
> # libluabitwise
> # libluabpack
> # liblualongnumber
> # StringToTType
> # TBinaryProtocol
> # TBinaryProtocolFactory
> # TBufferedTransport
> # TCompactProtocol
> # TCompactType
> # terror
> # TException
> # TFramedTransport
> # TFramedTransportFactory
> # thrift_print_r
> # THttpTransport
> # THttpTransportFactory
> # TJSONProtocol
> # TMemoryBuffer
> # TMessageType
> # TProtocolBase
> # TProtocolException
> # TServer
> # TSimpleServer
> # ttable_size
> # TTransportBase
> # TTransportException
> # TTransportFactoryBase
> # ttype
> # TType
> # TTypeToCompactType
> # TTypeToString
> # version



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to