From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.ada Subject: Re: If not Ada, what else... Date: Fri, 10 Jul 2015 19:31:06 -0700 Organization: A noiseless patient Spider Message-ID: <87oajj4e8l.fsf@jester.gateway.sonic.net> References: <14592326-5070-4663-a864-5684298f3748@googlegroups.com> <004361da-53c4-4ea9-8cc6-38944aa6c7ad@googlegroups.com> <29dd5458-f9ce-4db8-9128-8ab35a9ce5f8@googlegroups.com> <64bc671c-72e5-4924-b703-3b907c69949c@googlegroups.com> <877fq9uj6g.fsf@theworld.com> <65061686-5c8f-433b-9b11-9e228298158e@googlegroups.com> <87k2u96jms.fsf@jester.gateway.sonic.net> <06f8a6f9-d219-4d40-b9ac-8518e93839bd@googlegroups.com> <87y4io63jy.fsf@jester.gateway.sonic.net> <7a29d3e9-d1bd-4f4a-b1a6-14d3e1a83a4d@googlegroups.com> <87mvz36fen.fsf@jester.gateway.sonic.net> <2215b44f-8a89-47c6-a4c4-52b74d2dac45@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="22184b02e80198190244f5a2dd813f11"; logging-data="7774"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18w/imkS+gZkpU0ZimuMZnb" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:Z2fBDRXsC6DMa47IiEOtlRdwysQ= sha1:5qfue4r5QByAfL+bNcsUHxDI5xY= Xref: news.eternal-september.org comp.lang.ada:26761 Date: 2015-07-10T19:31:06-07:00 List-Id: David Botton writes: >> I was aware of SPARK before that, when it was a separate expensive tool > So now an expensive vendor tool is still an expensive vendor tool But now there's a free version of SPARK, a big change. > We are talking about Ada not SPARK. If you like SPARK and it fits your > needs great. Well, I'm thinking of SPARK as a component of Ada-2012. Maybe that's not exactly right but there's some conceptual sense to it. > So in C++ you can create new incompatible types with various ranges, > use them for array indexes, true enums? I'm no C++ expert but I believe it has real enums (i.e. typed), unlike C enums. And since you can overload the [] operator and use whatever you want as indexes, making incompatible range types and using them as indexes is straightforward though a bit cumbersome. It wouldn't surprise me if there's a package for it (using templates) already. > That is what you don't understand, Ada is about compile time checks > and that comes with contacts. Contracts on the types, contracts on the > interfaces. Historically AFAIK range types in Ada were not statically checked. Checking them is very complicated and can be partly automated these days with SMT solvers, but in general you'd need proof assistants and lots of manual effort. Are we talking about the same thing? > Well, once upon a time Ada compilers were certified. I don't believe > AdaCore does that anymore. There was some federal agency that did it, I thought. It was eventually shut down after it had served its purpose, which was getting standardization to really mean something. > And if you use Ada long enough you learn to use the Stack most of the > time to accomplish the same thing and you don't get sloppy which tends > to happen to GC dependent programmers. This is no different from C++. The usefulness of GC depends on what kinds of programs you're writing, so it's true, lots of code doesn't need it, but for some, it's great. C++ programs these days use reference counted smart pointers, which are a poor man's GC. > Ada does have a GC in some implementations as I pointed out. You are > having trouble separating language from runtime environment. A GC in > Ada or D is something you can choose to use. Yes, I'm just not sure why to use a GC in Ada. If you can afford a GC's overhead and accept the non-determinism it creates, why use Ada in the first place, instead of something like Haskell? I guess there might be some situations. But I mostly find Ada attractive for exactly the problems in which GC is unattractive or unfeasible. > BTW, I've never had the need but there are ways to use a GC even the > current GNAT's on most platforms. That's interesting and I'll look into it. >> GC'd languages that support functional-programming idioms > You can use D in that environment, although Ada is better at it. Repl > clauses, etc. are also pluses. Not sure what a repl clause is. Ada doesn't support FP style very well, which is fine because that was never its goal. >> I consider [C and C++] ... to be niche languages > No still general purpose. You need to look at the language itself to > make that determination not just how it is being used currently. I'd say you have to look at the problems people are trying to solve, and the technology available for solving them. These days most programming is done on very powerful, underutilized cpus with tons of memory compared to the problem, so GC'd languages are generally the most productive approach for those applications. > C and C++ are still heavily used in general use cases, from embedded > to UI and Game Dev, etc. Embedded is a niche, UI should be done in other languages these days, and game dev is somewhat special because it's often realtime. One of the most successful games (Minecraft) was written in Java though, lots of games use a combination of C++ and Lua, and there's this: https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf > If anything C#, Python, Java are more niche, just their niche is where > the vast majority of programs and programmers are. You would be a fool > to use any of the three in anything critical (safety, time, etc.) If the vast majority of programs and programmers are in a particular place, then that place is by definition mainstream and not a niche ;-). Only a few programmers are doing safety or time critical things, so THAT is a niche. But, an awful lot of mainstream programs and programmers now are doing internet applications, which brings security concerns that make unsafe languages like C problematic. Ada might be ok if you leave all the runtime checks enabled, though there's still a productivity issue. There's also no implementation that I know of with lightweight multitasking like Go, so that cramps you if you want to run high-concurrency servers. > Even Haskell, OCAML, etc. are fairly niche. All the scripting > languages are niche. Scripting is mainstream in that it's how most stuff is being written. Haskell and Ocaml are niche because while they have fairly broad applicability, there's not much of a userbase and it's not clear that Haskell has significant advantages for the typical CRUD app (Ocaml might make more sense). Or if you want something really "out there", http://www.impredicative.com/ur/ might be of interest. > Ada, D, C, C++ are all geared for full range dev across the entire > spectrum. Ada due to external issues in tool and compiler availability > is the more limited currently, but almost as broad. Just because you CAN write something in Ada, D, C, C++, Forth, Assembler etc. (those languages can all do pretty much anything) doesn't mean that there's not a more effective alternative in a particular area. What I'd say is those languages are most effective in areas that are (as of 2015) somewhat specialized in the way I see things. Full range devs should be able to use them when the task calls for it, but most tasks these days probably don't.