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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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: =?UTF-8?B?QmrDtnJuIEx1bmRpbg==?= Newsgroups: comp.lang.ada Subject: Re: If not Ada, what else... Date: Wed, 29 Jul 2015 20:52:23 +0200 Organization: A noiseless patient Spider Message-ID: References: <7a29d3e9-d1bd-4f4a-b1a6-14d3e1a83a4d@googlegroups.com> <87mvz36fen.fsf@jester.gateway.sonic.net> <2215b44f-8a89-47c6-a4c4-52b74d2dac45@googlegroups.com> <9e492c82-868d-43d3-a18a-38274400e337@googlegroups.com> <40184feb-4053-4ac3-8eaa-c3bd9cd8a77c@googlegroups.com> <10272577-945f-4682-85bc-8ad47f3653ae@googlegroups.com> <87si8i81k2.fsf@atmarama.net> <8076cbd0-2655-4c98-b70e-cb5f0c32e4ba@googlegroups.com> <5e6cb30b-5f8c-4fed-969e-3941315ecba0@googlegroups.com> <87si87nf8k.fsf@jester.gateway.sonic.net> <877fpiom3q.fsf@jester.gateway.sonic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Wed, 29 Jul 2015 18:49:03 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="5b7792bbfdd207fe5c19aea2206a9f76"; logging-data="4859"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191LLnXB7SyOWG86l5K6Fu1" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 In-Reply-To: <877fpiom3q.fsf@jester.gateway.sonic.net> Cancel-Lock: sha1:+yUoV1f1zjiIHrqpLBfXFtC3//s= Xref: news.eternal-september.org comp.lang.ada:27140 Date: 2015-07-29T20:52:23+02:00 List-Id: On 2015-07-29 20:27, Paul Rubin wrote: > Björn Lundin writes: >> See Ada.Containers.* > > Will look there, but those kinds of containers are more useful with GC. I think you are missing the point. Many things in Ada is done without allocating with 'new' And things that are, if OO, may inherit from Ada.Finalized, which gives a call to the objects' 'Finalize' method where deallcation - if necessary - can be done. So, the user does not fiddle with new/free. declare package Stuff_Pkg is new Ada.Containers.Doubly_Linked_Lists(Stuff_Type); Stuff_data : Stuff_type; Stuff_List : Stuff_Pkg.List begin for i in 1 ..100 loop Stuff_list.Append(Stuff_data): end loop; -- use stuff_list here end; --no mem leak here > >> How is Haskell doing in Ada territory, like concurrency etc ? > > It's partly on the implementation, but GHC's concurrency is far superior > to GNAT's in my opinion. GNAT uses Posix threads while GHC supports > lightweight threads with parallel garbage collection. It can handle > millions of concurrent threads on a large server: > > http://haskell.cs.yale.edu/wp-content/uploads/2013/08/hask035-voellmy.pdf > > GHC also supports software transactional memory (STM), that let threads > composably share mutable data without the traditional hazards of lock > inversion etc. Haskell's type system statically verifies that STM > operations aren't improperly mixed with I/O that could wedge the runtime: > > http://book.realworldhaskell.org/read/software-transactional-memory.html > > GHC also supports various kinds of deterministic parallelism, like the > "par" operator that lets you very simply annotate that two operations > can be done in parallel (on separate cpu cores): > > https://donsbot.wordpress.com/2007/11/29/use-those-extra-cores-and-beat-c-today-parallel-haskell-redux/ > > The cool thing about this is it doesn't affect the datatypes in the > program, and if you use it improperly, your program might run slower > instead of faster, but it will still find the right answers. > > There are also data parallelism libraries that will let you spin array > computations off to SIMD units or GPU's, but Ada probably has similar > libraries. > > There is an online book about parallel and concurrent programming in > Haskell (scroll down for the TOC): > > http://chimera.labs.oreilly.com/books/1230000000929/index.html > > ================ > > Where Ada beats Haskell is in deterministic timing and memory footprint. > SPARK has ways to verify that an Ada function can't possibly throw an > exception. That's difficult in Haskell, because programs constantly use > the memory allocator, and there can also be unpredictable GC pauses at > any time in the program. Ada can also compile to small cpu targets > because of its small or nonexistent runtime system. > > So I'd see the archetypal Ada application as a critical embedded system > like a jet engine controller, while the archetypal Haskell application > is something like a compiler or internet server that must not give wrong > answers, but where a pause in execution (or even an OOM crash followed > by a failover or workaround) is annoying but not disastrous. > Interesting reading -- -- Björn