Language Design

Posted by Rusky on Feb. 21, 2011, 7:09 p.m.

So, before I begin, how can I update my submissions? Do I just resubmit them or is that not implemented (yet) in v3?

C is a relatively nice high-level assembly language. C++ is the kitchen sink sitting on top of that, so you can do lots of things with it but it can be painful. I'm sure this will be disputed, so I'll get to it in a minute. Java is a simplification of C++, but in some places it oversimplified like with "a.setFoo(a.getFoo() + 3)." Scala and C# move back toward C++, but they're both still on VMs and designed for high level applications.

That leaves us with few options for low-level and/or performance-sensitive projects like game engines, operating system kernels, embedded applications and almost anything else fun. Contemporary, well-supported, easily-accessible and well-enough designed languages include C, C++ and… well, anything else fails to meet our requirements.

It's obviously possible to write large projects in C (e.g. the Linux kernel) but it's not the best-designed of languages. All the little things like type conversions, declaration syntax, scope and namespaces and verbosity make C more painful than it could be. Then larger-scale issues like polymorphism (ad-hoc/inclusion and parametric), higher-level functions and type safety go out the window.

C++ almost had to be based on C to become popular, so it inherits a lot of its problems. In addition, it's just a big kitchen sink bolted on top, so it lacks the elegance of languages like Smalltalk that a lot of its ideas come from. Larger projects have to enforce restrictions on different allowed subsets of features (Google eliminates exceptions, RTTI and multiple inheritance in the interest of compatibility, less fragile code and consistency).

I would like to design a systems-level programming language that can be as efficient as C but can also be much more expressive and easy to use than C++. Rather than designing by committee to build a checklist of features, it would need to have a unifying idea, like Lisp, Smalltalk, Haskell or Go. The systems-level programming world needs something like that.

Rather than starting from C or C++, I'll start from scratch. The goal will be to use a small, easily-learned feature set that will allow a large range of simple, concise designs. Things like Lisp macros, Haskell type classes, Smalltalk/Objective-C message passing, etc. Haskell comes closer to this than Smalltalk, in that its type system is much stronger than C's (although it would need some tweaking to allow the required control over memory layout, etc.), but still allows all the uses of C++ virtual function calls, CLOS multimethods and OOP-style namespaces.

Anyone have any stories of things they'd have liked to be able to express in their favorite programming language but couldn't without resorting to verbosity, repetition or some ugly hack or other?

Comments

Juju 13 years, 9 months ago

Java, dude, Java's the future. Don't knock Perl either.

Ferret 13 years, 9 months ago

Unless Oracle makes you pay for Java in the future.

Castypher 13 years, 9 months ago

I actually agree that some of Java's commands are annoying.

System.out.println();

versus

cout

Which would you rather type if you were running short on time?

Rusky 13 years, 9 months ago

Oracle won't make you pay for Java, they'll just stop listening to people so everything that /almost/ made it into the next version won't. And we'll be stuck with decades-old technology while everyone else uses something else.

Also, cout is almost as bad. Try formatting any number in any way other than the default. :shudder:

Scott_AW 13 years, 9 months ago

How about plain English? That would be interesting. Like LOL code or whatever thats called.

Include would be like "Load file file.txt"

Rectangle would be like "Draw rectangle 32 wide and 16 tall, outlined red, filled in blue.

Rusky 13 years, 9 months ago

Ugh, let's not even go there. You'd either need some kind of natural language processing or Watson-like heuristics, which can make mistakes sometimes and are thus *not* a good idea, or a strict syntax which is misleading because you can't really just use "plain English" anymore.

Syntax-wise, I think the best idea is to just pick something simple and semi-established. As long as it's not painful to express things in your chosen syntax (like C declarations), it doesn't matter too much what it is exactly.

Scott_AW 13 years, 9 months ago

Wuss.

Misconstruct 13 years, 9 months ago

tl;dr?

Rusky 13 years, 9 months ago

tl;dr: C and C++, the biggest real options for low-level/performance sensitive projects, are not as nice to use as higher-level languages like C#, Lisp, Python, etc. I want to design a better low-level language.

Also nobody answered my question :<>

Misconstruct 13 years, 9 months ago

Dude I program my games in drag and drop, it's the newest and bestest programming language ever.