Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why are Controlled types so, well, strange?

controlled Strange types
0
10 Posted

Why are Controlled types so, well, strange?

0

(Tucker Taft responds): We considered many approaches to user-defined finalization and user-defined assignment. Ada presents challenges that make it harder to define assignment than in other languages, because assignment is used implicitly in several operations (by-copy parameter passing, function return, aggregates, object initialization, initialized allocators, etc.), and because Ada has types whose set of components can be changed as a result of an assignment.

0

(Tucker Taft responds): We considered many approaches to user-defined finalization and user-defined assignment. Ada presents challenges that make it harder to define assignment than in other languages, because assignment is used implicitly in several operations (by-copy parameter passing, function return, aggregates, object initialization, initialized allocators, etc.), and because Ada has types whose set of components can be changed as a result of an assignment. For example: type T (D : Boolean := False) is record case D is when False => null; when True => H : In_Hands; end case; end record; X,Z : T; Y : T := (True, H => …); … X := Y; — “X.H” component coming into existence Y := Z; — “Y.H” component going out of existence With a type like the one above, there are components that can come and go as a result of assignment. The most obvious definition of assignment would be: procedure “:=” (Left : in out In_Hands; Right : in In_Hands); Unfortunately, this wouldn’t work for the “H”

0

We considered many approaches to user-defined finalization and user-defined assignment. Ada presents challenges that make it harder to define assignment than in other languages, because assignment is used implicitly in several operations (by-copy parameter passing, function return, aggregates, object initialization, initialized allocators, etc.), and because Ada has types whose set of components can be changed as a result of an assignment. For example: type T (D : Boolean := False) is record case D is when False => null; when True => H : In_Hands; end case; end record; X,Z : T; Y : T := (True, H => …); … X := Y; — “X.H” component coming into existence Y := Z; — “Y.H” component going out of existence With a type like the one above, there are components that can come and go as a result of assignment. The most obvious definition of assignment would be: procedure “:=” (Left : in out In_Hands; Right : in In_Hands); Unfortunately, this wouldn’t work for the “H” component, because there

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123