?

Log in

No account? Create an account

I just thought of a good CS idea! - Journal of Omnifarious

Mar. 19th, 2004

06:28 pm - I just thought of a good CS idea!

Previous Entry Share Next Entry

I demand one main feature out of any new programming language I evaluate. The language must make it easy for programs to build programs, either at compile time, or at run time.

Java, last I looked carefully, couldn't do that. It has a static type system, so you can't combine objects together into new programs like you can in Python, Ruby, or even *shudder* perl. You can create new classes on the fly by using introspection, hand building byte code and feeding it to the class loader, but that's like pounding in a nail with a screwdriver. And it doesn't have C++'s sophisticated templating mechanism, so you can't build new programs at compile time. Now, it recently added generics, but I have a strong suspicion that generics will turn out to not be powerful enough to do what C++ templates can do. But that's just a guess.

As an example of what I mean....

Python has three functions, filter, map, and reduce. They are built in functions. They work easily and simply on any type. In more recent versions of Python, they even work well on any abstraction at all of a sequence.

I can build template functions that do the same thing, and are just as type agnostic (and preserving) in C++.

I doubt, even with generics, that I can build anything even remotely similar for Java. Note that the lambda expression (or object) passed in must have a method that takes objects of the type the sequence holds. It must not be required to take things of type Object.

Current Mood: [mood icon] thoughtful

Comments:

[User Picture]
From:ladon13
Date:March 19th, 2004 09:11 pm (UTC)
(Link)
Pearl is ugly, phython is slow as hell (it can't be used in an enterprise system...and isn't). C++ is fine if you don't mind having to recomplile for every platform.

Java, when used properly, has a lot of flexability and a lot of power behind it. Granted, it's not the best language but it's powerful and more robust than C++. It is very good for object orientation programming, especially if you know what you are doing (are good at design and architecture).

Just my 2 cents
(Reply) (Thread)
[User Picture]
From:codesamurai
Date:March 19th, 2004 09:15 pm (UTC)
(Link)
So you want strong language support for generic programming, and generative programming.

Based from experience C++ has strong support for compile-time generative programming. I'm not sure about it's support for run-time generative programming though.
(Reply) (Thread)
[User Picture]
From:omnifarious
Date:March 20th, 2004 12:12 am (UTC)
(Link)

It has practically no support for run-time generative programming. :-)

(Reply) (Parent) (Thread)
From:rosencrantz319
Date:March 20th, 2004 05:23 am (UTC)
(Link)
(Reply) (Thread)