comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Map iteration and modification
Date: Thu, 4 Jan 2024 12:28:04 +0100	[thread overview]
Message-ID: <un64o3$3krch$1@dont-email.me> (raw)
In-Reply-To: <un5asc$3hsqb$1@dont-email.me>

On 2024-01-04 05:07, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:un3bg9$35mhv$1@dont-email.me...

[...]

>> Yes, ordering is an ability to enumerate elements of a set. It is not an
>> artifact it is the sole semantics of.
> 
> Iteration is not necessarily enumeration. It is applying an operation to all
> elements, and doing that does not require an order.

That is not iteration, it is unordered listing, a totally useless thing 
because the result is the same unordered set.

You could not implement it without prior ordering of the elements you 
fed to the threads. If the threads picked up elements concurrently there 
would be no way to do that without ordering elements into a taken / not 
yet taken order. Hell, you cannot even get an element from a truly 
unordered set, no way! If the programmer tried to make any use of the 
listing he would again have to impose ordering when collecting results 
per some shared object.

The unordered listing is a null operation without ordering.

>> The key difference is that index does not refer any element. It is
>> container + index that do.
> 
> That's not a "key difference". That exactly how one should use cursors,
> especially in Ada 2022. The Ada containers do have cursor-only operations,
> but those should be avoided since it is impossible to provide useful
> contracts for those operations (the container is unknown, so the world can
> be modified, which is bad for parallelism and understanding). Best to
> consider those operations obsolete. (Note that I was *always* against the
> cursor-only operations in the containers.)
> 
> So, using a cursor implies calling an operation that includes the container
> of its parameter.

OK. It is some immensely over-designed index operation, then! (:-)) So, 
my initial question is back, why all that overhead? When you cannot do 
elementary things like preserving your indices from a well-defined set 
of upon deleting elements with indices outside that set?

>>>> I don't see anything that is not already there. What are reasons for not
>>>> providing:
>>>>
>>>>      M (n)       [ e.g. M (n).Key, M (n).Value ]
>>>>      M (n1..n2)  [ in mutable contexts too ]
>>>>      M'First
>>>>      M'Last
>>>>      M1 & M2     [ M1 or M2 ]
>>>>
>>>> They are all well-defined and useful operations.
>>>
>>> Performance.
>>
>> Irrelevant so long it does not tamper implementations of other operations.
> 
> Exactly. These operations, especially slicing, have a huge impact on the
> cost of parameter passing for arrays (whether or not they are used). And
> that's a pretty fundamental operation.

It is not slicing it is dynamically constrained arrays which are 
required anyway. A general problem of language design is how to treat 
statically known constraints effectively.

Ada arrays are pretty good to me. Note, I am saying that after years of 
using Ada arrays for interfacing C! Yes, I would like having more 
support for flattening arrays, but the mere fact that Ada can interface 
C using *in-place* semantics invalidates your point.

> Specifically, the containers are separate from Ada.

Not really. Like STL with C++ it massively influenced the language 
design motivating adding certain language features and shifting general 
language paradigm in certain direction.

>> Usability always trumps performance.
> 
> That's the philosophy of languages like Python, not Ada.

Ah, this is why Python is totally unusable? (:-))

Ada is usable and performant because of right abstractions it deploys. 
If you notice performance problems then, maybe, just my guess, you are 
using a wrong abstraction?

>> And again, looking at the standard containers and all these *tagged*
>> *intermediate* objects one needs in order to do elementary things, I kind
>> of in doubts... (:-))
> 
> The standard containers were designed to make *safe* containers with decent
> performance.

Well, we always wish the best... (:-))

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2024-01-04 11:28 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 13:53 Map iteration and modification DrPi
2023-12-28 13:59 ` DrPi
2023-12-28 16:06   ` Dmitry A. Kazakov
2023-12-28 17:57     ` DrPi
2023-12-29  3:20     ` Randy Brukardt
2023-12-29  9:51       ` Dmitry A. Kazakov
2023-12-29 15:03         ` G.B.
2023-12-29 16:52           ` Dmitry A. Kazakov
2024-01-01 19:27             ` G.B.
2024-01-01 20:55               ` Dmitry A. Kazakov
2024-01-02 16:40                 ` G.B.
2024-01-02 20:57                   ` Dmitry A. Kazakov
2024-01-03  3:22                 ` Randy Brukardt
2024-01-03  4:05                   ` moi
2023-12-30  7:21         ` Randy Brukardt
2023-12-30 11:07           ` Dmitry A. Kazakov
2024-01-03  3:15             ` Randy Brukardt
2024-01-03 10:04               ` Dmitry A. Kazakov
2024-01-04  4:07                 ` Randy Brukardt
2024-01-04 11:28                   ` Dmitry A. Kazakov [this message]
2024-01-05  2:00                     ` Randy Brukardt
2024-01-05  9:26                       ` Simon Wright
2024-01-05 11:51                       ` Dmitry A. Kazakov
2024-01-06  7:25                         ` Randy Brukardt
2024-01-07 15:06                           ` Jeffrey R.Carter
2024-01-09  4:46                             ` Randy Brukardt
2024-01-09  5:56                               ` when-clauses (was Re: Map iteration and modification) Lawrence D'Oliveiro
2024-01-09  9:43                               ` Map iteration and modification Jeffrey R.Carter
2024-04-17 10:12                         ` Cóilín Nioclás Pól Glostéir
2024-01-06  2:54                       ` “Usability” (was Re: Map iteration and modification) Lawrence D'Oliveiro
2024-01-06  7:03                         ` "Usability" " Randy Brukardt
2024-01-06  8:14                           ` Niklas Holsti
2024-01-06 23:41                           ` Lawrence D'Oliveiro
2024-01-07  1:21                           ` J-P. Rosen
2024-01-09 15:19                             ` Bill Findlay
2024-01-09 20:30                             ` Lawrence D'Oliveiro
2023-12-29  3:08   ` Map iteration and modification Randy Brukardt
2023-12-29 13:53     ` DrPi
2023-12-30  6:29       ` Randy Brukardt
2023-12-31 13:56         ` DrPi
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox