Re: Lua Ecosystem
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Lua Ecosystem
 
- From: Sean Conner <sean@...>
 
- Date: 2013年11月26日 15:07:25 -0500
 
It was thus said that the Great Rena once stated:
> On 2013年11月26日 2:28 PM, "Sean Conner" <sean@conman.org> wrote:
> >
> > I took a look, and there's still an issue. Take syslog for example (as
> > this is something I have looked into a bit more than the UUID libraries).
> > All the syslog modules do support a "log()" function. So far, so good.
> > But, one module uses:
> >
> > syslog.log(syslog.LOG_ERR,string.format("warning: x=%d",d))
> >
> > another one:
> >
> > syslog.log('LOG_ERR',string.format("warning: x=%d",d))
> >
> > And a third one:
> >
> > syslog.log('err',string.format("warning: x=%d",d))
> >
> > And a forth one:
> >
> > syslog.log('error',"warning: x=%d",d)
> 
> And all of them seem to be mostly mechanical translations of the underlying
> C function, and don't use a nice Lua-friendly API like:
> syslog.log.error("problem with %s", what)
 Well, the fourth one can also be written [1]:
	syslog('error',"warning: x=%d",d)
 Now, as to the difference between:
	syslog('error',"warning: x=%d",d)
and
	syslog.error("warning: x=%d",d)
is a matter of taste. I prefer the former, as it's actually less code (one
function vs. eight). The later seems popular with the OO crowd (in my
opinion). 
 -spc
[1]	https://github.com/spc476/lua-conmanorg/blob/master/src/syslog.c
- References:
- Lua Ecosystem, Dirk Laurie
 
- Re: Lua Ecosystem, Sean Conner
 
- Re: Lua Ecosystem, Michael Richter
 
- Re: Lua Ecosystem, Pierre Chapuis
 
- Re: Lua Ecosystem, Sean Conner
 
- Re: Lua Ecosystem, Pierre Chapuis
 
- Re: Lua Ecosystem, Sean Conner
 
- Re: Lua Ecosystem, Michal Kolodziejczyk
 
- Re: Lua Ecosystem, Sean Conner
 
- Re: Lua Ecosystem, Rena