[lltx] code style
Will Robertson
wspr81 at gmail.com
Wed May 19 13:58:25 CEST 2010
On 19/05/2010, at 7:29 PM, Arthur Reutenauer wrote:
>> local splitpath, expandpath = file.split_path, kpse.expand_path
>> local gsub, match, rpadd = string.gsub, string.match, string.rpadd
>
> It's not obfuscation, it's Hans' style :-) I'm not a big fan either,
> but I got used to it, reading ConTeXt's Lua source code.
Well, that's the whole point -- once you're used to it, it's fine :)
I don't have a huge objection to it and I can see how it's useful when you're re-using many many functions.
But it's just a bit inconsistent when you've got expandpath (=kpse.expand_path) but then go and use kpse.expand_var in the same file. And it adds an extra line of code to the beginning of the script.
Sorry to complain. I just haven't eaten yet and it's late :)
I'm perfectly happy to leave things as are. (Although I might judiciously edit once in a while.)
(P.S. Not that I'm one to talk about consistency or good code when you take a look inside fontspec.dtx!)
> I think I've seen it under Roberto's pen in _Programming in Lua_ but
> can't be sure.
I do seem to recall he mentions it, yes...
>> Also, four spaces for indenting? Again, is this standard?
>
> This is K&R, Will! I think they used four spaces for a single indent,
> and a eight-space tab for a double indent (and so on); I personally like
> it better than a full eight-space tab because you can have more levels
> of indentation ;-) At work we're even using two-space indents (well,
> I'm the only one respecting the house style so *I* use a two-space
> indent and I've come to like it best).
I didn't mean to imply that I preferred tabs; on the contrary.
I personally like 2-space-indenting, but mostly only from lots of TeX use, where command names get rather long.
In fact, I just wanted to clarify -- this is what we want to do, explicitly? :)
-- Will
More information about the lualatex-dev
mailing list