← Back to context

Comment by __ryan__

4 years ago

I've thought about this a lot. I considered "con" for constants. I don't hate it. It also works as a double entendre-- "con" in Spanish means "with". So the following code could be read as "with name equal to Brad".

  con name = 'Brad'

I can't help but feel that it's somewhat jarring though.

If I had my druthers, I think I would choose "var" and "def" to declare mutable and immutable variables, respectively.

  def PI = 3.1
  def degreesToRadians = degrees => degrees * (PI / 180)

  var degrees = 180
  var radians = degreesToRadians(degrees)

Edit: After thinking about it some more, I think I prefer "const" over "con", but "def" over both.

Spanish native here. I would never read it like that.

I have programmed in a couple languages where every single keyword was in Spanish: Logo and some flavours of Visual Basic.

Either everything is in English, or everything is in Spanish. There's no middle ground with mixed keywords.

'Var' and 'def' both sound good to me.

> It also works as a double entendre-- "con" in Spanish means "with".

Triple even! In French it's the equivalent of "cunt".

  • And in English, to go full circle, a con is what a con man pulls; a confidence trick.

    Hey BTW, is a JS "const" really constant, or can it (like in some other languages) be changed after all? Because if it can, then it isn't really const but more of a con...

    • > Hey BTW, is a JS "const" really constant, or can it (like in some other languages) be changed after all? Because if it can, then it isn't really const but more of a con...

      It's constant for things like numbers, but if you declare an array const, the only const things is the reference, the array can still mutate. con might be a good name for that.