Re: ANN: Q language website (new)
- From: Jon Harrop <usenet@xxxxxxxxxxxxxx>
- Date: Tue, 12 Jul 2005 20:32:48 +0100
james.jdunne@xxxxxxxxx wrote:
> Not that I'm defending C++, but they could've developed that version in
> a much more efficient manner than copying buffers around.
Absolutely, but that misses the critical point that nobody has infinite time
in which to design and write their code. This is the main reason that
simplicity is desireable.
> Also, the
> more complicated your C++ program flow is, the worse off you're going
> to be. Always simplify.
Yes, that is the single best reason for adopting higher-level features -
everyone wants to design a language such that programs written in it will
be simpler than in any other language.
> I'm almost sure that a direct procedural
> implementation of the program would either match or beat the Lisp
> version in performance/memory usage.
In all likelihood, a fully optimised C++ program will be faster than a fully
optimised Lisp/OCaml/SML/... program. However, the set of programs which
can be fully optimised manually is tiny, simply because the number of
permutations of seemingly good optimisations explodes as program size
increases.
> Besides, Lisp is an entirely
> different paradigm from C++ and there is much more behind-the-scenes
> work that you don't see in Lisp.
Yes.
> Comparing the two is a fairly worthless venture.
No. If you want to write great software then you must start by choosing a
great language. Thus, you must try to compare different languages. I'm
trying to publish my findings as I discover cool new things about
programming. Look at my ray tracer here, for example:
http://www.ffconsultancy.com/free/ray_tracer/languages.html
Java is better than C++ for many robustness-based reasons. But, in this
case, note how both OCaml and SML are much faster and much more succinct
than Java whilst providing all of the benefits and many more.
> I wouldn't base the comparison solely on the use of
> GC in Lisp and not in C++.
Yes, GC is far from the only reason.
[OO]
> I agree with you here. Object-oriented programming has the buzz that
> everyone says it's "better," but nobody really knows why. Fact is,
> it's not.
>From my experience, I'd have to agree. This is one the main reasons that I
dislike Java - it forces you to use OO when OO is suboptimal in most cases.
I've been programming in OCaml for quite a while now and, although it
provides objects and OO, I very rarely use them. Indeed, I haven't even
used them in my GUI code (a pedagogical OO example) because I just can't
see why they would be any better than my ordinary style.
> ...
> Also, polymorphism completely destroys any chance of successfully and
> easily debugging your application because your objects can morph into
> other objects at any given time!
You need to be careful when you use the word "polymorphism" as it means
different things to different people. In OO, I believe polymorphism means
the ability to substitute derived classes when things are written in terms
of the base class.
In functional programming, polymorphism means the ability to use any type.
For example, the following OCaml function applies a given function "g" to a
given argument "x" twice, giving "g(g(x))":
# let f g x = g(g(x));;
val f : ('a -> 'a) -> 'a -> 'a = <fun>
The type inferred for this function uses "'a" (denoting the greek letter
alpha) to mean "any type". This function then magically works with any
types. For example x+x+x+x and "Hello "^"Hello "^"Hello "^"Hello ":
# f (fun x -> x+x) 3;;
- : int = 12
# f (fun s -> s^s) "Hello ";;
- : string = "Hello Hello Hello Hello "
--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com
.
- Follow-Ups:
- Re: ANN: Q language website (new)
- From: james . jdunne
- Re: ANN: Q language website (new)
- References:
- ANN: Q language website (new)
- From: Marco
- Re: ANN: Q language website (new)
- From: Marcin 'Qrczak' Kowalczyk
- Re: ANN: Q language website (new)
- From: james . jdunne
- Re: ANN: Q language website (new)
- From: james . jdunne
- ANN: Q language website (new)
- Prev by Date: Re: ANN: Q language website (new)
- Next by Date: Re: ANN: Q language website (new)
- Previous by thread: Re: ANN: Q language website (new)
- Next by thread: Re: ANN: Q language website (new)
- Index(es):
Relevant Pages
|