Page 4 of 5

Re: If you were to create a programming language...

Posted: Tue Jul 01, 2014 6:09 pm
by baconhawka7x
Kingdaro wrote:I love Lua's simplicity, so I wouldn't really change anything about it. The only thing I truly want is assignment operators. This is annoying:

Code: Select all

self.longVariable = self.longVariable + 1
This is less annoying:

Code: Select all

self.longVariable += 1
I totally agree.

Re: If you were to create a programming language...

Posted: Tue Jul 01, 2014 8:09 pm
by sashwoopwoop
Kingdaro wrote:I love Lua's simplicity, so I wouldn't really change anything about it. The only thing I truly want is assignment operators. This is annoying:

Code: Select all

self.longVariable = self.longVariable + 1
This is less annoying:

Code: Select all

self.longVariable += 1
And zero-based table indizes. Please.

Re: If you were to create a programming language...

Posted: Tue Jul 01, 2014 10:47 pm
by Kingdaro
sashwoopwoop wrote:And zero-based table indizes. Please.
This I disagree with. I like the way Lua does it. Although unorthodox and not mindful of how memory management works, it's more humanistic and just makes more sense in general.

Re: If you were to create a programming language...

Posted: Wed Jul 02, 2014 4:15 am
by zorg
Kingdaro wrote:
sashwoopwoop wrote:And zero-based table indizes. Please.
This I disagree with. I like the way Lua does it. Although unorthodox and not mindful of how memory management works, it's more humanistic and just makes more sense in general.
Everytime i want to wrap something:

Code: Select all

i = ((i + 1 - 1) % N) + 1 -- or more concisely: i = ( i      % N) + 1
i = ((i - 1 - 1) % N) + 1 -- or:                i = ((i - 2) % N) + 1
1-based indices make it less clear just what the code does, contrast 0-based:

Code: Select all

i = (i + 1) % N
i = (i - 1) % N
i guess there are alternatives to this like "i = (i+1)<N and i+1 or 1" too, i just like not mixing too much logic into a plain math thing like modular arithmetic; to me, it's more clear what i'm trying to accomplish, and in some places, 1-based is indeed better; this must be like the 0^0 == 1 or 0 problem :3

Re: If you were to create a programming language...

Posted: Wed Jul 09, 2014 7:15 pm
by soulaymenc
Thank you for starting this awesome subject!

As a software, web and game developer, I would say that Lua is an awesome programming language, but have many weak points.
The programming language that I'm going to write for sure will look similar to lua, but much less dangerous. What's dangerous about Lua is that you might not know what you are manipulating. Variables could contain different kind of data and you need to make sure you are passing the right variables in the right parameters. I think that static typing in programming language is a feature. Lua syntax is very simple and comfortable. I would use pretty much same syntax but with different style since I'll be adding types, something like:

Code: Select all

let update = function( dt: Int )
   #Check objects
   for i, v in ipairs(objects) do
      if v.health == 0 then
          objects.remove v
      end
   end
end
I wrote a language which was kinda similar in C, but i fucked things up so I had to rewrite it, and I'm just being lazy :emo:

Re: If you were to create a programming language...

Posted: Thu Jul 10, 2014 5:26 am
by LuaWeaver
Lots of things are functions rather than built-in features to allow power and would have some nice syntactic sugar to hide this. For example, an if statement might look like this:

Code: Select all

if(blahblah == 'hi'){
	whatever
}
But 'if' is a function. For example, an 'equivalent' Lua thing would be like

Code: Select all

local function decide(cond,func)
	if cond then
		func()
	end
end
Obviously the raw if would have to be implemented in the host language, but you could then overwrite 'if' to do weird things if you want. Flexible. Dangerous. I like it.

Re: If you were to create a programming language...

Posted: Thu Jul 10, 2014 9:36 am
by Robin
If you use Church Booleans then the definition of "if" becomes something like:

Code: Select all

function ifelse(cond, thenpart, elsepart)
    return cond(thenpart, elsepart)
end

Re: If you were to create a programming language...

Posted: Thu Jul 10, 2014 9:44 am
by Plu
Obviously the raw if would have to be implemented in the host language, but you could then overwrite 'if' to do weird things if you want. Flexible. Dangerous. I like it.
I'm currently reading Practical LISP, and pretty much LISP does just that, where you can redefine the whole language if you want. And you're pretty much expected to.

It's weird, the more I read about old languages, the more I find they've plugged up most of the problems I have with modern languages.

Re: If you were to create a programming language...

Posted: Thu Jul 10, 2014 10:20 am
by murks
  1. Static types, no implicit variable declaration.
  2. Require local or global, no implicit scope at variable declaration time.
  3. No syntactic sugar (except maybe the comfortable increment operators Lua lacks)

Re: If you were to create a programming language...

Posted: Fri Jul 11, 2014 1:51 am
by LuaWeaver
Plu wrote:
Obviously the raw if would have to be implemented in the host language, but you could then overwrite 'if' to do weird things if you want. Flexible. Dangerous. I like it.
I'm currently reading Practical LISP, and pretty much LISP does just that, where you can redefine the whole language if you want. And you're pretty much expected to.

It's weird, the more I read about old languages, the more I find they've plugged up most of the problems I have with modern languages.
That's part of my inspiration for that; I just want a friendlier looking syntax. In Lisp, code and data are the same. However, I want code to look like code, not data, and Lisp doesn't solve that problem for me.