Discussion:
Alternatives to C: ObjectPascal, Eiffel, Ada or Modula-3?
(too old to reply)
Andrea Taverna
2009-07-18 14:19:40 UTC
Permalink
Hi folks!

I'm a CS student and I often need to write number-crunching code dealing
with combinatorial optimization problems.
What I do usually is implementing ad-hoc algorithms and testing their
performance against other previously-known solutions, including general
solvers.

In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.

Here follow the features it should have, ranked approximately by relevance:

0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard
or de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"

So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are
the impressions I got for each language.
Can you help me? Feel free to recommend other languages as well.

TIA

--> Impressions I got for each language

- FreePascal is a safe and modular alternative to C and C++, but
it is also close to the latter in terms of expressiveness. Moreover it
doesn't seem to have the libraries I need.
==>Qualifies for 0,1,2,5. Not sure about 3 and 4

- Eiffel is geared toward application programming in
medium/large-sized teams relying heavily on OO modelling. It is designed
for (re)usability, correctness and efficiency in this order.
My needs are somewhat different though.
The main gripe I have with Eiffel is the lack of a well-documented
standard gpl'ed library.
GOBO and EiffelBase seem to have incomplete or non-free documentation
and I couldn't find tutorials; as such, I couldn't get a clear picture
about them.
==> Qualifies for 0,1,2,4,5 and 6. Not sure about 3.

- Ada is best suited for large teams and/or critical software, thus
it may be overkill for my work, OTH it could have anything I might
happen to need.
What holds me from jumping onto Ada is the potential complexity
It would be interesting to hear the experience of other people learning
Ada from the C/Java background.
As for memory management (requirement 4), I heard there are different
takes on the matter:
(a) Ada uses dynamic stack allocation a lot, and in a transparent way,
reducing the need of manual management (MM)
(b) Ada libraries adopt idioms that further simplifies MM issues
(c) Conservative garbage collectors such as Bohem's can be used with
Ada, and they are supposed to work "better" with Ada than with unsafe
languages such as C and C++

So can MM be said to be easier in Ada than in C? I hope Ada-ers will
mercifully shed some light on the issue.

There seems to be a lot of Ada95 free documentation on the net, I guess
it's suitable for Ada05 as well.
==> Qualifies for 0,1,2,3,5 and, partially, 4

- Modula-3 is simpler/smaller than Ada and has been successfully
used for system/application programming.
It seems to be the most consistent, simple and easy to grok, but I
couldn't find any container/math library ready to use.
==> Qualifies for 0,1,2,4,5,6.
Richard Harter
2009-07-18 14:42:28 UTC
Permalink
On Sat, 18 Jul 2009 16:19:40 +0200, Andrea Taverna
Post by Andrea Taverna
Hi folks!
I'm a CS student and I often need to write number-crunching code dealing
with combinatorial optimization problems.
What I do usually is implementing ad-hoc algorithms and testing their
performance against other previously-known solutions, including general
solvers.
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard
or de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are
the impressions I got for each language.
Can you help me? Feel free to recommend other languages as well.
TIA
You might also consider modern fortran.

Richard Harter, ***@tiac.net
http://home.tiac.net/~cri, http://www.varinoma.com
If I do not see as far as others, it is because
I stand in the footprints of giants.
Francois PIETTE
2009-07-18 14:53:50 UTC
Permalink
Post by Andrea Taverna
I'm a CS student and I often need to write number-crunching code dealing
with combinatorial optimization problems.
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard or
de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation and
low-level issues
6) "relatively simple and consistent"
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
You said you are a student. So probably your goal is to get a job after your
studies. If this is the case, you forgot the most important thing regarding
language selection: The possibility to get a job !

In that context, I wouldn't use any of the language you mentionned ! Ok,
maybe FreePascal which would be replaced by Delphi or Delphi Prism once you
are in a company for a real work. If it is not Delphi, then use C# or Java.
It is likely that Delphi would be the fastest regarding number crunching.

Delphi has a large and alive community. You can find a lot of opensource and
freeware for Delphi.

--
***@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
Pascal J. Bourguignon
2009-07-18 15:18:45 UTC
Permalink
Post by Andrea Taverna
Hi folks!
I'm a CS student and I often need to write number-crunching code
dealing with combinatorial optimization problems.
What I do usually is implementing ad-hoc algorithms and testing their
performance against other previously-known solutions, including
general solvers.
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
Have a look at Haskell.
Post by Andrea Taverna
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
Of those, I'd use Modula-3.
(you may also consider: Objective Modula-2)
--
__Pascal Bourguignon__
Nicholas Paul Collin Gloucester
2009-07-20 10:13:31 UTC
Permalink
On 2009-07-18, Pascal J. Bourguignon <***@informatimago.com> wrote:

|-----------------------------------------------------------------------------|
|"[..] |
| |
|Of those, I'd use Modula-3. |
|(you may also consider: Objective Modula-2)" |
|-----------------------------------------------------------------------------|

This is the first I have heard of Objective Modula-2. Thank you.

Unfortunately, Wirthian languages tend to use structural equivalence
of types instead of occurrence equivalence, such as Modula-3 according
to
HTTP://web.archive.org/web/20051001044031/http://archive.dstc.edu.au/AU/staff/crawley/ada/m3-vs-ada.html#section4.1
and many interpretations of an early Pascal definition, so I suspect
that Modula-2 also had this weakness. The following excerpt from
HTTP://Objective.Modula2.net/
- "[..]
The base language is Modula-2 as defined by Niklaus Wirth in the
fourth edition of Programming in Modula-2 with the following omissions
and restrictions:

Omissions
[..]
* No subrange types
[..]" -
seems to indicate that it is even worse.

Ada allows you to choose for some types to be treated with occurrence
equivalence (called types in Ada:
WWW.AdaIC.org/standards/05rm/html/RM-3-2-1.html
) and for other types to be treated as
structurally equivalent (called subtypes in Ada:
WWW.AdaIC.org/standards/05rm/html/RM-3-2-2.html
) as you deem to be appropriate. Unlike for example Eiffel's Design by
Contract, this is not something which is activated or deactivated by a
compiler switch: a single Ada function can exploit both approaches at
the same time without being recompiled.

Regards,
Nicholas Paul Collin Gloucester
Hendrik Boom
2009-08-04 20:12:12 UTC
Permalink
Unfortunately, Wirthian languages tend to use structural equivalence of
types instead of occurrence equivalence, such as Modula-3 according to
HTTP://web.archive.org/web/20051001044031/http://archive.dstc.edu.au/AU/
staff/crawley/ada/m3-vs-ada.html#section4.1

Modula 3 uses structural equivalence unless you specify otherwise. You
specify otherwise by using a BRANDED type. That's actually a very
effective compromise.

-- hendrik
Jon Harrop
2009-07-21 12:03:34 UTC
Permalink
Post by Pascal J. Bourguignon
Have a look at Haskell.
He said performance was important.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
Mark T.B. Carroll
2009-07-21 13:25:47 UTC
Permalink
Post by Jon Harrop
Post by Pascal J. Bourguignon
Have a look at Haskell.
He said performance was important.
And it's achievable in Haskell, especially with a bunch of the work
that's been done in GHC 6.6, 6.8, 6.10, and especially if you have
multiple cores. (I'm not just talking about things like short cut
fusion, but a bunch of library improvements like in ByteStrings.)

The caveat - and you may consider it a showstopper, but I don't - is
that it's easy for a newbie to write grossly inefficient Haskell. It
takes some understanding of what GHC's up to and what fancy stuff is
available, and some use of the profiler, to really be able to eke good
performance out of the system, and you may not think it acceptable that
(a) it's not easy for new users to figure out how to get good
performance from it and (b) if a part of the code has to be much changed
to make it fast, that part often ends up looking rather ugly. (I'd be
interested to see if Haskell fans can rebut me on those points, but
I bet some of the language shootout code still looks horrifying.)

Admittedly, the last I looked, it may be that Data.HashTable is still
slower than I'd have thought reasonable. But if I figure that if I
use it anyway then someone'll fix it and I'll notice the improvement
when I upgrade GHC. (-:

[ followups trimmed ]

Mark
BGB / cr88192
2009-07-18 16:27:56 UTC
Permalink
Post by Andrea Taverna
Hi folks!
I'm a CS student and I often need to write number-crunching code dealing
with combinatorial optimization problems.
What I do usually is implementing ad-hoc algorithms and testing their
performance against other previously-known solutions, including general
solvers.
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
("better" is debatable... some define it in terms of more subjective
aspects, and others are more pragmatic about the matter...).
Post by Andrea Taverna
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard or
de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation and
low-level issues
6) "relatively simple and consistent"
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are the
impressions I got for each language.
Can you help me? Feel free to recommend other languages as well.
although I don't personally use it (for varried and numerous reasons), have
you considered Java?...

afaik, modern Java involves a fair amount of JIT-time optimization, and so
for carefully written code can be performance-competative with C and C++...

it is a similar situation with C#.

(the big cost in my case, however, is not performance, but that they depend
on these particular VMs...).


for my uses though, I typically use C and C++ (and ASM...). these languages
are just best suited for what I do with them.


of those listed, FreePascal and Ada seem like ok bets.

the main cost is that they have far smaller development communities than C
and Java and like, and like I have seen with many smaller languages, the
developer communities often tend to have a kind of fanatical zeal... (in
place of a more pragmatic outlook...).

Delphi may be worth looking into, given it is similar to FreePascal, and has
(AFAIK) a larger developer base.
Post by Andrea Taverna
TIA
--> Impressions I got for each language
- FreePascal is a safe and modular alternative to C and C++, but it
is also close to the latter in terms of expressiveness. Moreover it
doesn't seem to have the libraries I need.
==>Qualifies for 0,1,2,5. Not sure about 3 and 4
- Eiffel is geared toward application programming in
medium/large-sized teams relying heavily on OO modelling. It is designed
for (re)usability, correctness and efficiency in this order. My needs are
somewhat different though.
The main gripe I have with Eiffel is the lack of a well-documented
standard gpl'ed library.
GOBO and EiffelBase seem to have incomplete or non-free documentation and
I couldn't find tutorials; as such, I couldn't get a clear picture about
them.
==> Qualifies for 0,1,2,4,5 and 6. Not sure about 3.
- Ada is best suited for large teams and/or critical software, thus it
may be overkill for my work, OTH it could have anything I might happen to
need.
What holds me from jumping onto Ada is the potential complexity
It would be interesting to hear the experience of other people learning
Ada from the C/Java background.
As for memory management (requirement 4), I heard there are different
(a) Ada uses dynamic stack allocation a lot, and in a transparent way,
reducing the need of manual management (MM)
(b) Ada libraries adopt idioms that further simplifies MM issues
(c) Conservative garbage collectors such as Bohem's can be used with Ada,
and they are supposed to work "better" with Ada than with unsafe languages
such as C and C++
So can MM be said to be easier in Ada than in C? I hope Ada-ers will
mercifully shed some light on the issue.
conservative GC typically works plenty well in C, at least as long as people
refrain from esoteric trickery ("oh I can't xor pointers or store them in a
file, thus GC is useless", ...).

granted, conservative GC does work better in single-threaded C and C++ than
in multithreaded code...
Post by Andrea Taverna
There seems to be a lot of Ada95 free documentation on the net, I guess
it's suitable for Ada05 as well.
==> Qualifies for 0,1,2,3,5 and, partially, 4
- Modula-3 is simpler/smaller than Ada and has been successfully used
for system/application programming.
It seems to be the most consistent, simple and easy to grok, but I
couldn't find any container/math library ready to use.
==> Qualifies for 0,1,2,4,5,6.
Ben Bacarisse
2009-07-18 17:41:08 UTC
Permalink
Andrea Taverna <***@libero.it.invalid> writes:
<snip>
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
Other people have been adding to your list but Objective Caml is still
missing. It ticks all you boxes.
--
Ben.
Nicholas Paul Collin Gloucester
2009-07-20 10:39:05 UTC
Permalink
On 2009-07-18, Ben Bacarisse <***@bsb.me.uk> wrote:

|-----------------------------------------------------------------------------|
|"Andrea Taverna <***@libero.it.invalid> writes: |
|<snip> |
|> In the past I used C, but now I have decided to change language. |
|> I'm looking for a "better" one. |
|> |
|> Here follow the features it should have, ranked approximately by relevance:|
|> |
|> 0) open-source support and an alive community |
|> 1) directly compiled to efficient code |
|> 2) statically typed and object-oriented, better if multi-paradigm |
|> 3) general-purpose libraries (possibly standardized, either by |
|> standard or de facto), including containers and some math |
|> abstractions. |
|> 4) garbage collected. As an alternative, provide memory management |
|> policies via libraries (e.g. memory pools and such) |
|> 5) optional run-time checks and some kind of control over compilation |
|> and low-level issues |
|> 6) "relatively simple and consistent" |
|> |
|> So I have considered these alternatives: FreePascal, Eiffel, Ada and |
|> Modula-3. |
| |
|Other people have been adding to your list but Objective Caml is still |
|missing. It ticks all you boxes." |
|-----------------------------------------------------------------------------|

Why Objective Caml instead of JoCaml; G'Caml; Chamau; BIGLOO; HimML;
CeML; or Gaml?
Ben Bacarisse
2009-07-20 16:17:26 UTC
Permalink
Post by Nicholas Paul Collin Gloucester
|-----------------------------------------------------------------------------|
|<snip> |
|> In the past I used C, but now I have decided to change language. |
|> I'm looking for a "better" one. |
|> |
|> Here follow the features it should have, ranked approximately by relevance:|
|> |
|> 0) open-source support and an alive community |
|> 1) directly compiled to efficient code |
|> 2) statically typed and object-oriented, better if multi-paradigm |
|> 3) general-purpose libraries (possibly standardized, either by |
|> standard or de facto), including containers and some math |
|> abstractions. |
|> 4) garbage collected. As an alternative, provide memory management |
|> policies via libraries (e.g. memory pools and such) |
|> 5) optional run-time checks and some kind of control over compilation |
|> and low-level issues |
|> 6) "relatively simple and consistent" |
|> |
|> So I have considered these alternatives: FreePascal, Eiffel, Ada and |
|> Modula-3. |
| |
|Other people have been adding to your list but Objective Caml is still |
|missing. It ticks all you boxes." |
|-----------------------------------------------------------------------------|
Why Objective Caml instead of JoCaml; G'Caml; Chamau; BIGLOO; HimML;
CeML; or Gaml?
No reason at all if these all meet the OP's needs. I don't know them
so I could not reasonably suggest them. OCaml is the only ML-like
language I know that is object oriented as asked for. A quick look at
some of your list suggests that not all of them are.
--
Ben.
Jon Harrop
2009-07-21 12:10:26 UTC
Permalink
Post by Nicholas Paul Collin Gloucester
Why Objective Caml instead of JoCaml; G'Caml; Chamau; BIGLOO; HimML;
CeML; or Gaml?
None of them have alive communities except Bigloo which is a Scheme
implementation and, therefore, is not statically typed.

In contrast, OCaml has a substantial community, lots of libraries and offers
superb performance with one of the most expressive static type systems in
existence. OCaml's proprietary cousin at Microsoft, F#, is also a superb
high-performance language.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
Andrew Reilly
2009-07-19 01:04:47 UTC
Permalink
Post by Andrea Taverna
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are
the impressions I got for each language. Can you help me? Feel free to
recommend other languages as well.
These are all fine choices of languages, but I wonder how much benefit
you will be getting for yourself, as a sole-coder programming to produce
results, rather than code?

I think that you should consider stretching yourself a bit further:
others have suggested Ocaml and Hascall. I'd add that modern Common Lisp
(eg SBCL) ticks all of your boxes too. You might be surprised that there
are some scheme implementations that will fit, too, and both of those are
perhaps more "multi-paradigm" than the languages that you've got on your
short list.

In the end, though, you really need to check your decision criteria:

1: how fast is fast enough? Will you be waiting weeks for a run to
complete, or will you be coding for weeks and then running for ten
minutes? If the latter, something more expressive but perhaps a little
further from "speed of light" ASM might be more helpful. Also, if your
code will be spending most of its time in optimized library matrix
algebra code (eg atlas) then it doesn't matter much how the language
itself fares. (eg Matlab is slow but expressive unless you use it as a
wrapper around BLAS/LAPAC, in which case it's hard to get close to.)

2: How much do you really need object orientation? Inheritance isn't
necessarily particularly useful for a lot of numerical code, and there
are lighter-weight strategies that support modular and safe coding.

3: Libraries are good to have. You'll find that C and Fortran still have
the lions share of the numerical ones, though.

4: Garbage collection is really nice to have, as a programmer. Leave
this one in, but recognize that (a) you can do it in C if you want to and
(b) doing without involves more pain but can be made to work. See (1).

5: C and Fortran don't give you much of this out of the box, it's true,
but C has assert(), and used wisely and extensively in your own code will
give you some of the same "catch mistakes early" benefit of language-
supported checks, and you can turn it off with -DNDEBUG. The lisps and
schemes typically have a very wide range of "knobs" to control the amount
of run-time checking that they do.

6: C is simple and consistent.

When I had my own "C ennui" experience a couple of years ago, I picked
scheme, on the understanding that sometimes I would probably have to
still write some C and assembler to support C-using colleagues and for
ultimate performance. (And I wanted to learn something really different
from C.) I've been happy with the outcome, so far.

Cheers,
--
Andrew
Jean-Pierre Rosen
2009-07-20 09:57:53 UTC
Permalink
Andrea Taverna a écrit :
[...]
Post by Andrea Taverna
- Ada is best suited for large teams and/or critical software, thus
it may be overkill for my work, OTH it could have anything I might
happen to need.
What holds me from jumping onto Ada is the potential complexity
As a long time teacher of Ada, let me elaborate on this particular issue.

1) More than complex, Ada is feature-rich, with some properties that do
not exist in most other languages (user defined elementary types,
discriminants, stack-allocated dynamic structures ...). Of course,
you'll have to learn about these features - if you want to use them.

2) Ada is extremely consistent. You'll have to learn the basic
principles, but once you've got them, you'll discover that all the
features follow the same logic. Therefore, the first step might be
higher than for other languages, but then everything appears logical and
easy to grasp.

3) Ada is simple to use, because difficulty of implementation has never
been an excuse for forbidding something that the user would expect to
work. However, that makes the language complex to compile, and part of
the alledged complexity of Ada refers to complexity of implementation,
not complexity of use. Of course, as a user, you don't care about this,
since you have compilers, even free ones, that implement the language
correctly, and this is checked by passing the validation suite (AKA ACATS).
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
wwilson
2009-07-26 02:26:39 UTC
Permalink
Post by Jean-Pierre Rosen
[...]
Post by Andrea Taverna
- Ada is best suited for large teams and/or critical software, thus
it may be overkill for my work, OTH it could have anything I might
happen to need.
What holds me from jumping onto Ada is the potential complexity
As a long time teacher of Ada, let me elaborate on this particular issue.
1) More than complex, Ada is feature-rich, with some properties that do
not exist in most other languages (user defined elementary types,
discriminants, stack-allocated dynamic structures ...). Of course,
you'll have to learn about these features - if you want to use them.
2) Ada is extremely consistent. You'll have to learn the basic
principles, but once you've got them, you'll discover that all the
features follow the same logic. Therefore, the first step might be
higher than for other languages, but then everything appears logical and
easy to grasp.
3) Ada is simple to use, because difficulty of implementation has never
been an excuse for forbidding something that the user would expect to
work. However, that makes the language complex to compile, and part of
the alledged complexity of Ada refers to complexity of implementation,
not complexity of use. Of course, as a user, you don't care about this,
since you have compilers, even free ones, that implement the language
correctly, and this is checked by passing the validation suite (AKA ACATS).
I agree that Ada can look daunting, but you can start with the "Pascal
subset", a subset that pretty much matches the original Pascal. From
personal experience, this subset is very easy to learn and become
comfortable with. We taught over a thousand studnts using this subset and
never had a single real problem.

Once the beginner masters the Pascal subset it is fairly easy to learn
additional features, one at a time. The real problem we found here was
that some students had never seen problems that needed or could use these
features. In other words, we were trying to teach three year olds how to
parse a sentence when they were still learning to talk. On the other
hand, students who were familiar with the kinds of problems these features
were designed for had no difficulty with even some of the more esocteric
parts of Ada. For students lacking this background we spent some time
furnishing it before intoducing the associated Ada feature. Many
students, for instance, required some exposure to tasking kinds of
problems before we mentioned Ada tasking.

Conclusion, approach learning Ada one step at a time and don't try to
master the whole thing at once. It is an easy language to learn and the
benefits are great.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Nicholas Paul Collin Gloucester
2009-07-20 12:15:08 UTC
Permalink
On 2009-07-18, A. Taverna <***@libero.it.invalid>
submitted for the newsgroups comp.lang.eiffel; comp.lang.ada;
comp.lang.modula3; comp.lang.pascal; and comp.programming ...
|---------------------------------------------------------------------------|
|"Hi folks! |
| |
|I'm a CS student and I often need to write number-crunching code dealing |
|with combinatorial optimization problems. |
|What I do usually is implementing ad-hoc algorithms and testing their |
|performance against other previously-known solutions, including general |
|solvers. |
| |
|In the past I used C, but now I have decided to change language. |
|I'm looking for a "better" one. |
| |
|Here follow the features it should have, ranked approximately by relevance:|
| |
|0) open-source support and an alive community |
|1) directly compiled to efficient code |
|2) statically typed and object-oriented, better if multi-paradigm |
|3) general-purpose libraries (possibly standardized, either by standard |
|or de facto), including containers and some math abstractions. |
|4) garbage collected. As an alternative, provide memory management |
|policies via libraries (e.g. memory pools and such) |
|5) optional run-time checks and some kind of control over compilation |
|and low-level issues |
|6) "relatively simple and consistent" |
| |
|So I have considered these alternatives: FreePascal, Eiffel, Ada and |
|Modula-3. |
|I have taken a look at all of them and I'm still undecided. Below are |
|the impressions I got for each language. |
|Can you help me? Feel free to recommend other languages as well. |
| |
|TIA |
| |
|--> Impressions I got for each language |
| |
|- FreePascal is a safe and modular alternative to C and C++, but |
|it is also close to the latter in terms of expressiveness. Moreover it |
|doesn't seem to have the libraries I need. |
|==>Qualifies for 0,1,2,5. Not sure about 3 and 4 |
| |
|- Eiffel is geared toward application programming in |
|medium/large-sized teams relying heavily on OO modelling. It is designed |
|for (re)usability, correctness and efficiency in this order. |
|My needs are somewhat different though. |
|The main gripe I have with Eiffel is the lack of a well-documented |
|standard gpl'ed library. |
|GOBO and EiffelBase seem to have incomplete or non-free documentation |
|and I couldn't find tutorials; as such, I couldn't get a clear picture |
|about them. |
|==> Qualifies for 0,1,2,4,5 and 6. Not sure about 3. |
| |
|- Ada is best suited for large teams and/or critical software, thus |
|it may be overkill for my work, OTH it could have anything I might |
|happen to need. |
|What holds me from jumping onto Ada is the potential complexity |
|It would be interesting to hear the experience of other people learning |
|Ada from the C/Java background. |
|As for memory management (requirement 4), I heard there are different |
|takes on the matter: |
|(a) Ada uses dynamic stack allocation a lot, and in a transparent way, |
|reducing the need of manual management (MM) |
|(b) Ada libraries adopt idioms that further simplifies MM issues |
|(c) Conservative garbage collectors such as Bohem's can be used with |
|Ada, and they are supposed to work "better" with Ada than with unsafe |
|languages such as C and C++ |
| |
|So can MM be said to be easier in Ada than in C? I hope Ada-ers will |
|mercifully shed some light on the issue. |
| |
|There seems to be a lot of Ada95 free documentation on the net, I guess |
|it's suitable for Ada05 as well. |
|==> Qualifies for 0,1,2,3,5 and, partially, 4 |
| |
|- Modula-3 is simpler/smaller than Ada and has been successfully |
|used for system/application programming. |
|It seems to be the most consistent, simple and easy to grok, but I |
|couldn't find any container/math library ready to use. |
|==> Qualifies for 0,1,2,4,5,6." |
|---------------------------------------------------------------------------|

Ciao!

I agree that static typing is important, but Modula-3; Eiffel; and
many versions of Pascal perhaps including FreePascal are restricted to
structural equivalence of types only. This is not sufficient strong
typing.

I give an example showing that Ada is better than Eiffel (and Modula-3
and many versions of Pascal) in this regard, based on an example by
Bertrand Meyer in the second edition of the book "Object-oriented
software construction". In that book, Dr. Meyer claimed that Ada's
overloading is inferior to Eiffel's overloading. He called Ada's
overloading syntactic overloading. He called Eiffel's overloading
semantic overloading. I believe that he was being sincere, but he was
definitely mistaken. He claimed that it would not be possible to
sensibly discriminate between overloaded subprograms for a point if
the real-number parameters could be in any of Cartesian notation and
polar notation.

This is refuted by the following Ada code...

procedure Syntactic_Overloading_Example_Based_On_An_Example_By_Bertrand_Meyer is
type Horizontal_Coordinate is new Float;
type Vertical_Coordinate is new Float;
procedure Point(X : Horizontal_Coordinate; Y : Vertical_Coordinate) is
begin
null; --Whatever.
end;

type Magnitude is new Float;
type Radians is new Float range -3.14*2.0 .. 3.14*2.0;
procedure Point(R : Magnitude; Theta : Radians) is
begin
null; --Whatever.
end;

X : Horizontal_Coordinate;
Y : Vertical_Coordinate;
R : Magnitude;
Theta : Radians;
begin
X := 1.1;
Y := 2.2;
R := 3.3;
Theta := 0.5;
Point(X, Y);
Point(R, Theta);

--The above is all legal Ada. However, the following mistakes would
--be legal in Eiffel but would be rejected by an Ada compiler...

R := X;
--An example compiler complaint...
--"Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:29:09: expected type "Magnitude" defined at line 9
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:29:09: found type "Horizontal_Coordinate" defined at line 2
--gnatmake: "Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb" compilation error".

Point(X, Theta);
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:04: no candidate interpretations match the actuals:
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:10: expected type "Magnitude" defined at line 9
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:10: found type "Horizontal_Coordinate" defined at line 2
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:10: ==> in call to "Point" at line 11
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:13: expected type "Vertical_Coordinate" defined at line 3
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:13: found type "Radians" defined at line 10
--Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb:35:13: ==> in call to "Point" at line 4
--gnatmake: "Syntactic_overloading_example_based_on_an_example_by_Bertrand_Meyer.adb" compilation error
end;
Mark T.B. Carroll
2009-07-20 12:59:43 UTC
Permalink
Post by Nicholas Paul Collin Gloucester
I agree that static typing is important, but Modula-3; Eiffel; and
many versions of Pascal perhaps including FreePascal are restricted to
structural equivalence of types only. This is not sufficient strong
typing.
Modula-3's BRANDED keyword overrides the structural equivalence.

[ followups trimmed ]

Mark
Nicholas Paul Collin Gloucester
2009-07-20 13:18:58 UTC
Permalink
On 2009-07-20, Mark T.B. Carroll <***@Aetion.com> wrote:

|------------------------------------------------------------------------|
|"Nicholas Paul Collin Gloucester <***@ACM.org> writes: |
| |
|> I agree that static typing is important, but Modula-3; Eiffel; and |
|> many versions of Pascal perhaps including FreePascal are restricted to|
|> structural equivalence of types only. This is not sufficient strong |
|> typing. |
| |
|Modula-3's BRANDED keyword overrides the structural equivalence." |
|------------------------------------------------------------------------|

Thank you for the response.

The author of
HTTP://web.archive.org/web/20051001044031/http://archive.dstc.edu.au/AU/staff/crawley/ada/m3-vs-ada.html#section4.1
warned that he did not know Modula-3 well, so was his claim
"Branding only applies to reference types"
untrue?

Could you show us a Modula-3 version of the code in news:h41n4c$pm0$***@news.eternal-september.org
which is better than Eiffel and at least as good as Ada?

Thanks again,
N. P. C.
Mark T.B. Carroll
2009-07-20 13:21:33 UTC
Permalink
Post by Nicholas Paul Collin Gloucester
|------------------------------------------------------------------------|
| |
|> I agree that static typing is important, but Modula-3; Eiffel; and |
|> many versions of Pascal perhaps including FreePascal are restricted to|
|> structural equivalence of types only. This is not sufficient strong |
|> typing. |
| |
|Modula-3's BRANDED keyword overrides the structural equivalence." |
|------------------------------------------------------------------------|
Thank you for the response.
The author of
HTTP://web.archive.org/web/20051001044031/http://archive.dstc.edu.au/AU/staff/crawley/ada/m3-vs-ada.html#section4.1
warned that he did not know Modula-3 well, so was his claim
"Branding only applies to reference types"
untrue?
I think that's true. However, that is not equivalent to Modula-3 being
"restricted to structural equivalence of types only", which is why I
corrected you. (Note that you can have reference types of even integers
or whatever, it's not just objects.)
Post by Nicholas Paul Collin Gloucester
which is better than Eiffel and at least as good as Ada?
I don't know Eiffel at all and barely remember Ada, so probably not I'm
afraid.

Mark
Nicholas Paul Collin Gloucester
2009-07-20 14:49:18 UTC
Permalink
On 2009-07-20, Mark T.B. Carroll <***@Aetion.com> wrote:

|---------------------------------------------------------------------------------------------------------------------|
|"Nicholas Paul Collin Gloucester <***@ACM.org> writes: |
| |
|> On 2009-07-20, Mark T.B. Carroll <***@Aetion.com> wrote: |
|> |
|> |------------------------------------------------------------------------| |
|> |"Nicholas Paul Collin Gloucester <***@ACM.org> writes: | |
|> | | |
|> |> I agree that static typing is important, but Modula-3; Eiffel; and | |
|> |> many versions of Pascal perhaps including FreePascal are restricted to| |
|> |> structural equivalence of types only. This is not sufficient strong | |
|> |> typing. | |
|> | | |
|> |Modula-3's BRANDED keyword overrides the structural equivalence." | |
|> |------------------------------------------------------------------------| |
|> |
|> Thank you for the response. |
|> |
|> The author of |
|> HTTP://web.archive.org/web/20051001044031/http://archive.dstc.edu.au/AU/staff/crawley/ada/m3-vs-ada.html#section4.1|
|> warned that he did not know Modula-3 well, so was his claim |
|> "Branding only applies to reference types" |
|> untrue? |
| |
|I think that's true. However, that is not equivalent to Modula-3 being |
|"restricted to structural equivalence of types only", which is why I |
|corrected you. (Note that you can have reference types of even integers |
|or whatever, it's not just objects.) |
| |
|[..]" |
|---------------------------------------------------------------------------------------------------------------------|

Touch�.
Jon Harrop
2009-07-21 12:25:42 UTC
Permalink
Post by Andrea Taverna
Hi folks!
I'm a CS student and I often need to write number-crunching code dealing
with combinatorial optimization problems.
What I do usually is implementing ad-hoc algorithms and testing their
performance against other previously-known solutions, including general
solvers.
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard
or de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are
the impressions I got for each language.
Can you help me? Feel free to recommend other languages as well.
I am very surprised at the list of languages you arrived at! FreePascal,
Eiffel and Modula-3 are all essentially dead. Ada is alive but sacrificed
many hugely-productive forms of abstraction (e.g. first-class functions) in
order to be optimally suitable for embedded programming. Unless you're
planning on number crunching on a PIC, which I seriously doubt, Ada would
be a step in the wrong direction.

I specialize in scientific computing and I've never heard of anyone using
any of those languages for it. I doubt any even have efficient
implementations by modern standards.

My vote would certainly go to OCaml. If you allow proprietary then also
OCaml's cousin F# from Microsoft because it offers even better parallelism.
Both of these languages are used extensively for scientific computing.

I would also strongly recommend avoiding conservative garbage collectors
because they leak uncontrollably:

http://flyingfrogblog.blogspot.com/2009/01/mono-22-still-leaks-memory.html
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
balson
2010-03-23 12:31:14 UTC
Permalink
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard
or de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
Where's performance on this list? Do you not care how fast the
applications run? Look at the following white paper to see if
performance should or shoild not be high on your list if you are
considering changing development languages:

http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf

What this WP documents is we took 5 basic very common computer science
algorithms and wrote them in different languages: C/C++, Java and C# and
then benchmarked them against each other. If performance is of any
concern to you, you'd stiff with C/C++.

IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance will
suffer.

Now if you just want to learn a new language, that's different. But if
you are in the commercial space and delivering to customers and that
customer demands top performance, stick with C/C++.


Jim
Post by Andrea Taverna
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are
the impressions I got for each language.
Can you help me? Feel free to recommend other languages as well.
TIA
--> Impressions I got for each language
- FreePascal is a safe and modular alternative to C and C++, but it is
also close to the latter in terms of expressiveness. Moreover it doesn't
seem to have the libraries I need.
==>Qualifies for 0,1,2,5. Not sure about 3 and 4
- Eiffel is geared toward application programming in medium/large-sized
teams relying heavily on OO modelling. It is designed for (re)usability,
correctness and efficiency in this order. My needs are somewhat
different though.
The main gripe I have with Eiffel is the lack of a well-documented
standard gpl'ed library.
GOBO and EiffelBase seem to have incomplete or non-free documentation
and I couldn't find tutorials; as such, I couldn't get a clear picture
about them.
==> Qualifies for 0,1,2,4,5 and 6. Not sure about 3.
- Ada is best suited for large teams and/or critical software, thus it
may be overkill for my work, OTH it could have anything I might happen
to need.
What holds me from jumping onto Ada is the potential complexity
It would be interesting to hear the experience of other people learning
Ada from the C/Java background.
As for memory management (requirement 4), I heard there are different
(a) Ada uses dynamic stack allocation a lot, and in a transparent way,
reducing the need of manual management (MM)
(b) Ada libraries adopt idioms that further simplifies MM issues
(c) Conservative garbage collectors such as Bohem's can be used with
Ada, and they are supposed to work "better" with Ada than with unsafe
languages such as C and C++
So can MM be said to be easier in Ada than in C? I hope Ada-ers will
mercifully shed some light on the issue.
There seems to be a lot of Ada95 free documentation on the net, I guess
it's suitable for Ada05 as well.
==> Qualifies for 0,1,2,3,5 and, partially, 4
- Modula-3 is simpler/smaller than Ada and has been successfully used
for system/application programming.
It seems to be the most consistent, simple and easy to grok, but I
couldn't find any container/math library ready to use.
==> Qualifies for 0,1,2,4,5,6.
balson
2010-03-23 12:56:49 UTC
Permalink
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by standard
or de facto), including containers and some math abstractions.
4) garbage collected. As an alternative, provide memory management
policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
Where's performance on this list? Do you not care how fast the
applications run? Look at the following white paper to see if
performance should or shoild not be high on your list if you are
considering changing development languages:

http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf

What this WP documents is we took 5 basic very common computer science
algorithms and wrote them in different languages: C/C++, Java and C# and
then benchmarked them against each other. If performance is of any
concern to you, you'd stiff with C/C++.

IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance will
suffer.

Now if you just want to learn a new language, that's different. But if
you are in the commercial space and delivering to customers and that
customer demands top performance, stick with C/C++.


Jim
Post by Andrea Taverna
So I have considered these alternatives: FreePascal, Eiffel, Ada and
Modula-3.
I have taken a look at all of them and I'm still undecided. Below are
the impressions I got for each language.
Can you help me? Feel free to recommend other languages as well.
TIA
--> Impressions I got for each language
- FreePascal is a safe and modular alternative to C and C++, but it is
also close to the latter in terms of expressiveness. Moreover it doesn't
seem to have the libraries I need.
==>Qualifies for 0,1,2,5. Not sure about 3 and 4
- Eiffel is geared toward application programming in medium/large-sized
teams relying heavily on OO modelling. It is designed for (re)usability,
correctness and efficiency in this order. My needs are somewhat
different though.
The main gripe I have with Eiffel is the lack of a well-documented
standard gpl'ed library.
GOBO and EiffelBase seem to have incomplete or non-free documentation
and I couldn't find tutorials; as such, I couldn't get a clear picture
about them.
==> Qualifies for 0,1,2,4,5 and 6. Not sure about 3.
- Ada is best suited for large teams and/or critical software, thus it
may be overkill for my work, OTH it could have anything I might happen
to need.
What holds me from jumping onto Ada is the potential complexity
It would be interesting to hear the experience of other people learning
Ada from the C/Java background.
As for memory management (requirement 4), I heard there are different
(a) Ada uses dynamic stack allocation a lot, and in a transparent way,
reducing the need of manual management (MM)
(b) Ada libraries adopt idioms that further simplifies MM issues
(c) Conservative garbage collectors such as Bohem's can be used with
Ada, and they are supposed to work "better" with Ada than with unsafe
languages such as C and C++
So can MM be said to be easier in Ada than in C? I hope Ada-ers will
mercifully shed some light on the issue.
There seems to be a lot of Ada95 free documentation on the net, I guess
it's suitable for Ada05 as well.
==> Qualifies for 0,1,2,3,5 and, partially, 4
- Modula-3 is simpler/smaller than Ada and has been successfully used
for system/application programming.
It seems to be the most consistent, simple and easy to grok, but I
couldn't find any container/math library ready to use.
==> Qualifies for 0,1,2,4,5,6.
Warren
2010-03-23 16:50:29 UTC
Permalink
Post by balson
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions. 4) garbage collected. As an alternative, provide memory
management policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
Where's performance on this list?
Performance is mentioned in "1) directly compiled to efficient
code".
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you
have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.

But each "tool" has its own place in the toolbox.

Warren
Patrick Scheible
2010-03-23 20:29:31 UTC
Permalink
Post by Warren
Post by balson
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions. 4) garbage collected. As an alternative, provide memory
management policies via libraries (e.g. memory pools and such)
5) optional run-time checks and some kind of control over compilation
and low-level issues
6) "relatively simple and consistent"
Where's performance on this list?
Performance is mentioned in "1) directly compiled to efficient
code".
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.
Pascal is not an interpreted language. One of Pascal's selling points
was that it was one of the first languages that could be parsed by a
simple recursive descent parser without backtracking.

-- Patrick
Warren
2010-03-24 15:07:55 UTC
Permalink
Post by Patrick Scheible
Post by Warren
Post by balson
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions. 4) garbage collected. As an alternative, provide
memory management policies via libraries (e.g. memory pools and
such) 5) optional run-time checks and some kind of control over
compilation and low-level issues
6) "relatively simple and consistent"
Where's performance on this list?
Performance is mentioned in "1) directly compiled to efficient
code".
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.
Pascal is not an interpreted language. One of Pascal's selling points
was that it was one of the first languages that could be parsed by a
simple recursive descent parser without backtracking.
-- Patrick
P-code implementations were.

Warren
Patrick Scheible
2010-03-24 21:11:56 UTC
Permalink
Post by Warren
Post by Patrick Scheible
Post by Warren
Post by balson
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions. 4) garbage collected. As an alternative, provide
memory management policies via libraries (e.g. memory pools and
such) 5) optional run-time checks and some kind of control over
compilation and low-level issues
6) "relatively simple and consistent"
Where's performance on this list?
Performance is mentioned in "1) directly compiled to efficient
code".
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.
Pascal is not an interpreted language. One of Pascal's selling points
was that it was one of the first languages that could be parsed by a
simple recursive descent parser without backtracking.
-- Patrick
P-code implementations were.
True. But P-code was for student use, not production, especially not
production in an application where execution time was critical.

-- Patrick
Pascal J. Bourguignon
2010-03-24 21:27:01 UTC
Permalink
Post by Patrick Scheible
Post by Warren
Post by Patrick Scheible
Post by Warren
Post by balson
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
0) open-source support and an alive community
1) directly compiled to efficient code
2) statically typed and object-oriented, better if multi-paradigm
3) general-purpose libraries (possibly standardized, either by
standard or de facto), including containers and some math
abstractions. 4) garbage collected. As an alternative, provide
memory management policies via libraries (e.g. memory pools and
such) 5) optional run-time checks and some kind of control over
compilation and low-level issues
6) "relatively simple and consistent"
Where's performance on this list?
Performance is mentioned in "1) directly compiled to efficient
code".
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.
This is wrong.

The most common implementations of these languages are all compilers.

The fact that the compiled code is later executed by a hardware
processor or a software processor (a "virtual machine") is irrelevant to
the workings of the implementation of the language.
Post by Patrick Scheible
Post by Warren
Post by Patrick Scheible
Pascal is not an interpreted language. One of Pascal's selling points
was that it was one of the first languages that could be parsed by a
simple recursive descent parser without backtracking.
-- Patrick
P-code implementations were.
True. But P-code was for student use, not production, especially not
production in an application where execution time was critical.
This is wrong.

P-code was designed, and used, exactly like the JVM is today. There
even were developed processors that executed directly P-code, natively,
like we have JVM implemented in hardware too.
--
__Pascal Bourguignon__
b***@myrealbox.com
2010-03-26 15:54:03 UTC
Permalink
(Setting follow-ups back to the original cross-posting, since
I don't read comp.lang.ada .... )
Post by Warren
Post by balson
Post by Andrea Taverna
Hi folks!
[snip]
Post by Andrea Taverna
In the past I used C, but now I have decided to change language.
I'm looking for a "better" one.
[ snip ]
Post by Warren
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.
It's my impression that most/all current implementations of Java
do "just-in-time" compiling (of the compiled intermediate code)
to native code, and if that's true (certainly true of some of
them), does the language really count as "interpreted"? Just
sayin', maybe.
Post by Warren
But each "tool" has its own place in the toolbox.
Can't disagree with that, though!
--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
Warren
2010-03-26 19:18:05 UTC
Permalink
***@myrealbox.com expounded in news:***@mid.individual.net:
..
Post by b***@myrealbox.com
Post by Warren
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
Jim
I don't think many people would be surprised by these results.
After all Java, C# and Pascal (variants) are still largely
interpreted languages, even if they use some sort of compiled
intermediate code.
It's my impression that most/all current implementations of Java
do "just-in-time" compiling (of the compiled intermediate code)
to native code, and if that's true (certainly true of some of
them), does the language really count as "interpreted"? Just
sayin', maybe.
The "JIT" business is just a distraction IMO. Before any
"compilation" occurs, something else (the interpreter) is
orchestrating things. Even the JIT "sections of code" are
invoked on the behalf of byte code by the "monitoring"
process (i.e. the interpreter).

So unless you can get rid of that "managing process", you still
have what used to be called a "monitor process", that is outside
of the O/S. IOW, an interpreter. In CP/M, the monitor was the
O/S ;) but I digress.

Warren

J-P. Rosen
2010-03-23 17:12:23 UTC
Permalink
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance will
suffer.
I don't see why you put Pascal in the same basket. Pascal is not part of
the benchmark, therefore there is no evidence for what you say, and
Pascal does not require an interpreter or semi-interpreter.
--
---------------------------------------------------------
J-P. Rosen (***@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
Jim Balson
2010-03-23 17:41:40 UTC
Permalink
Post by J-P. Rosen
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance will
suffer.
I don't see why you put Pascal in the same basket. Pascal is not part of
the benchmark, therefore there is no evidence for what you say, and
Pascal does not require an interpreter or semi-interpreter.
I included Pascal because once you get up into languages that do bounds
checking, performance will degrade. Pascal is one of those languages
that does bounds checking. It comes down to this:

a) Either the programmer writes code to not exceed array bounds, or
b) Use a language that does it for you.

The choice of (a) will cost you a little bit of time developing.
The choice of (b) is going to cost you in performance when done.

If we were to add another language to our benchmarks, Pascal would be
the logical choice. And we may do it at some point in the future. We're
certainly going to add many more algorithms to the testing as time permits.


Jim
Warren
2010-03-24 15:15:19 UTC
Permalink
Post by Jim Balson
Post by J-P. Rosen
Post by balson
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance
will suffer.
I don't see why you put Pascal in the same basket. Pascal is not part
of the benchmark, therefore there is no evidence for what you say,
and Pascal does not require an interpreter or semi-interpreter.
I included Pascal because once you get up into languages that do
bounds checking, performance will degrade. ...
Leave out bounds checking, and quality will degrade.

Warren
Colin Paul Gloster
2010-03-25 15:46:47 UTC
Permalink
On Tue, 23 Mar 2010, Jim Balson wrote:

|-------------------------------------------------------------------------|
|"[..] |
| |
|If we were to add another language to our benchmarks, Pascal would be the|
|logical choice." |
|-------------------------------------------------------------------------|

FORTRAN-77 code on a good machine would be faster if no heap usage is needed.

|-------------------------------------------------------------------------|
|" And we may do it at some point in the future. We're certainly |
|going to add many more algorithms to the testing as time permits." |
|-------------------------------------------------------------------------|

Good.
Patrick Scheible
2010-03-23 17:31:04 UTC
Permalink
Post by balson
Where's performance on this list? Do you not care how fast the
applications run? Look at the following white paper to see if
performance should or shoild not be high on your list if you are
http://www.cherrystonesoftware.com/doc/AlgorithmicPerformance.pdf
What this WP documents is we took 5 basic very common computer science
algorithms and wrote them in different languages: C/C++, Java and C# and
then benchmarked them against each other. If performance is of any
concern to you, you'd stiff with C/C++.
IOW, stay away from the likes of Java, C#, Pascal. Unless you have a
very specific reason for going in that direction. Your performance will
suffer.
[snip]

I looked at the paper on the web page you point at. Why do you not
distinguish between C and C++? They are significantly different
languages. If you use C++, performance will probably suffer compared
to C.

Why are you making statements about Pascal's performance? While
Pascal has some annoying limitations for the programmer, it is very
fast. If you tested it, where's the results? If you didn't test it,
why are you making disparaging comments about it?

Performance only sometimes comes from better performance on the same
code. Most of the time, performance gains come from writing a
better algorithm. Programmers are better off chosing a language
well-suited to the problem. Then if performance isn't good, figure
out where it's slow and improve that part of the code.

-- Patrick
Loading...