I'm looking for a new language

De qué se hablaPurely Programmers

Únase a LibraryThing para publicar.

I'm looking for a new language

Este tema está marcado actualmente como "inactivo"—el último mensaje es de hace más de 90 días. Puedes reactivarlo escribiendo una respuesta.

1prosfilaes
Ago 22, 2013, 10:55am

I've used Ada as my major language for a long time, and it's no longer providing what I need. I figured I'd talk some of my thinking out loud, and maybe someone could offer their two cents.

What I like about Ada:
* A careful, precise, statically typed language
* Clean readable syntax
* Fast (cf. http://benchmarksgame.alioth.debian.org/ for some rough numbers)
* Offers good support for imperative, object orientated and generic programming
* Stable international standard
* Good support for interfacing with C, C++ and Fortran
* Statically compiled, targeting virtually everything
* Standard freely available and a readable reference to pretty much everything about the language

What I'm getting unhappy with:
* Inferior IDE support (GPS is absurdly slow on my system, and neither Emacs nor Kate are good enough)
* The type system is too heavyweight; particularly having to explicitly instantiate standard containers
* There's not enough library support; you have to link to C or C++ or write your own (and generics are going to force the last)
** (Good support for interfacing with C, yes, but C header files are a mess and there's a limit to how well you can translate them without being C++).
* Little real support for functional programming; function pointers are artificially limited and the library doesn't seem to be designed to return constant values

Neutral things:
* Ada handles a lot of memory stuff behind the scenes, but there's no garbage collector. Fair or not, I'm worried that a garbage collector is going to cover 95% of the cases and cause problems in the last 5%, about the same ratio I'm getting right now.
* There's no real support for the JVM, though prototypes have shown up and there's no theoretical reasons it can't work.

The one hard requirement is that it has to have an open-source compiler or interpreter for Linux, with languages that just have interpreters preferably having them be ubiquitous. I run Debian, so convenient support there is an issue.

What have I looked at:

Python 3: I thought I'd start here because I use Python 3 and it's a good description of what I don't want. Van Rossum says it's not too slow, because you can always rewrite any slow parts in another language, which isn't exactly enough. (The benchmarking puts it about 40x slower then Ada.) It lacks static typing and the error messages are frequently unhelpful. Syntax is pretty reasonable, but it's just not what I'm looking for for an Ada replacement.

Erlang: I like the multiprocessing system, but the functional programming level is just too high, and the ways to do imperative programming seem hackish. The benchmarking above ranks it about 7x slower then Ada for the compiler, which has limited targets. I think it's pretty much off my list.

C: Yeah, no. I can see times when I'd have to use C, but no bounds checking? No real generics? No way.

Java: Like C, I use it when necessary. It's a lot more serious contender then C, but except for the JVM and library support, it's probably strictly inferior to Ada; less flexible and inferior generics (type elision? Yuck.) And while I did mention OO above, it's not a technique that's ever really percolated down into my soul, meaning there's going to be a certain impedance mismatch.

C++: I moved from C++ to Ada many years ago. I understand that there's a lot of difference between C++98 and C++11 (or 14), and I plan to get my hands on a copy of The C++ Programming Language, Fourth Edition at some point. (I will mention this effectively a big loss in the freely available standard department.) Feature-wise, it is practically a superset of Ada, except for the tasking, and C++ templates are seriously more powerful. However, I doubt all the paint on this can hide the C underbody; especially interfacing with existing code you're going to have to use unboundchecked arrays and raw points. And the syntax is pretty obscure at points.

(And could:
template
struct Factorial {
enum { value = N * Factorial::value };
};

template
struct Factorial {
enum { value = 1 };
};

// Factorial::value == 24
// Factorial::value == 1

get much more obscure? Youch. (From: http://en.wikipedia.org/wiki/Template_metaprogramming )

Eiffel: I've got the standard on my Kindle, and I like the elegance, at least in theory. I see, however, there's not much point in going further, as it doesn't have a supported open source compiler.

Common Lisp: It's reasonably fast--roughly 2x as slow as Ada in the benchmarks--and quite powerful. It's not statically typed, though, and it doesn't really have the library support I'm looking for.

Getting down to the real contenders, I've got ebook copies of Real World OCaml and Programming Scala.

OCaml: I'm really liking OCaml; for a functional language, it's got solid support for imperative programming, and it looks like it supports my style of programming. It's fast and portable. On the other hand, it's probably going to be even worse for libraries and external bindings, and just as concerning the package from the development files for the Jane Street Core (considered essential by the author of the Real World OCaml) is broken and won't install.

Scala: It's really coming down to Scala. It's got most of the features I'm looking for. Its syntax is not written for clarity, though OCaml has some of the same issues. It inherits type elision from Java. I guess ultimately it's not giving me the warm fuzzies I want; maybe going through the book and using the language some will fix that, maybe it won't.

Any suggestions? Languages I missed? Important clarifications? Just want to add 2 cents?

2suitable1
Ago 22, 2013, 11:59am

There's always COBOL

3lorax
Ago 22, 2013, 12:16pm

I like Scala, and having come from mostly Python I'll say that it's far more congenial than Java having less stupid crufty overhead. Scala can be perfectly clear, though it can also be incredibly opaque. You can use it more or less as a straight OO language if you want, pulling in only as much of the functional aspects as you like. Because it's a JVM language you can easily use any Java libraries you want to. The major drawback as far as I'm concerned is that the compiler is very slow; the old XKCD ("I'm not slacking off, my code's compiling!") frequently comes to mind.

There's a good Coursera course taught by Martin Odersky, who wrote Scala; if you're considering learning, I'd recommend giving it a look.

4prosfilaes
Editado: Ago 22, 2013, 7:53pm

2: No open source compiler for COBOL. I thought about putting Fortran on the list; Fortran 2003/08 has object orientation and some support for generics. While technically in the running, it wasn't a serious contender.

3: Thanks.

Coming from Ada, I am looking to get rid of some of the verbosity, but I also used the language because I liked the formality and structure. The line between stupid crufty overhead and clarifying explicitness is sometimes hard to see. In my experience with Python, I looked back at a chunk of my code and realized that I was returning either a TV show or movie, the distinguishing mark being the length of the tuple (and so explicitly tested) and elements referenced by number. I'd rather use a language that didn't let me do that, or at least pushed me away from it.

My problem is that as I mentioned in the Java section above, I've never been bitten by the OO bug. I understand the motivation, and read something recently that said the rise of GUIs led to the rise of OO systems, since they work well together. I've just rarely seen the need of inheritance in my code, and certainly not the value of treating everything as an object. A lot of the advantage of OO in C++ versus C seems to be information hiding, but Ada has always had the ability to hide the definition of type and force people to use it through functions, even prior to it becoming a full OO language. I guess I get to go along with the times.

The Java libraries on the JVM seem to be one of the huge reasons to use a JVM language, and what I've seen reading through the Scala book is that using Java libraries in Scala is a lot less alien then using C libraries in pretty much anything but C or C++.

What IDE do you use to write Scala in? Just Eclipse? I've used Eclipse for writing Android programs, and my reaction was mixed.

I actually was signed up for the Scala course, but tend to winnow down courses quickly after they start and at the time didn't see the point in continuing with this one. It's coming up again in September, and I'll probably work my way through that one.

5lorax
Ago 23, 2013, 11:48am

4>

I use IntellIJ for my IDE.

What I mean by "stupid crufty overhead" is stuff like needing to say "Keyword keyword = new Keyword(foo)", where you're stating the type of the object twice. Or "public static void main()". In Scala I could say "val keyword = new Keyword(foo)". (You can explicitly state the type too, which is useful when you have a multi-line function and it's not obvious what the return type is.) The non-imperative nature also means I have written an explicit iteration (you know, (for i = 0, etc) exactly once at my current job using Scala, and that's because I was using a Java type that didn't have the nice Scala methods; if you want to square every item in a list it's as easy as list.map(x => x^2). It is definitely not a weakly typed language like Python.

Using Java libraries in Scala is completely transparent; my current task has dependencies on Lucene and it's as easy as just importing the library and then using it as you would in Java. I don't even know if a lot of our external dependencies are in Scala or Java, to be honest, unless I need to look at their code.

6vy0123
Sep 15, 2013, 10:33pm

The coursera course is about to begin, 7-weeks with Martin Odersky .

https://www.coursera.org/course/progfun

7andyl
Sep 16, 2013, 4:17am

Hmmm - ADA is a statically typed, bondage & discipline language. Most of my development focus is completely different from that now so I can't really help.

8guido47
Sep 16, 2013, 6:51am

May I be totally trivial?

What is wrong with ALGOL 60?

*double grin plus*

9MMcM
Sep 16, 2013, 9:07am

Another consideration is team aspects and requirements. Ada, of course, was specifically designed for a certain kind of team.

10prosfilaes
Editado: Feb 4, 2014, 3:54am

I've hacked some with Scala, and it's quite interesting. There seems to be some objection on the web about speed, but converting Python has shown a nice speed-up. (As has converting SQL--I had assumed that anything natural to do in SQL would be faster using MySQL then in a programming language, but exporting the raw data to Python and even more raw data to Scala and folding it there has produced significant speed-ups.) I haven't done personal benchmarks, but my personal limit was no worse then half the speed of decent C, and I think I'm getting that.

I'm still not entirely happy with the Java environment. As a somewhat old-school Unix guy, having libraries magically downloaded from the web leaves me a bit nonplussed and feeling a little out of control, and it seems JVM programs require a shell script to run, unlike Perl or Python or compiled languages. (Maybe I should see if I can bring GCJ into modern times.)

Type inference is incredibly powerful and still a bit troublesome; the ability to not write out SortedMap {String, Map {String, Int}} is incredibly powerful, but then you've giving up the ability to look in the code and tell what type that variable is... and if it's really a SortedMap {String, Map {String, Int}}}, that's quite possibly not trivial to tell at a glance. I suppose that's one of the features where it's left to the programmer to be wise, and Scala unlike Python does let you write type names down.

I've seen a lot of claims by Scala programmers that they rarely use for loops or recursion. I haven't achieved that level of purity, but higher-level functions are interesting. I'm certainly getting lost in some of the stuff I'm reading, like the more complex type stuff.

I'll note that I was in the HackerRank CodeSprint 5, and after it was over I looked at the other Scala solutions for the FP track problem (limited to Haskell, OCaml, Clojure and Scala and maybe Erlang). None of them were really functional, and one of them passed problem data into and the solution out of the main function via global variables! I know, 24 hour hackathons aren't going to be wonders of code quality, but it is an interesting contrast to all the Haskell-style arguments about Scala.

11orbifx
Abr 24, 2014, 5:14pm

+Haskell.

There is a lot written on the net for me to go on explaining. You have written a lot of criteria and I wonder if there is anything to satisfy them all.

12kiparsky
Abr 24, 2014, 5:20pm

>10 prosfilaes: "I've seen a lot of claims by Scala programmers that they rarely use for loops or recursion."
Yeah, I've found that when I'm working in higher-level languages, loops tend to fall away. It's a good thing - you end up thinking more about the task and less about the language structures that support it.

13prosfilaes
Abr 25, 2014, 10:03pm

11> Of course there's nothing that fits all the criteria. But they guide the search.

Haskell is really not what I'm looking for. I'm not willing to try and go pure functional. And the ability to easily access the Java ecosystem is awesome. The ability to access the C ecosystem with some work is simply not comparable.

14shmibs
Ago 29, 2016, 10:26am

for posterity's sake, elixir is looking really nice these days.

> * A careful, precise, statically typed language
though the "default" is to leave type-checking to runtime, it can be done statically as well, making it suitable both for prototyping and production

> * Clean readable syntax
primary feature. however, definitely subjective. i have a c-ish background and love it, while my friend has a lisp-ish background and hates it

> * Fast
generally as "fast" as erlang. like erlang, though, speed is not the language's primary goal

as for the rest of things, it is solely functional, but not caught up on "purity" a la haskell, and its syntax makes writing imperative-ish functionality very natural. still a recent language, so some details are apt to change, but it has access to all of erlang + OTP, which have been around forever, so support for things isn't lacking. linking to C libraries is possible too, but is of course discouraged because when they "go wrong" they tend to blow everything up.

not sure about "IDE support", but have never seen the point of anything beyond vim, a nice repl, and a unit testing suite for any language, and elixir provides all three, with an easy way to document your own functions and modules so that they're accessible from in-repl help etc

15orbifx
Ago 7, 2017, 9:28am

In the end I have settled on OCaml,, which is not (necessarily) purely functional but is functional. Also it's really easy to bind with C.

There is a library for accessing the Java ecosystem, but have not tried it.

16SamHobbs
Ago 8, 2017, 9:54pm

I totally understand if you don't want to use COBOL. You can say you don't want to and should not need to explain. I assume it was suggested more as a joke.

However you probably did not look very much for free COBOL compilers. Sure the big companies like IBM and Micro Focus don't give it away but there is TinyCOBOL and GnuCOBOL in SourceForge.

One of the things I don't like about COBOL is that old-time programmers have habits that they expect the world to conform to, like prefixing function names with numbers.

17Lyndatrue
Editado: Ago 8, 2017, 10:22pm

>16 SamHobbs: A couple of hints for you. Note that when you're replying to a comment, it's nice to use the angle bracket and number of the comment (with no space) which will make a nice link to the item you're replying to (>2 suitable1: and >4 prosfilaes: in this case).

This is the third ancient thread you've replied to, and many people who were having the conversation may have wandered on to other things. There doesn't seem to have been much activity in Purely Programmers since 2013.

There are plenty of people here who have programming books and interests, but I'm not sure that anyone's still having conversations about writing code here on Library Thing.

Join some more groups. Hang around for a while. Add some more books. Library Thing is an interesting place.

18prosfilaes
Ago 10, 2017, 3:06am

>16 SamHobbs: TinyCOBOL hasn't had a release since 2011. GnuCOBOL does seem to be a working COBOL compiler, but I don't know if it was when >4 prosfilaes: was written.

19prosfilaes
Ago 10, 2017, 7:02pm

>17 Lyndatrue: There doesn't seem to have been much activity in Purely Programmers since 2013.

I wouldn't restart ancient threads usually, but certainly if he wants to talk about programming on LT, he should feel free to post threads in Purely Programmers.

20Lyndatrue
Ago 10, 2017, 7:12pm

>19 prosfilaes: Of course. I was merely pointing out that he might not get much in the way of responses (and there's been more than I expected, which was nice).

21SamHobbs
Ago 18, 2017, 7:27pm

>17 Lyndatrue: well it does not matter if anyone that has seen or participated in this discussion in the past sees my responses but they are there in case anyone reads the discussion in the future at least. I don't understand the problem. If there has not been much activity then the only way to get activity is to create activity. As for actual programming questions, I agree this is not the place for that except maybe asking what book would be good. So I agree that asking what would be a good language might be off-topic. That issue should be mentioned when a discussion is created.

>18 prosfilaes: well I will say that subject has gotten far enough.

>19 prosfilaes: on the premise that there must always be a criticism, that sounds good.