Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


the switch to camelCase #114

chjj opened this Issue · 5 comments

4 participants


Why the switch? I thought the API looked rather nice with underscores. When I first saw luvit, I was really happy that it wasn't forced (by javascript) to use camel case like node was. Now with the variable names everywhere that aren't camelcase, they end up creating an inconsistent style. It is more true to node to use camelcase, but I think it would be easy for anyone who knows the node API to think in underscores instead of camelcase when using luvit.


It was agreed upon in the mailing list and IRC so I don't think we will be going back.

Current convention is:

  • UpperCamel for 'classes'
  • camelCase for methods.
  • UPPER_SNAKE for constants
  • snaked_vars for variables.

The snaked_vars is disputable, so feel free to patch the underscore variable names to use camel case. If we were to follow lua conventions though, which we could, they don't use anything to distinguish words within a name (which I actually quite like).

Quick comparison:


local http = require('http')
local HTTP_HOST = ''
local http_server = http.createServer(80, HTTP_HOST, function (req, res)


local http = require('http')
local HTTPHOST = ''
local httpserver = http.createserver(80, HTTPHOST, function (req, res)

That's really a shame. I was looking forward to a platform where I wasn't forced to use java-reminiscent variable names. I would take anything over camelcase (and uppercamel/titlecase).

I beg everyone to reconsider.


@chjj I really don't care if it's camelCase or under_score. I do want consistency and to use what offends the fewest people. I'm fully aware that programmers don't all agree on style because it really doesn't matter. It's a matter of what's familiar in 99% of the cases (which is a valid and important concern, but hard to change/fix).

The reason I went with the change to javascript style casing is so that the code looks more like node code. Lua is already pretty close and I can see many places where luvit and node will both be used at the same company. Having the same api names will help prevent confusion I hope.

@tim-smart Thanks for writing down your understanding of the conventions. I'm not sure where the miscommunication came from, but I don't want under_score for variables. Lua-core style alllowercase or js style camelCase is better I think and fits with the rest of the API better. As far as constants, I still don't have anything I like in either nodejs or luvit. I think ALLUPPERCASE is my favorite though.


Also, if you want to bring this up on the mailing list, there is still time. There hasn't been a release with the new API yet. The latest official release was 0.1.5 (over 200 commits ago) and it was a under_score based API. I do hope to get the 0.2.0 release out soon, the core API refactor is almost complete.


The API change has been made. Closing.

@philips philips closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.