PDA

View Full Version : Ideal PL


sans-hubris
09-11-2002, 09:00 PM
I would like to know what people would consider necessary for the ideal programming language.

Obviously, it would have lexicals, looping constructs, closures, etc., but what else?

Would it be object oriented? Would you be able to switch between procedural and functional programming models (which is something I would like)? Would it allow for nested closures?

I think it would be neat to give it the ability to setup a Prolog database, and use some Prolog logic in certain places where appropriate.

Would it be strongly typed, weakly typed, or some strange mixture of both? Would it have support for dynamic typing?

Basically, what do you think the ideal programming language would do?

GnuVince
09-11-2002, 09:50 PM
Python that runs as fast as Assembly, has as much modules as Perl or Java (dunno which has more)

inkedmn
09-11-2002, 10:49 PM
my sentiments exactly :)

jemfinch
09-11-2002, 10:52 PM
I'll tell you after I learn Haskell :)

Jeremy

kmj
09-11-2002, 11:11 PM
the ideal language would simply let me create whatever program I needed to (that fit whatever constraints necessary; time, size, etc.), without getting in my way... i.e. without me having to think of anything other than the program I'm writing. So far, I think python is the closest I've found to that, you know the whole "executable pseudocode" thing.

Strike
09-11-2002, 11:39 PM
Originally posted by GnuVince
Python that runs as fast as Assembly, has as much modules as Perl or Java (dunno which has more)
Python has more modules than Java by the sheer fact that Jython allows you to use every Java module in Python.

sans-hubris
09-12-2002, 02:12 AM
Damn it, people! You are all defeating the purpose of this thread! Argh, I wanted all of you to think about programming languages in a critical manner, and what makes them good.

Well, I tried.

Strike
09-12-2002, 02:22 AM
Well, here are what I like in the programming languages I've used:

1. Easy to read syntax, don't have to think "hrm, what does that function do" when reading it, and if it's done very well then the argument list pretty much makes sense given what the function does.
2. Fast development time, so I favor higher-level languages.
3. Consistency (this is where Perl loses it big-time for me). I like there being a standardized way of doing things in general. Sure, for bigger projects, chaining these standardized procedures together can reveal very different solutions to the same problem, but when it comes to the basics, I think there should be one right way.
4. Flexibility of paradigm. Though this may seemingly conflict with #3, it doesn't have to necessarily. I like a language that can do things like allow me the niceties of OOP and FP, but without imposing the restrictions of each on me for simpler things where they aren't needed.
5. Extensibility. I like the ability to take the language I'm given and make it better by extending it instead of having to reimplement it. Python's ability (as of 2.2) to extend any of the types (which are now all classes, iirc) into a new type is a good example of this.

That's really all I can think of off the top of my head for now, but it's a good start :)

jemfinch
09-12-2002, 04:36 AM
I agree with Strike, mostly, but I'll still put my own thoughts down.

1. Syntactical Consistency. The more different ways you have to do something, the greater the possiblity that you won't remember the one you used a week/month/year ago when you read your code. The greater the possibility that you won't remember the one used by the person who wrote the code you've got to maintain.

2. Semantical Consistency. As above, the more context-based a language is, the more likely you are to forget the context, or use the wrong context when you're writing code in that language. The more likely you are to misunderstand the context when you're reading code (yours or others) that you have to maintain.

3. Provable Correctness. I value correctness and robustness more than probably any other quality in my programs -- and I want a language to help me achieve those ideals (God knows I'm not achieving them now ;)) The more the compiler can prove correct or incorrect about my program, the less time I'll have to spend figuring such things out myself. (Yes, this is my way of saying I want strict typing in the perfect programming language).

4. Code Reuse. I want to be able to reuse code, to switch in and out various components that are implemented in different ways. If I started out using a list as a container, and later want to change to an array or a Set, I want that option available to me with minimal code changes. And when I write code that I later might want to change, I don't want to have put a lot of framework around it just for that capability.

4a. Corrolary to Code Reuse. No language without first-class functions (or some easy way to imitate them) can provide even a modicum of my requirements for code reuse.

In short, I want a lexically scoped, strictly-typed language that supports ad hoc polymorphism and standard functional features. Haskell might be the closest language I've found to that; I'll have to see how it turns out.

Jeremy

GnuVince
09-12-2002, 09:26 AM
A thing I like about languages is when they have free, easy documentation. Bonus point if they have foreign language versions (french, spanish, german, etc.). A good library reference (I *love* this one (http://www.rubycentral.com/book/builtins.html)) with examples is very nice to have too.

About syntax, as long as it's not too hard, I'm ok, but something that's explicit and clear is always welcome. It's also very fun to use a language that was designed with programmers in mind.

And of course, easily reusable and extendable modules. Something anti-Forth in a sense (Chuck Moore is against reusability).

And the language must be free. This is not really an issue, because all the good languages (Python, O'Caml, Ruby, Lisp, C/C++, etc.) are free. But if someone was to design a new (r)evolutionnary language, I would expect it to be free and multi-platform.

kmj
09-12-2002, 10:18 AM
Originally posted by sans-hubris
Damn it, people! You are all defeating the purpose of this thread! Argh, I wanted all of you to think about programming languages in a critical manner, and what makes them good.

Well, I tried.

you got some attitude...

I did tell you exactly what I think makes a programming language good.

GnuVince
09-15-2002, 08:24 PM
Or maybe a compiler that understood all languages? So you could ALWAYS use the right language for the right job. A bit like integrating Asm code in a C program, but you could integrate, Perl, Python, Ruby, Lisp, C, Assembly, Java, etc. all together.

Maybe that's something that would be nice...

sans-hubris
09-16-2002, 02:23 AM
Originally posted by GnuVince
Or maybe a compiler that understood all languages? So you could ALWAYS use the right language for the right job. A bit like integrating Asm code in a C program, but you could integrate, Perl, Python, Ruby, Lisp, C, Assembly, Java, etc. all together.

Maybe that's something that would be nice... This is ultimately the goal of GCC (http://gcc.gnu.org), but the backend only took into account register-based machines, not stack-based ones like the VMs for Java and the .NET Framework.

sicarius
09-16-2002, 12:36 PM
GnuVince: Having a compiler that understands all languages would be kind of rough. is the following statement in C, C++, Java, etc.?

x = 5;

It would be convienient to say that it didn't matter, and that statements like the above would be treated differently, but the fact is you really can't do that, because the semantics of the statement may differ slightly. For example, if I had the following statment:

int *x = somearray;

I can narrow it down to C, or C++, so in this case lets just say we meant C code. Well then we have a pointer to the begining of an integer array. Fine.

Now if later on I had:

x = x + 5;

Would this be C code saying to look at 5 elements from where I am, or Java code saying that x should be set to its current value plus 5? Well first I'd have to look at the symbol table and find out what x's type is (something I'd probably have to do anyway) then add it to the parse tree in such a way that the backend would know to treat it like C, plus this is still making the compiler decide what the programmer's intent was.


Anyway that is just one example, and probably not the best one. Now if you were using the word compiler refering to something like GCC, well that might be different. But GCC isn't really one complier that understands many languages, it is an application that has different compiler front ends and a unified back end (except for maybe java in which it uses some byte code thingy).

GnuVince
09-16-2002, 03:28 PM
I don't know I just suggested something that I think would be nice. I think it would be nice if I could teleport, but that's not going to happen.

But, maybe something like this:


<ruby>
class String
def rot13
tr "A-Za-z", "N-ZA-Mn-za-m"
end
end
</ruby>

<ocaml>
let rec fact n =
if n < 1 then
1
else
n * (fact (n - 1))
</code>

<python>
s = "foobar".rot13
</python>

<C>
int n;
n = fact(10);
</C>


But as I said, I don't expect this to happen anytime soon: it's more likely that a near-perfect language will be developped. But I can dream, eh?

/me teleports to South California to scare inkedmn!

sicarius
09-16-2002, 03:41 PM
yeah. i see what your saying. but even using markup to define code blocks wouldn't be a great solution. from what you've said one of the best features of the language would be being able to integrate lots of different snipets of code into one large program, but the main problem you run into is how data types are treated, and whether or not i should be able to access an integer from a c block in a java block.

BTW TCL is great because you can write extensions to the interpreter which for all intents and purposes become part of the language. I don't know exactly how many languages you can write the extensions in, but certainly C, C++.

kmj
09-16-2002, 04:14 PM
GnuVince: .NET lets you call functions written any language from any other language. (assuming both have .NET compilers); only problem is it's not natively compiled.

GnuVince
09-16-2002, 06:19 PM
sicarius: This is a nice feature. A bit like you can write Python of Ruby extensions in C/C++, Java. One thing I like though is how Ruby makes it possible to reopen existing classes to add methods.

jemfinch
09-26-2002, 06:26 PM
Originally posted by GnuVince
sicarius: This is a nice feature. A bit like you can write Python of Ruby extensions in C/C++, Java. One thing I like though is how Ruby makes it possible to reopen existing classes to add methods.

You can do that in Python, too, of course.

Jeremy