3

I'm in the process of creating a grammar for a scripting language but as I'm working on it I started to wonder what makes a language good in the first place. I know the goals for my script but there are always 1000 different ways to go about doing things.

Goals:

  • Easy to use and understand (not my grandma could do it easy, but the secretary at the front desk could do it or the VP of marketing could do it type of easy)
  • No user defined functions or subroutines.
  • Its use would be in events of objects in a system similar to HyperCard.

Conceptually I was thinking of a language like this:

set myVariable to 'Hello World'
set counter to 0
repeat 5 times with x
begin
    set counter to counter add x
end
set myVariable to myVariable plus ' ' plus counter
popup myVariable

set text of label named 'label' to 'new text'
set color of label named 'label' to blue

The end result would popup a dialog with the contents Hello World 15 it would also change the text of a label and make it blue.

But I could do the same thing 1000 different ways. So what makes one language any better than another when both are designed for the same goals?

Justin808
  • 139

3 Answers3

2

There's no right answer here. Different languages are designed for different things and different styles of programming. This is clear from the design principles of even popular languages. From the Zen of Python:

There should be one-- and preferably only one --obvious way to do it.

Perl was designed using the opposite principle:

There's more than one way to do it

Neither one of these languages did it "right". Some people prefer one style over the other, but it ultimately comes down to stylistic preferences and the goals of the language.

jncraton
  • 121
1

Unless you are an experienced language designer, it might be better to take an existing programming language that has already proven itself useable, useful, and/or perhaps even popular, among some similar target audience, and prune that language's syntax to meet your needs.

hotpaw2
  • 7,988
0

the only thing that matters for a language is that is solves the problem it was designed to solve. what makes a language better than another is that is solves the problem better. In your case it looks like you are stuck on how much like written English should the language be, you could try writing something like in your question several ways you think are pretty good and asking someone which they like the best (preferably someone who is intended to use the language if they exist). if you pick something and stay consistent and try to avoid creating special cases whatever you decide will work quite well.

Ryathal
  • 13,486
  • 1
  • 36
  • 48